(svn r11276) -Codechange: be more consistent with naming of some accessors.

-Fix: make sure canals are never owned by water. Based on a patch by boekabart.
This commit is contained in:
rubidium
2007-10-16 19:48:58 +00:00
parent 4f512a70c3
commit ba7c595d84
8 changed files with 52 additions and 17 deletions

View File

@@ -1626,7 +1626,7 @@ bool AfterLoadGame()
if (GB(_m[t].m5, 3, 2) == 0) {
MakeClear(t, CLEAR_GRASS, 3);
} else {
MakeCanal(t, GetTileOwner(t));
MakeCanal(t, (GetTileOwner(t) == OWNER_WATER) ? OWNER_NONE : GetTileOwner(t));
}
}
SetBridgeMiddle(t, axis);
@@ -2160,6 +2160,19 @@ bool AfterLoadGame()
FOR_ALL_INDUSTRIES(i) i->founder = OWNER_NONE;
}
/* From version 82, old style canals (above sealevel (0), WATER owner) are no longer supported.
Replace the owner for those by OWNER_NONE. */
if (CheckSavegameVersion(82)) {
for (TileIndex t = 0; t < map_size; t++) {
if (IsTileType(t, MP_WATER) &&
GetWaterTileType(t) == WATER_TILE_CLEAR &&
GetTileOwner(t) == OWNER_WATER &&
TileHeight(t) != 0) {
SetTileOwner(t, OWNER_NONE);
}
}
}
/* Recalculate */
Group *g;
FOR_ALL_GROUPS(g) {