Changeset - r6734:f8fec7dde1f2
[Not reviewed]
master
0 1 0
rubidium - 17 years ago 2007-05-28 21:32:26
rubidium@openttd.org
(svn r9966) -Fix: bridges and tunnels were not always removed on bankruptcy, thus leaving tunnels/bridges with an invalid owner that would crash the game when clicking with the query tool on them.
1 file changed with 8 insertions and 1 deletions:
0 comments (0 inline, 0 general)
src/tunnelbridge_cmd.cpp
Show inline comments
 
@@ -1325,7 +1325,14 @@ static void ChangeTileOwner_TunnelBridge
 
	if (new_player != PLAYER_SPECTATOR) {
 
		SetTileOwner(tile, new_player);
 
	} else {
 
		DoCommand(tile, 0, 0, DC_EXEC, CMD_LANDSCAPE_CLEAR);
 
		if (CmdFailed(DoCommand(tile, 0, 0, DC_EXEC, CMD_LANDSCAPE_CLEAR))) {
 
			/* When clearing the bridge/tunnel failed there are still vehicles on/in
 
			 * the bridge/tunnel. As all *our* vehicles are already removed, they
 
			 * must be of another owner. Therefor this must be a road bridge/tunnel.
 
			 * In that case we can safely reassign the ownership to OWNER_NONE. */
 
			assert((IsTunnel(tile) ? GetTunnelTransportType(tile) : GetBridgeTransportType(tile)) == TRANSPORT_ROAD);
 
			SetTileOwner(tile, OWNER_NONE);
 
		}
 
	}
 
}
 

	
0 comments (0 inline, 0 general)