Changeset - r10106:053c1b944d2e
[Not reviewed]
master
0 1 0
smatz - 16 years ago 2008-09-11 17:41:43
smatz@openttd.org
(svn r14290) -Fix (r13932): level crossings could be barred when they shouldn't be after savegame conversion
1 file changed with 8 insertions and 3 deletions:
0 comments (0 inline, 0 general)
src/openttd.cpp
Show inline comments
 
@@ -2333,27 +2333,24 @@ bool AfterLoadGame()
 
		Player *p;
 
		FOR_ALL_PLAYERS(p) {
 
			for (uint i = 0; i < 4; i++) {
 
				PlayerID o = p->share_owners[i];
 
				if (o == PLAYER_SPECTATOR) continue;
 
				if (!IsValidPlayerID(o) || o == p->index) p->share_owners[i] = PLAYER_SPECTATOR;
 
			}
 
		}
 
	}
 

	
 
	if (CheckSavegameVersion(86)) {
 
		for (TileIndex t = 0; t < map_size; t++) {
 
			/* Now all crossings should be in correct state */
 
			if (IsLevelCrossingTile(t)) UpdateLevelCrossing(t, false);
 

	
 
			/* Move river flag and update canals to use water class */
 
			if (IsTileType(t, MP_WATER)) {
 
				if (GetWaterClass(t) != WATER_CLASS_RIVER) {
 
					if (IsWater(t)) {
 
						Owner o = GetTileOwner(t);
 
						if (o == OWNER_WATER) {
 
							MakeWater(t);
 
						} else {
 
							MakeCanal(t, o, Random());
 
						}
 
					} else if (IsShipDepot(t)) {
 
						Owner o = (Owner)_m[t].m4; // Original water owner
 
@@ -2536,24 +2533,32 @@ bool AfterLoadGame()
 
			}
 
		}
 

	
 
		/* Give owners to waypoints, based on rail tracks it is sitting on.
 
		 * If none is available, specify OWNER_NONE */
 
		Waypoint *wp;
 
		FOR_ALL_WAYPOINTS(wp) {
 
			Owner owner = (IsRailWaypointTile(wp->xy) ? GetTileOwner(wp->xy) : OWNER_NONE);
 
			wp->owner = IsValidPlayerID(owner) ? owner : OWNER_NONE;
 
		}
 
	}
 

	
 
	if (CheckSavegameVersion(102)) {
 
		for (TileIndex t = 0; t < map_size; t++) {
 
			/* Now all crossings should be in correct state */
 
			if (IsLevelCrossingTile(t)) UpdateLevelCrossing(t, false);
 
		}
 
	}
 

	
 

	
 
	GamelogPrintDebug(1);
 

	
 
	return InitializeWindowsAndCaches();
 
}
 

	
 
/** Reload all NewGRF files during a running game. This is a cut-down
 
 * version of AfterLoadGame().
 
 * XXX - We need to reset the vehicle position hash because with a non-empty
 
 * hash AfterLoadVehicles() will loop infinitely. We need AfterLoadVehicles()
 
 * to recalculate vehicle data as some NewGRF vehicle sets could have been
 
 * removed or added and changed statistics */
 
void ReloadNewGRFData()
0 comments (0 inline, 0 general)