Mercurial > hg > openttd
comparison src/openttd.cpp @ 8521:3d8654a3dd94 draft
(svn r12096) -Fix: remove leftover property when loading older savegames
author | smatz <smatz@openttd.org> |
---|---|
date | Sat, 09 Feb 2008 17:36:21 +0000 |
parents | 4f13e896d29f |
children | 433c2575e919 |
comparison
equal
deleted
inserted
replaced
8520:c777304e2098 | 8521:3d8654a3dd94 |
---|---|
2360 if (IsTileType(t, MP_WATER) && IsLock(t)) SetWaterClassDependingOnSurroundings(t); | 2360 if (IsTileType(t, MP_WATER) && IsLock(t)) SetWaterClassDependingOnSurroundings(t); |
2361 if (IsTileType(t, MP_STATION) && (IsDock(t) || IsBuoy(t))) SetWaterClassDependingOnSurroundings(t); | 2361 if (IsTileType(t, MP_STATION) && (IsDock(t) || IsBuoy(t))) SetWaterClassDependingOnSurroundings(t); |
2362 } | 2362 } |
2363 } | 2363 } |
2364 | 2364 |
2365 if (CheckSavegameVersion(87)) { | |
2366 for (TileIndex t = 0; t < map_size; t++) { | |
2367 if (IsBuoyTile(t) || IsDriveThroughStopTile(t) || IsTileType(t, MP_WATER)) { | |
2368 Owner o = GetTileOwner(t); | |
2369 if (IsValidPlayer(o) && !GetPlayer(o)->is_active) { | |
2370 _current_player = o; | |
2371 ChangeTileOwner(t, o, PLAYER_SPECTATOR); | |
2372 } | |
2373 if (IsBuoyTile(t)) { | |
2374 /* reset buoy owner to OWNER_NONE in the station struct | |
2375 * (even if it is owned by active player) */ | |
2376 GetStationByTile(t)->owner = OWNER_NONE; | |
2377 } | |
2378 } else if (IsTileType(t, MP_ROAD)) { | |
2379 /* works for all RoadTileType */ | |
2380 for (RoadType rt = ROADTYPE_ROAD; rt < ROADTYPE_END; rt++) { | |
2381 /* update even non-existing road types to update tile owner too */ | |
2382 Owner o = GetRoadOwner(t, rt); | |
2383 if (IsValidPlayer(o) && !GetPlayer(o)->is_active) SetRoadOwner(t, rt, OWNER_NONE); | |
2384 } | |
2385 if (GetRoadTileType(t) == ROAD_TILE_CROSSING) { | |
2386 Owner o = GetTileOwner(t); | |
2387 if (!GetPlayer(o)->is_active) { | |
2388 /* remove leftover rail piece from crossing (from very old savegames) */ | |
2389 _current_player = o; | |
2390 DoCommand(t, 0, AxisToTrack(OtherAxis(GetCrossingRoadAxis(t))), DC_EXEC | DC_BANKRUPT, CMD_REMOVE_SINGLE_RAIL); | |
2391 } | |
2392 } | |
2393 } | |
2394 } | |
2395 } | |
2396 | |
2365 return InitializeWindowsAndCaches(); | 2397 return InitializeWindowsAndCaches(); |
2366 } | 2398 } |
2367 | 2399 |
2368 /** Reload all NewGRF files during a running game. This is a cut-down | 2400 /** Reload all NewGRF files during a running game. This is a cut-down |
2369 * version of AfterLoadGame(). | 2401 * version of AfterLoadGame(). |