fix explosions breaking old replays

This commit is contained in:
2025-01-16 15:28:06 -06:00
parent afa79bcc5d
commit df02f79ab8
7 changed files with 31 additions and 9 deletions

View File

@@ -38,6 +38,11 @@ NSDictionary* prefsToRecord = @{
@"UIScale": @(kFloat),
@"UIScaleMap": @(kFloat)
};
// Some legacy preferences influenced RNG and must be
// known by replays
NSDictionary* prefsToReplay = @{
@"DrawTerrainFrills": @(kBool)
};
bool prefsLoaded = false;
@@ -133,11 +138,17 @@ static bool load_prefs(std::istream& istream) {
std::string key = line.substr(0, key_end + 1), val = line.substr(val_beg);
NSString* pref_key = [NSString stringWithUTF8String: key.c_str()];
NSInteger type;
// Skip obsolete preferences from legacy replays
if([prefsToRecord valueForKey: pref_key] == nil){
continue;
if([prefsToReplay valueForKey: pref_key] == nil){
continue;
}else{
type = [prefsToReplay[pref_key] integerValue];
}
}else{
type = [prefsToRecord[pref_key] integerValue];
}
NSInteger type = [prefsToRecord[pref_key] integerValue];
switch((int)type) {
case kBool:
if(val == "true") set_pref(key, true);