diff options
-rw-r--r-- | src/char/char.cpp | 11 | ||||
-rw-r--r-- | src/mmo/extract.cpp | 20 |
2 files changed, 28 insertions, 3 deletions
diff --git a/src/char/char.cpp b/src/char/char.cpp index 8d3bccb..80ad697 100644 --- a/src/char/char.cpp +++ b/src/char/char.cpp @@ -452,6 +452,7 @@ bool extract(XString str, CharPair *cp) XString unused_cart; std::vector<struct skill_loader> skills; std::vector<GlobalReg> vars; + XString hair_style; if (!extract(str, record<'\t'>( &k->char_id, @@ -464,7 +465,7 @@ bool extract(XString str, CharPair *cp) record<','>(&p->status_point, &p->skill_point), record<','>(&p->option, &p->karma, &p->manner), record<','>(&p->party_id, &unused_guild_id, &unused_pet_id), - record<','>(&p->hair, &p->hair_color, &p->clothes_color), + record<','>(&hair_style, &p->hair_color, &p->clothes_color), record<','>(&p->weapon, &p->shield, &p->head_top, &p->head_mid, &p->head_bottom), &p->last_point, // somebody was silly and stuck partner id as a field @@ -478,6 +479,14 @@ bool extract(XString str, CharPair *cp) vrec<' '>(&vars)))) return false; + // leftover corruption from Platinum + if (hair_style == "-1"_s) + { + p->hair = 0; + } + else if (!extract(hair_style, &p->hair)) + return false; + if (wisp_server_name == k->name) return false; diff --git a/src/mmo/extract.cpp b/src/mmo/extract.cpp index 2f8b644..7a00c71 100644 --- a/src/mmo/extract.cpp +++ b/src/mmo/extract.cpp @@ -45,6 +45,13 @@ bool extract(XString str, AString *rv) bool extract(XString str, GlobalReg *var) { + // vars used to be stored signed + int compat_value; + if (extract(str, record<','>(&var->str, &compat_value))) + { + var->value = compat_value; + return true; + } return extract(str, record<','>(&var->str, &var->value)); } @@ -52,11 +59,12 @@ bool extract(XString str, GlobalReg *var) bool extract(XString str, Item *it) { XString ignored; - return extract(str, + XString corruption_hack_amount; + bool rv = extract(str, record<',', 11>( &ignored, &it->nameid, - &it->amount, + &corruption_hack_amount, &it->equip, &ignored, &ignored, @@ -66,6 +74,14 @@ bool extract(XString str, Item *it) &ignored, &ignored, &ignored)); + if (rv) + { + if (corruption_hack_amount == "-1"_s) + it->amount = 0; + else + rv = extract(corruption_hack_amount, &it->amount); + } + return rv; } bool extract(XString str, MapName *m) |