SAVEGAME: Reduce size of savefile (#1148)

Storing less info in the save for Factions/Companies if it's still the default info
This commit is contained in:
Snarling
2024-03-11 08:58:10 -04:00
committed by GitHub
parent 4d5401f62e
commit e9d1ddfaf3
7 changed files with 54 additions and 587 deletions
+6 -8
View File
@@ -30,15 +30,13 @@ export function Reviver(_key: string, value: unknown): any {
if (!ctor) {
// Known missing constructors with special handling.
switch (value.ctor) {
case "AllServersMap":
console.warn("Converting AllServersMap for v0.43.1");
case "AllServersMap": // Reviver removed in v0.43.1
case "Industry": // No longer part of save data since v2.3.0
case "Employee": // Entire object removed from game in v2.2.0 (employees abstracted)
case "Company": // Reviver removed in v2.6.1
case "Faction": // Reviver removed in v2.6.1
console.warn(`Legacy load type ${value.ctor} converted to expected format while loading.`);
return value.data;
case "Industry":
console.warn("Converting a corp from pre-2.3");
return value.data; // Will immediately be overwritten by v2.3 save migration code
case "Employee":
console.warn("Converting a corp from pre-2.2");
return value.data; // Will immediately be overwritten by v2.3 save migration code
}
// Missing constructor with no special handling. Throw error.
throw new Error(`Could not locate constructor named ${value.ctor}. If the save data is valid, this is a bug.`);