Save migration for old contract names

Rename old "HammingCodes: Integer to encoded Binary" contracts to
"HammingCodes: Integer to Encoded Binary" on file load if the save
is old.
This commit is contained in:
Undeemiss
2022-04-25 20:12:46 -05:00
parent b7f78b11dd
commit 8e4ac7be6b
2 changed files with 14 additions and 1 deletions

View File

@ -118,7 +118,7 @@ export const CONSTANTS: {
LatestUpdate: string;
} = {
VersionString: "1.6.4",
VersionNumber: 15,
VersionNumber: 16,
// Speed (in ms) at which the main loop is updated
_idleSpeed: 200,

View File

@ -398,6 +398,19 @@ function evaluateVersionCompatibility(ver: string | number): void {
if (ver < 15) {
(Settings as any).EditorTheme = { ...defaultMonacoTheme };
}
//Fix contract names
if (ver < 16) {
//Iterate over all contracts on all servers
for (const server of GetAllServers()) {
for (const contract of server.contracts) {
//Rename old "HammingCodes: Integer to encoded Binary" contracts
//to "HammingCodes: Integer to Encoded Binary"
if (contract.type == "HammingCodes: Integer to encoded Binary") {
contract.type = "HammingCodes: Integer to Encoded Binary";
}
}
}
}
}
}