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 ++++++-------------------------------------------- 1 file changed, 6 insertions(+), 44 deletions(-) (limited to 'src/char/char.cpp') 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 -- cgit v1.2.3-60-g2f50