Fix serial

develop
kaetemi 4 years ago
parent 3a2922021e
commit eac2aed175

@ -75,11 +75,20 @@ void CCompassTarget::serial(NLMISC::IStream &f)
} }
} }
f.serialCheck(NELID("CTAR")); f.serialCheck(NELID("CTAR"));
f.serialVersion(0); sint version = f.serialVersion(1);
f.serial(Pos); f.serial(Pos);
// for the name, try to save a string identifier if possible, because language may be changed between // for the name, try to save a string identifier if possible, because language may be changed between
// save & reload // save & reload
if (version < 1)
{
ucstring name; // Serial old version
f.serial(name);
Name = name.toUtf8();
}
else
{
f.serial(Name); f.serial(Name);
}
std::string language = toLower(ClientCfg.LanguageCode); std::string language = toLower(ClientCfg.LanguageCode);
f.serial(language); f.serial(language);
f.serialEnum(_Type); f.serialEnum(_Type);

Loading…
Cancel
Save