fix: read character flags the way they are written again

Flags are only ever written by the server as numbers, so a malformed
flag can't come from our own saves. Skipping one on load would drop it
from the character on the next save, which is worse than the load
failing. Restores the original parsing; the null checks for a missing
obj tag and the refusal to save a character whose xml never loaded stay.

Refs #1332

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Aaron Kimbrell
2026-09-27 07:48:43 -05:00
parent fec4159ea5
commit 4443d98104

View File

@@ -225,15 +225,13 @@ void Character::DoQuickXMLDataParse() {
const auto* id = currentChild->Attribute("id");
const auto* si = currentChild->Attribute("si");
if (temp && id) {
// A malformed flag in the save should skip that flag, not throw out of the whole load.
const auto index = GeneralUtils::TryParse<uint32_t>(id);
const auto value = GeneralUtils::TryParse<uint64_t>(temp);
uint32_t index = 0;
uint64_t value = 0;
if (index && value) {
m_PlayerFlags.insert(std::make_pair(index.value(), value.value()));
} else {
LOG("Skipping malformed flag (id %s, v %s) for character %llu", id, temp, m_ObjectID);
}
index = std::stoul(id);
value = std::stoull(temp);
m_PlayerFlags.insert(std::make_pair(index, value));
} else if (si) {
auto value = GeneralUtils::TryParse<uint32_t>(si);
if (value) m_SessionFlags.insert(value.value());