From 57e5142d5c9d326912610e3bd60743420f8a328a Mon Sep 17 00:00:00 2001 From: Ben Longbons Date: Wed, 5 Nov 2014 15:44:23 -0800 Subject: Remove unsupportable config settings --- src/char/char.cpp | 50 +++------------------- src/login/login.cpp | 112 +++++++------------------------------------------- src/login/login.hpp | 2 + src/login/login.t.hpp | 35 ++++++++++++++++ src/map/battle.cpp | 8 ---- src/map/battle.hpp | 3 -- src/map/chrif.cpp | 2 - src/map/clif.cpp | 19 +++------ src/map/map.cpp | 2 +- src/map/map.hpp | 2 +- src/map/tmw.cpp | 2 +- src/wire/packets.cpp | 20 ++++----- src/wire/packets.hpp | 2 +- 13 files changed, 77 insertions(+), 182 deletions(-) create mode 100644 src/login/login.t.hpp (limited to 'src') diff --git a/src/char/char.cpp b/src/char/char.cpp index 8ce2165..57788ee 100644 --- a/src/char/char.cpp +++ b/src/char/char.cpp @@ -110,7 +110,7 @@ AccountPass passwd; static ServerName server_name; static -CharName wisp_server_name = stringish("Server"_s); +const CharName WISP_SERVER_NAME = stringish("Server"_s); static IP4Address login_ip; static @@ -131,8 +131,6 @@ IP4Address lan_map_ip = IP4_LOCALHOST; static IP4Mask lan_subnet = IP4Mask(IP4_LOCALHOST, IP4_BROADCAST); static -int char_name_option = 0; // Option to know which letters/symbols are authorised in the name of a character (0: all, 1: only those in char_name_letters, 2: all EXCEPT those in char_name_letters) by [Yor] -static std::bitset<256> char_name_letters; // list of letters/symbols authorised (or not) in a character name. by [Yor] static constexpr GmLevel default_gm_level = GmLevel::from(0_u32); @@ -167,9 +165,6 @@ std::array auth_fifo; static auto auth_fifo_iter = auth_fifo.begin(); -static -int check_ip_flag = 1; // It's to check IP of a player between char-server and other servers (part of anti-hacking system) - static CharId char_id_count = wrap(150000); static @@ -192,8 +187,6 @@ AString online_txt_filename = "online.txt"_s; static AString online_html_filename = "online.html"_s; static -int online_sorting_option = 0; // sorting option to display online players in online files -static int online_refresh_html = 20; // refresh time (in sec) of the html file in the explorer static GmLevel online_gm_display_min_level = GmLevel::from(20_u32); // minimum GM level to display 'GM' when we want to display it @@ -490,7 +483,7 @@ bool extract(XString str, CharPair *cp) else if (!extract(hair_style, &p->hair)) return false; - if (wisp_server_name == k->name) + if (WISP_SERVER_NAME == k->name) return false; // TODO replace *every* lookup with a map lookup @@ -688,7 +681,6 @@ CharPair *make_new_char(Session *s, CharName name, const Stats6& stats, uint8_t } // Check Authorised letters/symbols in the name of the character - if (char_name_option == 1) { // only letters/symbols in char_name_letters are authorised for (uint8_t c : name.to__actual()) @@ -699,17 +691,6 @@ CharPair *make_new_char(Session *s, CharName name, const Stats6& stats, uint8_t return nullptr; } } - else if (char_name_option == 2) - { - // letters/symbols in char_name_letters are forbidden - for (uint8_t c : name.to__actual()) - if (char_name_letters[c]) - { - CHAR_LOG("Make new char error (invalid letter in the name): (connection #%d, account: %d), name: %s, invalid letter: %c.\n"_fmt, - s, sd->account_id, name, c); - return nullptr; - } - } // else, all letters/symbols are authorised (except control char removed before) // TODO this comment is obsolete // this is why it needs to be unsigned @@ -764,10 +745,10 @@ CharPair *make_new_char(Session *s, CharName name, const Stats6& stats, uint8_t } } - if (wisp_server_name == name) + if (WISP_SERVER_NAME == name) { CHAR_LOG("Make new char error (name used is wisp name for server): (connection #%d, account: %d) slot %d, name: %s (actual name whisper server: %s), stats: %d+%d+%d+%d+%d+%d=%d, hair: %d, hair color: %d.\n"_fmt, - s, sd->account_id, slot, name, wisp_server_name, + s, sd->account_id, slot, name, WISP_SERVER_NAME, stats.str, stats.agi, stats.vit, stats.int_, stats.dex, stats.luk, stats.str + stats.agi + stats.vit + stats.int_ + stats.dex + stats.luk, hair_style, hair_color); @@ -1705,7 +1686,6 @@ void parse_frommap(Session *ms) Packet_Fixed<0x2afb> fixed_fb; fixed_fb.unknown = 0; - fixed_fb.whisper_name = wisp_server_name; send_fpacket<0x2afb, 27>(ms, fixed_fb); { @@ -1781,7 +1761,7 @@ void parse_frommap(Session *ms) afi.login_id1 == login_id1 && // here, it's the only area where it's possible that we doesn't know login_id2 (map-server asks just after 0x72 packet, that doesn't given the value) (afi.login_id2 == login_id2 || login_id2 == 0) && // relate to the versions higher than 18 - (!check_ip_flag || afi.ip == ip) + afi.ip == ip && !afi.delflag) { CharPair *cp = nullptr; @@ -2422,8 +2402,7 @@ void parse_char(Session *s) if (afi.account_id == sd->account_id && afi.login_id1 == sd->login_id1 && afi.login_id2 == sd->login_id2 - && (!check_ip_flag - || afi.ip == s->client_ip) + && afi.ip == s->client_ip && afi.delflag == 2) { afi.delflag = 1; @@ -2837,11 +2816,6 @@ bool char_config(XString w1, ZString w2) server_name = stringish(w2); PRINTF("%s server has been intialized\n"_fmt, w2); } - else if (w1 == "wisp_server_name"_s) - { - if (w2.size() >= 4) - wisp_server_name = stringish(w2); - } else if (w1 == "login_ip"_s) { h = gethostbyname(w2.c_str()); @@ -2900,10 +2874,6 @@ bool char_config(XString w1, ZString w2) if (max_connect_user < 0) max_connect_user = 0; // unlimited online players } - else if (w1 == "check_ip_flag"_s) - { - check_ip_flag = config_switch(w2); - } else if (w1 == "autosave_time"_s) { autosave_time = std::chrono::seconds(atoi(w2.c_str())); @@ -2922,10 +2892,6 @@ bool char_config(XString w1, ZString w2) { char_log_filename = w2; } - else if (w1 == "char_name_option"_s) - { - char_name_option = atoi(w2.c_str()); - } else if (w1 == "char_name_letters"_s) { if (!w2) @@ -2942,10 +2908,6 @@ bool char_config(XString w1, ZString w2) { online_html_filename = w2; } - else if (w1 == "online_sorting_option"_s) - { - online_sorting_option = atoi(w2.c_str()); - } else if (w1 == "online_gm_display_min_level"_s) { // minimum GM level to display 'GM' when we want to display it diff --git a/src/login/login.cpp b/src/login/login.cpp index 526eb5d..d58de14 100644 --- a/src/login/login.cpp +++ b/src/login/login.cpp @@ -130,10 +130,6 @@ AString gm_account_filename = "save/gm_account.txt"_s; static AString login_log_filename = "log/login.log"_s; static -AString login_log_unknown_packets_filename = "log/login_unknown_packets.log"_s; -static -int save_unknown_packets = 0; -static tick_t creation_time_GM_account_file; static std::chrono::seconds gm_account_filename_check_timer = 15_s; @@ -159,13 +155,6 @@ std::chrono::seconds anti_freeze_interval = 15_s; static Session *login_session; -enum class ACO -{ - DENY_ALLOW, - ALLOW_DENY, - MUTUAL_FAILURE, -}; - static ACO access_order = ACO::DENY_ALLOW; static @@ -174,10 +163,6 @@ access_allow, access_deny, access_ladmin; static GmLevel min_level_to_connect = GmLevel::from(0_u32); // minimum level of player/GM (0: player, 1-99: gm) to connect on the server -static -int add_to_unlimited_account = 0; // Give possibility or not to adjust (ladmin command: timeadd) the time of an unlimited account. -static -int check_ip_flag = 1; // It's to check IP of a player between login-server and char-server (part of anti-hacking system) DIAG_PUSH(); DIAG_I(missing_noreturn); @@ -643,7 +628,7 @@ void mmo_auth_sync(void) FPRINTF(fp, "// Accounts file: here are saved all information about the accounts.\n"_fmt); FPRINTF(fp, - "// Structure: ID, account name, password, last login time, sex, # of logins, state, email, error message for state 7, validity time, last (accepted) login ip, memo field, ban timestamp, repeated(register text, register value)\n"_fmt); + "// Structure: ID, account name, password, last login time, sex, # of logins, state, email, error message for state 7, validity time (unused), last (accepted) login ip, memo field, ban timestamp, repeated(register text, register value)\n"_fmt); FPRINTF(fp, "// Some explanations:\n"_fmt); FPRINTF(fp, "// account name : between 4 to 23 char for a normal account (standard client can't send less than 4 char).\n"_fmt); @@ -992,8 +977,7 @@ void parse_fromchar(Session *s) auth_fifo[i].login_id1 == fixed.login_id1 && auth_fifo[i].login_id2 == fixed.login_id2 && // relate to the versions higher than 18 auth_fifo[i].sex == fixed.sex && - (!check_ip_flag - || auth_fifo[i].ip == fixed.ip) + auth_fifo[i].ip == fixed.ip && !auth_fifo[i].delflag) { auth_fifo[i].delflag = 1; @@ -1566,19 +1550,17 @@ void parse_fromchar(Session *s) default: { - io::AppendFile logfp(login_log_unknown_packets_filename); - if (logfp.is_open()) { timestamp_milliseconds_buffer timestr; stamp_time(timestr); - FPRINTF(logfp, + FPRINTF(stderr, "%s: receiving of an unknown packet -> disconnection\n"_fmt, timestr); - FPRINTF(logfp, + FPRINTF(stderr, "parse_fromchar: connection #%d (ip: %s), packet: 0x%x (with being read: %zu).\n"_fmt, s, ip, packet_id, packet_avail(s)); - FPRINTF(logfp, "Detail (in hex):\n"_fmt); - packet_dump(logfp, s); + FPRINTF(stderr, "Detail (in hex):\n"_fmt); + packet_dump(s); } PRINTF("parse_fromchar: Unknown packet 0x%x (from a char-server)! -> disconnection.\n"_fmt, packet_id); @@ -2379,7 +2361,7 @@ void parse_admin(Session *s) timestamp_seconds_buffer tmpstr = stringish("no banishment"_s); if (timestamp) stamp_time(tmpstr, ×tamp); - LOGIN_LOG("'ladmin': Adjustment of a final date of a banishment (account: %s, (%+d y %+d m %+d d %+d h %+d mn %+d s) -> new validity: %lld (%s), ip: %s)\n"_fmt, + LOGIN_LOG("'ladmin': Adjustment of a final date of a banishment (account: %s, (%+d y %+d m %+d d %+d h %+d mn %+d s) -> new ban: %lld (%s), ip: %s)\n"_fmt, ad->userid, ban_diff.year, ban_diff.month, ban_diff.day, ban_diff.hour, @@ -2588,19 +2570,17 @@ void parse_admin(Session *s) default: { - io::AppendFile logfp(login_log_unknown_packets_filename); - if (logfp.is_open()) { timestamp_milliseconds_buffer timestr; stamp_time(timestr); - FPRINTF(logfp, + FPRINTF(stderr, "%s: receiving of an unknown packet -> disconnection\n"_fmt, timestr); - FPRINTF(logfp, + FPRINTF(stderr, "parse_admin: connection #%d (ip: %s), packet: 0x%x (with being read: %zu).\n"_fmt, s, ip, packet_id, packet_avail(s)); - FPRINTF(logfp, "Detail (in hex):\n"_fmt); - packet_dump(logfp, s); + FPRINTF(stderr, "Detail (in hex):\n"_fmt); + packet_dump(s); } LOGIN_LOG("'ladmin': End of connection, unknown packet (ip: %s)\n"_fmt, ip); @@ -3003,22 +2983,19 @@ void parse_login(Session *s) default: { - if (save_unknown_packets) { - io::AppendFile logfp(login_log_unknown_packets_filename); - if (logfp.is_open()) { timestamp_milliseconds_buffer timestr; stamp_time(timestr); - FPRINTF(logfp, + FPRINTF(stderr, "%s: receiving of an unknown packet -> disconnection\n"_fmt, timestr); - FPRINTF(logfp, + FPRINTF(stderr, "parse_login: connection #%d (ip: %s), packet: 0x%x (with being read: %zu).\n"_fmt, s, ip, packet_id, packet_avail(s)); - FPRINTF(logfp, "Detail (in hex):\n"_fmt); - packet_dump(logfp, s); + FPRINTF(stderr, "Detail (in hex):\n"_fmt); + packet_dump(s); } } LOGIN_LOG("End of connection, unknown packet (ip: %s)\n"_fmt, ip); @@ -3180,14 +3157,6 @@ bool login_config(XString w1, ZString w2) { login_log_filename = w2; } - else if (w1 == "login_log_unknown_packets_filename"_s) - { - login_log_unknown_packets_filename = w2; - } - else if (w1 == "save_unknown_packets"_s) - { - save_unknown_packets = config_switch(w2); - } else if (w1 == "display_parse_login"_s) { display_parse_login = config_switch(w2); // 0: no, 1: yes @@ -3204,14 +3173,6 @@ bool login_config(XString w1, ZString w2) { min_level_to_connect = GmLevel::from(static_cast(atoi(w2.c_str()))); } - else if (w1 == "add_to_unlimited_account"_s) - { - add_to_unlimited_account = config_switch(w2); - } - else if (w1 == "check_ip_flag"_s) - { - check_ip_flag = config_switch(w2); - } else if (w1 == "order"_s) { if (w2 == "deny,allow"_s || w2 == "deny, allow"_s) @@ -3390,13 +3351,6 @@ bool display_conf_warnings(void) rv = false; } - if (save_unknown_packets != 0 && save_unknown_packets != 1) - { - PRINTF("WARNING: Invalid value for save_unknown_packets parameter -> set to 0-no save.\n"_fmt); - save_unknown_packets = 0; - rv = false; - } - if (display_parse_login != 0 && display_parse_login != 1) { // 0: no, 1: yes PRINTF("***WARNING: Invalid value for display_parse_login parameter\n"_fmt); @@ -3421,22 +3375,6 @@ bool display_conf_warnings(void) rv = false; } - if (add_to_unlimited_account != 0 && add_to_unlimited_account != 1) - { // 0: no, 1: yes - PRINTF("***WARNING: Invalid value for add_to_unlimited_account parameter\n"_fmt); - PRINTF(" -> set to 0 (impossible to add a time to an unlimited account).\n"_fmt); - add_to_unlimited_account = 0; - rv = false; - } - - if (check_ip_flag != 0 && check_ip_flag != 1) - { // 0: no, 1: yes - PRINTF("***WARNING: Invalid value for check_ip_flag parameter\n"_fmt); - PRINTF(" -> set to 1 (check players ip between login-server & char-server).\n"_fmt); - check_ip_flag = 1; - rv = false; - } - if (access_order == ACO::DENY_ALLOW) { if (access_deny.size() == 1 && access_deny.front().mask() == IP4Address()) @@ -3540,12 +3478,6 @@ void save_config_in_log(void) // not necessary to log the 'login_log_filename', we are inside :) - LOGIN_LOG("- with the unknown packets file name: '%s'.\n"_fmt, - login_log_unknown_packets_filename); - if (save_unknown_packets) - LOGIN_LOG("- to SAVE all unkown packets.\n"_fmt); - else - LOGIN_LOG("- to SAVE only unkown packets sending by a char-server or a remote administration.\n"_fmt); if (display_parse_login) LOGIN_LOG("- to display normal parse packets on console.\n"_fmt); else @@ -3565,20 +3497,6 @@ void save_config_in_log(void) LOGIN_LOG("- to accept only GM with level %d or more.\n"_fmt, min_level_to_connect); - if (add_to_unlimited_account) - LOGIN_LOG("- to authorize adjustment (with timeadd ladmin) on an unlimited account.\n"_fmt); - else - LOGIN_LOG("- to refuse adjustment (with timeadd ladmin) on an unlimited account. You must use timeset (ladmin command) before.\n"_fmt); - - { - LOGIN_LOG("- to create new accounts with an unlimited time.\n"_fmt); - } - - if (check_ip_flag) - LOGIN_LOG("- with control of players IP between login-server and char-server.\n"_fmt); - else - LOGIN_LOG("- to not check players IP between login-server and char-server.\n"_fmt); - if (access_order == ACO::DENY_ALLOW) { if (access_deny.empty()) diff --git a/src/login/login.hpp b/src/login/login.hpp index 88dd4ec..5900440 100644 --- a/src/login/login.hpp +++ b/src/login/login.hpp @@ -18,6 +18,8 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . +#include "login.t.hpp" + #include "fwd.hpp" diff --git a/src/login/login.t.hpp b/src/login/login.t.hpp new file mode 100644 index 0000000..8e78618 --- /dev/null +++ b/src/login/login.t.hpp @@ -0,0 +1,35 @@ +#pragma once +// login.t.hpp - Types for the login server +// +// Copyright © ????-2004 Athena Dev Teams +// Copyright © 2004-2011 The Mana World Development Team +// Copyright © 2011-2014 Ben Longbons +// Copyright © 2014 MadCamel +// +// This file is part of The Mana World (Athena server) +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +#include "fwd.hpp" + + +namespace tmwa +{ +enum class ACO +{ + DENY_ALLOW, + ALLOW_DENY, + MUTUAL_FAILURE, +}; +} // namespace tmwa diff --git a/src/map/battle.cpp b/src/map/battle.cpp index 96945a4..a04e402 100644 --- a/src/map/battle.cpp +++ b/src/map/battle.cpp @@ -2212,7 +2212,6 @@ Battle_Config init_battle_config() battle_config.skill_min_damage = 0; battle_config.natural_healhp_interval = 6000; battle_config.natural_healsp_interval = 8000; - battle_config.natural_heal_skill_interval = 10000; battle_config.natural_heal_weight_rate = 50; battle_config.itemheal_regeneration_factor = 1; battle_config.arrow_decrement = 1; @@ -2240,8 +2239,6 @@ Battle_Config init_battle_config() battle_config.player_attack_direction_change = 1; battle_config.monster_attack_direction_change = 1; battle_config.display_delay_skill_fail = 1; - battle_config.dead_branch_active = 0; - battle_config.show_steal_in_same_party = 0; battle_config.hide_GM_session = 0; battle_config.invite_request_check = 1; battle_config.disp_experience = 0; @@ -2338,7 +2335,6 @@ bool battle_config_read(ZString cfgName) BATTLE_CONFIG_VAR(skill_min_damage), BATTLE_CONFIG_VAR(natural_healhp_interval), BATTLE_CONFIG_VAR(natural_healsp_interval), - BATTLE_CONFIG_VAR(natural_heal_skill_interval), BATTLE_CONFIG_VAR(natural_heal_weight_rate), BATTLE_CONFIG_VAR(itemheal_regeneration_factor), BATTLE_CONFIG_VAR(arrow_decrement), @@ -2366,8 +2362,6 @@ bool battle_config_read(ZString cfgName) BATTLE_CONFIG_VAR(player_attack_direction_change), BATTLE_CONFIG_VAR(monster_attack_direction_change), BATTLE_CONFIG_VAR(display_delay_skill_fail), - BATTLE_CONFIG_VAR(dead_branch_active), - BATTLE_CONFIG_VAR(show_steal_in_same_party), BATTLE_CONFIG_VAR(hide_GM_session), BATTLE_CONFIG_VAR(invite_request_check), BATTLE_CONFIG_VAR(disp_experience), @@ -2452,8 +2446,6 @@ void battle_config_check() battle_config.natural_healhp_interval = NATURAL_HEAL_INTERVAL.count(); if (battle_config.natural_healsp_interval < NATURAL_HEAL_INTERVAL.count()) battle_config.natural_healsp_interval = NATURAL_HEAL_INTERVAL.count(); - if (battle_config.natural_heal_skill_interval < NATURAL_HEAL_INTERVAL.count()) - battle_config.natural_heal_skill_interval = NATURAL_HEAL_INTERVAL.count(); if (battle_config.natural_heal_weight_rate < 50) battle_config.natural_heal_weight_rate = 50; if (battle_config.natural_heal_weight_rate > 101) diff --git a/src/map/battle.hpp b/src/map/battle.hpp index 7733391..53782fa 100644 --- a/src/map/battle.hpp +++ b/src/map/battle.hpp @@ -141,7 +141,6 @@ extern struct Battle_Config int skill_min_damage; int natural_healhp_interval; int natural_healsp_interval; - int natural_heal_skill_interval; int natural_heal_weight_rate; int arrow_decrement; int max_aspd; @@ -166,8 +165,6 @@ extern struct Battle_Config int player_attack_direction_change; int monster_attack_direction_change; int display_delay_skill_fail; - int dead_branch_active; - int show_steal_in_same_party; int prevent_logout; diff --git a/src/map/chrif.cpp b/src/map/chrif.cpp index 9a36a60..7d64098 100644 --- a/src/map/chrif.cpp +++ b/src/map/chrif.cpp @@ -320,8 +320,6 @@ int chrif_sendmapack(Session *, Packet_Fixed<0x2afb> fixed) exit(1); } - wisp_server_name = fixed.whisper_name; - chrif_state = 2; return 0; diff --git a/src/map/clif.cpp b/src/map/clif.cpp index 5329eff..1c6f403 100644 --- a/src/map/clif.cpp +++ b/src/map/clif.cpp @@ -3936,7 +3936,7 @@ RecvResult clif_parse_Wis(Session *s, dumb_ptr sd) if (dstsd->sess == s) { ZString mes = "You cannot page yourself."_s; - clif_wis_message(s, wisp_server_name, mes); + clif_wis_message(s, WISP_SERVER_NAME, mes); } else { @@ -5529,7 +5529,6 @@ unknown_packet: PRINTF("\nclif_parse: session #%d, packet 0x%x, lenght %zu\n"_fmt, s, packet_id, packet_avail(s)); { - ZString packet_txt = "save/packet.txt"_s; if (sd && sd->state.auth) { PRINTF("Unknown packet: Account ID %d, character ID %d, player name %s.\n"_fmt, @@ -5541,35 +5540,27 @@ unknown_packet: else PRINTF("Unknown packet (unknown)\n"_fmt); - io::AppendFile fp(packet_txt); - if (!fp.is_open()) - { - PRINTF("clif.c: cant write [%s] !!! data is lost !!!\n"_fmt, - packet_txt); - return; - } - else { timestamp_seconds_buffer now; stamp_time(now); if (sd && sd->state.auth) { - FPRINTF(fp, + FPRINTF(stderr, "%s\nPlayer with account ID %d (character ID %d, player name %s) sent wrong packet:\n"_fmt, now, sd->status_key.account_id, sd->status_key.char_id, sd->status_key.name); } else if (sd) // not authentified! (refused by char-server or disconnect before to be authentified) - FPRINTF(fp, + FPRINTF(stderr, "%s\nUnauthenticated player with account ID %d sent wrong packet:\n"_fmt, now, sd->bl_id); else - FPRINTF(fp, + FPRINTF(stderr, "%s\nUnknown connection sent wrong packet:\n"_fmt, now); - packet_dump(fp, s); + packet_dump(s); } } } diff --git a/src/map/map.cpp b/src/map/map.cpp index e2c38a7..e5705aa 100644 --- a/src/map/map.cpp +++ b/src/map/map.cpp @@ -112,7 +112,7 @@ int save_settings = 0xFFFF; AString motd_txt = "conf/motd.txt"_s; -CharName wisp_server_name = stringish("Server"_s); // can be modified in char-server configuration file +const CharName WISP_SERVER_NAME = stringish("Server"_s); map_local undefined_gat = [](){ map_local rv {}; rv.name_ = stringish("undefined.gat"_s); return rv; }(); diff --git a/src/map/map.hpp b/src/map/map.hpp index fc48126..ac16fe9 100644 --- a/src/map/map.hpp +++ b/src/map/map.hpp @@ -535,7 +535,7 @@ extern int save_settings; extern AString motd_txt; -extern CharName wisp_server_name; +extern const CharName WISP_SERVER_NAME; // 鯖全体情報 void map_setusers(int); diff --git a/src/map/tmw.cpp b/src/map/tmw.cpp index 04906b6..4f29fab 100644 --- a/src/map/tmw.cpp +++ b/src/map/tmw.cpp @@ -161,7 +161,7 @@ bool tmw_CheckChatLameness(dumb_ptr, XString message) // Sends a whisper to all GMs void tmw_GmHackMsg(ZString line) { - intif_wis_message_to_gm(wisp_server_name, + intif_wis_message_to_gm(WISP_SERVER_NAME, GmLevel::from(static_cast(battle_config.hack_info_GM_level)), line); } diff --git a/src/wire/packets.cpp b/src/wire/packets.cpp index 3cba856..be06283 100644 --- a/src/wire/packets.cpp +++ b/src/wire/packets.cpp @@ -65,29 +65,29 @@ bool packet_send(Session *s, const Byte *data, size_t sz) return true; } -void packet_dump(io::WriteFile& logfp, Session *s) +void packet_dump(Session *s) { - FPRINTF(logfp, + FPRINTF(stderr, "---- 00-01-02-03-04-05-06-07 08-09-0A-0B-0C-0D-0E-0F\n"_fmt); char tmpstr[16 + 1] {}; int i; for (i = 0; i < packet_avail(s); i++) { if ((i & 15) == 0) - FPRINTF(logfp, "%04X "_fmt, i); + FPRINTF(stderr, "%04X "_fmt, i); Byte rfifob_ib; packet_fetch(s, i, &rfifob_ib, 1); uint8_t rfifob_i = rfifob_ib.value; - FPRINTF(logfp, "%02x "_fmt, rfifob_i); + FPRINTF(stderr, "%02x "_fmt, rfifob_i); if (rfifob_i > 0x1f) tmpstr[i % 16] = rfifob_i; else tmpstr[i % 16] = '.'; if ((i - 7) % 16 == 0) // -8 + 1 - FPRINTF(logfp, " "_fmt); + FPRINTF(stderr, " "_fmt); else if ((i + 1) % 16 == 0) { - FPRINTF(logfp, " %s\n"_fmt, tmpstr); + FPRINTF(stderr, " %s\n"_fmt, tmpstr); std::fill(tmpstr + 0, tmpstr + 17, '\0'); } } @@ -95,12 +95,12 @@ void packet_dump(io::WriteFile& logfp, Session *s) { for (int j = i; j % 16 != 0; j++) { - FPRINTF(logfp, " "_fmt); + FPRINTF(stderr, " "_fmt); if ((j - 7) % 16 == 0) // -8 + 1 - FPRINTF(logfp, " "_fmt); + FPRINTF(stderr, " "_fmt); } - FPRINTF(logfp, " %s\n"_fmt, tmpstr); + FPRINTF(stderr, " %s\n"_fmt, tmpstr); } - FPRINTF(logfp, "\n"_fmt); + FPRINTF(stderr, "\n"_fmt); } } // namespace tmwa diff --git a/src/wire/packets.hpp b/src/wire/packets.hpp index a233344..82cc919 100644 --- a/src/wire/packets.hpp +++ b/src/wire/packets.hpp @@ -53,7 +53,7 @@ enum class SendResult size_t packet_avail(Session *s); -void packet_dump(io::WriteFile& out, Session *s); +void packet_dump(Session *s); bool packet_fetch(Session *s, size_t offset, Byte *data, size_t sz); void packet_discard(Session *s, size_t sz); -- cgit v1.2.3-60-g2f50