(svn r15290) -Codechange: Isolate size and section of the UnMovable HQ object, in order to keep the Unmovable type free of any irrelevant data

This commit is contained in:
belugas
2009-01-28 19:57:23 +00:00
parent 0809ff6767
commit a57c73e2f9
6 changed files with 78 additions and 36 deletions

View File

@@ -1694,6 +1694,21 @@ bool AfterLoadGame()
}
}
if (CheckSavegameVersion(112)) {
for (TileIndex t = 0; t < map_size; t++) {
/* Check for HQ bit being set, instead of using map accessor,
* since we've already changed it code-wise */
if (IsTileType(t, MP_UNMOVABLE) && HasBit(_m[t].m5, 7)) {
/* Move size and part identification of HQ out of the m5 attribute,
* on new locations */
uint8 old_m5 = _m[t].m5;
_m[t].m5 = UNMOVABLE_HQ;
SetCompanyHQSize(t, GB(old_m5, 2, 3));
SetCompanyHQSection(t, GB(old_m5, 0, 2));
}
}
}
GamelogPrintDebug(1);
bool ret = InitializeWindowsAndCaches();