Merge pull request #534 from NQNStudios:fix-479

Fixing text buffer texture/font corruption (#479)

* #479 demonstrates that the contents of the text buffer are NOT irrelevant for reproducing bugs. So I set up recording/replay for the burma shave easter egg. This also makes an easy way to mess with the buffer state when debugging (just mash &/\*/&/\*/&/\* n times)
* When a replay throws an error, it puts up a showError() dialog. If the next action is a control_click, the system will try to click that control on the error dialog--which is totally divergent from the replay's intended behavior. So we should just stop replaying when an error happens.
* If you have a long replay and want to run it very fast, but then slow down when you get to the sequence that reproduces your bug, now you can add a `<change_fps>` to your replay to achieve that.
* Fixes for the 2 legacy replay errors that I opened recently

Fix #479 
Fix #532 
Fix #533
This commit is contained in:
2025-01-20 09:10:17 -05:00
committed by GitHub
22 changed files with 165 additions and 43 deletions

View File

@@ -39,6 +39,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;
@@ -154,7 +159,18 @@ static bool load_prefs(std::istream& istream) {
}
std::string key = line.substr(0, key_end + 1), val = line.substr(val_beg);
NSInteger type = [prefsToRecord[[NSString stringWithUTF8String: key.c_str()]] integerValue];
NSString* pref_key = [NSString stringWithUTF8String: key.c_str()];
NSInteger type;
// Skip obsolete preferences from legacy replays
if([prefsToRecord valueForKey: pref_key] == nil){
if([prefsToReplay valueForKey: pref_key] == nil){
continue;
}else{
type = [prefsToReplay[pref_key] integerValue];
}
}else{
type = [prefsToRecord[pref_key] integerValue];
}
switch((int)type) {
case kBool:
if(val == "true") set_pref(key, true);