fix explosions breaking old replays
This commit is contained in:
@@ -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);
|
||||
|
Reference in New Issue
Block a user