Codechange: prefer AutoRestoreBackup over Backup/Restore (#15480)

This commit is contained in:
Peter Nelson
2026-04-27 08:02:41 +01:00
committed by GitHub
parent a4d142eddb
commit 4a7cbf29f0
18 changed files with 51 additions and 121 deletions
+1 -2
View File
@@ -604,11 +604,10 @@ public:
if (Town::GetNumItems() == 0) {
ShowErrorMessage(GetEncodedString(STR_ERROR_CAN_T_GENERATE_INDUSTRIES), GetEncodedString(STR_ERROR_MUST_FOUND_TOWN_FIRST), WL_INFO);
} else {
Backup<bool> old_generating_world(_generating_world, true);
AutoRestoreBackup old_generating_world(_generating_world, true);
BasePersistentStorageArray::SwitchMode(PSM_ENTER_GAMELOOP);
GenerateIndustries();
BasePersistentStorageArray::SwitchMode(PSM_LEAVE_GAMELOOP);
old_generating_world.Restore();
}
}