# HG changeset patch # User HackaLittleBit # Date 1419867834 0 # Mon Dec 29 15:43:54 2014 +0000 # Node ID 17fae7e79445dfc2f8fec83bc747e16b31fccbce # Parent e93cf1df10f080f29443798c3e85bd911253cb27 Correct waterclass and flags for bouy's in old save games diff -r e93cf1df10f0 -r 17fae7e79445 src/saveload/afterload.cpp --- a/src/saveload/afterload.cpp Fri Dec 26 01:14:55 2014 +0000 +++ b/src/saveload/afterload.cpp Mon Dec 29 15:43:54 2014 +0000 @@ -2950,6 +2950,30 @@ } } + if (IsSavegameVersionBefore(188)) { + + /* Cleanup bouy's and set correct waterclass and flags */ + Waypoint *wp; + TileIndex tile; + FOR_ALL_WAYPOINTS(wp) { + + tile = wp->xy; + if(GetStationType(tile) == STATION_BUOY) { + + DEBUG(misc, 0, "TILE: %#x", tile); + DEBUG(misc, 0, "before wc: %u, FACIL_DOCK = %u, FACIL_WAYPOINT = %u", GetWaterClass(tile), (wp->facilities & FACIL_DOCK), (wp->facilities & FACIL_WAYPOINT)); + + wp->facilities |= FACIL_DOCK; + wp->owner = OWNER_NONE; + TileHeight(tile) == 0 ? MakeBuoy(tile, wp->index, WATER_CLASS_SEA) : MakeBuoy(tile, wp->index, WATER_CLASS_CANAL); + + DEBUG(misc, 0, "after wc: %u, FACIL_DOCK = %u, FACIL_WAYPOINT = %u", GetWaterClass(tile), (wp->facilities & FACIL_DOCK), (wp->facilities & FACIL_WAYPOINT)); + } + } + } + + + /* * Only keep order-backups for network clients. * If we are a network server or not networking, then we just loaded a previously