(svn r20334) -Codechange: reorder the unmovable bits a bit for futher extension

This commit is contained in:
rubidium
2010-08-03 08:09:45 +00:00
parent 1a9d5ae076
commit f44c51577b
5 changed files with 44 additions and 30 deletions

View File

@@ -1792,13 +1792,25 @@ bool AfterLoadGame()
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].m3 = GB(_m[t].m5, 0, 5);
_m[t].m5 = UNMOVABLE_HQ;
SetCompanyHQSize(t, GB(old_m5, 2, 3));
SetCompanyHQSection(t, GB(old_m5, 0, 2));
}
}
}
if (CheckSavegameVersion(144)) {
for (TileIndex t = 0; t < map_size; t++) {
if (!IsTileType(t, MP_UNMOVABLE)) continue;
/* Reordering/generalisation of the unmovable bits. */
UnmovableType type = GetUnmovableType(t);
SetCompanyHQSize(t, type == UNMOVABLE_HQ ? GB(_m[t].m3, 2, 3) : 0);
SetCompanyHQSection(t, type == UNMOVABLE_HQ ? GB(_m[t].m3, 1, 1) << 4 | GB(_m[t].m3, 0, 1) : 0);
/* Make sure those bits are clear as well! */
_m[t].m4 = 0;
_me[t].m7 = 0;
}
}
if (CheckSavegameVersion(113)) {
/* allow_town_roads is added, set it if town_layout wasn't TL_NO_ROADS */