diff options
author | gumi <git@gumi.ca> | 2018-06-19 19:56:15 -0400 |
---|---|---|
committer | gumi <git@gumi.ca> | 2018-06-19 19:56:15 -0400 |
commit | 0475a22f9c38a7036657d20da44739dee969f7ea (patch) | |
tree | d552e1867e3db963b0b6b4e73a7c7a961321f83a /src/char/char.cpp | |
parent | 2d48c0e1a844ec28ff8f1ee84fed7852075419dd (diff) | |
download | tmwa-18.6.19.tar.gz tmwa-18.6.19.tar.bz2 tmwa-18.6.19.tar.xz tmwa-18.6.19.zip |
automatically fix corrupt parties on bootv18.6.19
Diffstat (limited to 'src/char/char.cpp')
-rw-r--r-- | src/char/char.cpp | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/src/char/char.cpp b/src/char/char.cpp index 22e8162..107b52f 100644 --- a/src/char/char.cpp +++ b/src/char/char.cpp @@ -47,6 +47,7 @@ #include "../strings/xstring.hpp" #include "../generic/array.hpp" +#include "../generic/db.hpp" #include "../io/cxxstdio.hpp" #include "../io/extract.hpp" @@ -2696,6 +2697,33 @@ void term_func(void) CHAR_LOG("----End of char-server (normal end with closing of all files).\n"_fmt); } +static +void party_corruption_fix() +{ + using namespace tmwa::char_; + + for (auto& pair : party_db) + { + PartyPair pp{pair.first, borrow(pair.second)}; + + for (int i = 0; i < MAX_PARTY; i++) + { + if (!pp.party_most->member[i].account_id) + break; + + for (const CharPair& cp : char_keys) + { + if (cp.key.account_id == pp.party_most->member[i].account_id && + cp.data->party_id != pp.party_id) + { + CHAR_LOG("Fixing corrupt party on character %s...\n"_fmt, cp.key.name); + cp.data->party_id = pp.party_id; + } + } + } + } +} + int do_init(Slice<ZString> argv) { using namespace tmwa::char_; @@ -2742,6 +2770,7 @@ int do_init(Slice<ZString> argv) mmo_char_init(); inter_init2(); + party_corruption_fix(); update_online = TimeT::now(); create_online_files(); // update online players files at start of the server |