From 730e5dde39333cb2f63c72a7d7152bee5c4dbb05 Mon Sep 17 00:00:00 2001 From: Ben Longbons Date: Sat, 8 Feb 2014 15:09:25 -0800 Subject: Implement AString --- src/char/char.cpp | 20 ++++++++++---------- src/char/int_party.cpp | 14 +++++++------- src/char/int_party.hpp | 2 +- src/char/int_storage.cpp | 14 +++++++------- src/char/int_storage.hpp | 2 +- src/char/inter.cpp | 16 ++++++++-------- 6 files changed, 34 insertions(+), 34 deletions(-) (limited to 'src/char') diff --git a/src/char/char.cpp b/src/char/char.cpp index 15ea46b..55dca81 100644 --- a/src/char/char.cpp +++ b/src/char/char.cpp @@ -16,7 +16,7 @@ #include #include "../strings/mstring.hpp" -#include "../strings/fstring.hpp" +#include "../strings/astring.hpp" #include "../strings/zstring.hpp" #include "../strings/xstring.hpp" @@ -74,11 +74,11 @@ IP4Address char_ip; static int char_port = 6121; static -FString char_txt; +AString char_txt; static CharName unknown_char_name = stringish("Unknown"); static -FString char_log_filename = "log/char.log"; +AString char_log_filename = "log/char.log"; //Added for lan support static IP4Address lan_map_ip = IP4_LOCALHOST; @@ -140,9 +140,9 @@ std::vector gm_accounts; // online players by [Yor] static -FString online_txt_filename = "online.txt"; +AString online_txt_filename = "online.txt"; static -FString online_html_filename = "online.html"; +AString online_html_filename = "online.html"; static int online_sorting_option = 0; // sorting option to display online players in online files static @@ -232,7 +232,7 @@ Session *& server_for_m(const mmo_charstatus *mcs) // Function to create the character line (for save) //------------------------------------------------- static -FString mmo_char_tostr(struct mmo_charstatus *p) +AString mmo_char_tostr(struct mmo_charstatus *p) { // on multi-map server, sometimes it's posssible that last_point become void. (reason???) We check that to not lost character at restart. if (!p->last_point.map_) @@ -333,7 +333,7 @@ FString mmo_char_tostr(struct mmo_charstatus *p) p->global_reg[i].value); str_p += '\t'; - return FString(str_p); + return AString(str_p); } static @@ -470,7 +470,7 @@ int mmo_char_init(void) } int line_count = 0; - FString line; + AString line; while (in.getline(line)) { line_count++; @@ -528,7 +528,7 @@ void mmo_char_sync(void) // yes, we need a mutable reference to do the saves ... for (mmo_charstatus& cd : char_data) { - FString line = mmo_char_tostr(&cd); + AString line = mmo_char_tostr(&cd); fp.put_line(line); } FPRINTF(fp, "%d\t%%newid%%\n", char_id_count); @@ -1282,7 +1282,7 @@ void parse_tologin(Session *ls) else { size_t len = RFIFOL(ls, 4); - FString message = RFIFO_STRING(ls, 8, len).to_print().lstrip(); + AString message = RFIFO_STRING(ls, 8, len).to_print().lstrip(); // if message is only composed of spaces if (!message) CHAR_LOG("Receiving a message for broadcast, but message is only a lot of spaces.\n"); diff --git a/src/char/int_party.cpp b/src/char/int_party.cpp index 79f24cb..cf9b3e5 100644 --- a/src/char/int_party.cpp +++ b/src/char/int_party.cpp @@ -4,7 +4,7 @@ #include #include "../strings/mstring.hpp" -#include "../strings/fstring.hpp" +#include "../strings/astring.hpp" #include "../strings/xstring.hpp" #include "../io/cxxstdio.hpp" @@ -21,7 +21,7 @@ #include "../poison.hpp" -FString party_txt = "save/party.txt"; +AString party_txt = "save/party.txt"; static Map party_db; @@ -37,7 +37,7 @@ void mapif_parse_PartyLeave(Session *s, int party_id, int account_id); // パーティデータの文字列への変換 static -FString inter_party_tostr(struct party *p) +AString inter_party_tostr(struct party *p) { MString str; str += STRPRINTF( @@ -59,7 +59,7 @@ FString inter_party_tostr(struct party *p) m->name); } - return FString(str); + return AString(str); } static @@ -130,7 +130,7 @@ void inter_party_init(void) return; // TODO: convert to use char_id, and change to extract() - FString line; + AString line; int c = 0; while (in.getline(line)) { @@ -164,7 +164,7 @@ void inter_party_init(void) static void inter_party_save_sub(struct party *data, io::WriteFile& fp) { - FString line = inter_party_tostr(data); + AString line = inter_party_tostr(data); fp.put_line(line); } @@ -701,7 +701,7 @@ int inter_party_parse_frommap(Session *ms) size_t len = RFIFOW(ms, 2) - 12; int party_id = RFIFOL(ms, 4); int account_id = RFIFOL(ms, 8); - FString mes = RFIFO_STRING(ms, 12, len); + AString mes = RFIFO_STRING(ms, 12, len); mapif_parse_PartyMessage(ms, party_id, account_id, diff --git a/src/char/int_party.hpp b/src/char/int_party.hpp index a5b6e8b..e4dedd1 100644 --- a/src/char/int_party.hpp +++ b/src/char/int_party.hpp @@ -12,6 +12,6 @@ int inter_party_parse_frommap(Session *ms); void inter_party_leave(int party_id, int account_id); -extern FString party_txt; +extern AString party_txt; #endif // INT_PARTY_HPP diff --git a/src/char/int_storage.cpp b/src/char/int_storage.cpp index c21da81..cdc6e05 100644 --- a/src/char/int_storage.cpp +++ b/src/char/int_storage.cpp @@ -6,7 +6,7 @@ #include #include "../strings/mstring.hpp" -#include "../strings/fstring.hpp" +#include "../strings/astring.hpp" #include "../strings/xstring.hpp" #include "../io/cxxstdio.hpp" @@ -22,14 +22,14 @@ // ファイル名のデフォルト // inter_config_read()で再設定される -FString storage_txt = "save/storage.txt"; +AString storage_txt = "save/storage.txt"; static Map storage_db; // 倉庫データを文字列に変換 static -FString storage_tostr(struct storage *p) +AString storage_tostr(struct storage *p) { MString str; str += STRPRINTF( @@ -59,8 +59,8 @@ FString storage_tostr(struct storage *p) str += '\t'; if (!f) - return FString(); - return FString(str); + return AString(); + return AString(str); } // 文字列を倉庫データに変換 @@ -111,7 +111,7 @@ void inter_storage_init(void) return; } - FString line; + AString line; while (in.getline(line)) { struct storage s {}; @@ -131,7 +131,7 @@ void inter_storage_init(void) static void inter_storage_save_sub(struct storage *data, io::WriteFile& fp) { - FString line = storage_tostr(data); + AString line = storage_tostr(data); if (line) fp.put_line(line); } diff --git a/src/char/int_storage.hpp b/src/char/int_storage.hpp index 0790b6e..7081f30 100644 --- a/src/char/int_storage.hpp +++ b/src/char/int_storage.hpp @@ -12,6 +12,6 @@ struct storage *account2storage(int account_id); int inter_storage_parse_frommap(Session *ms); -extern FString storage_txt; +extern AString storage_txt; #endif // INT_STORAGE_HPP diff --git a/src/char/inter.cpp b/src/char/inter.cpp index 19ba254..192ffd5 100644 --- a/src/char/inter.cpp +++ b/src/char/inter.cpp @@ -7,7 +7,7 @@ #include #include "../strings/mstring.hpp" -#include "../strings/fstring.hpp" +#include "../strings/astring.hpp" #include "../strings/zstring.hpp" #include "../strings/xstring.hpp" @@ -29,7 +29,7 @@ #include "../poison.hpp" static -FString accreg_txt = "save/accreg.txt"; +AString accreg_txt = "save/accreg.txt"; struct accreg { @@ -60,13 +60,13 @@ int inter_recv_packet_length[] = // アカウント変数を文字列へ変換 static -FString inter_accreg_tostr(struct accreg *reg) +AString inter_accreg_tostr(struct accreg *reg) { MString str; str += STRPRINTF("%d\t", reg->account_id); for (int j = 0; j < reg->reg_num; j++) str += STRPRINTF("%s,%d ", reg->reg[j].str, reg->reg[j].value); - return FString(str); + return AString(str); } // アカウント変数を文字列から変換 @@ -98,7 +98,7 @@ void inter_accreg_init(void) io::ReadFile in(accreg_txt); if (!in.is_open()) return; - FString line; + AString line; while (in.getline(line)) { struct accreg reg {}; @@ -121,7 +121,7 @@ void inter_accreg_save_sub(struct accreg *reg, io::WriteFile& fp) { if (reg->reg_num > 0) { - FString line = inter_accreg_tostr(reg); + AString line = inter_accreg_tostr(reg); fp.put_line(line); } } @@ -282,7 +282,7 @@ void mapif_parse_GMmessage(Session *s) { size_t msg_len = RFIFOW(s, 2); size_t str_len = msg_len - 4; - FString buf = RFIFO_STRING(s, 4, str_len); + AString buf = RFIFO_STRING(s, 4, str_len); mapif_GMmessage(buf); } @@ -328,7 +328,7 @@ void mapif_parse_WisRequest(Session *sms) { size_t len = RFIFOW(sms, 2) - 52; Session *tms = server_for(mcs); // for to - FString msg = RFIFO_STRING(sms, 52, len); + AString msg = RFIFO_STRING(sms, 52, len); if (tms) { mapif_wis_message(tms, from, to, msg); -- cgit v1.2.3-60-g2f50