src/rail_cmd.cpp
changeset 9015 4a44c6974ac1
parent 8910 b261b6cb9b21
child 9019 de364e5be143
equal deleted inserted replaced
9014:223a4ddb80bb 9015:4a44c6974ac1
   453 	switch (GetTileType(tile)) {
   453 	switch (GetTileType(tile)) {
   454 		case MP_ROAD: {
   454 		case MP_ROAD: {
   455 			if (!IsLevelCrossing(tile) ||
   455 			if (!IsLevelCrossing(tile) ||
   456 					GetCrossingRailBits(tile) != trackbit ||
   456 					GetCrossingRailBits(tile) != trackbit ||
   457 					(_current_player != OWNER_WATER && !CheckTileOwnership(tile)) ||
   457 					(_current_player != OWNER_WATER && !CheckTileOwnership(tile)) ||
   458 					!EnsureNoVehicleOnGround(tile)) {
   458 					(!(flags & DC_BANKRUPT) && !EnsureNoVehicleOnGround(tile))) {
   459 				return CMD_ERROR;
   459 				return CMD_ERROR;
   460 			}
   460 			}
   461 
   461 
   462 			if (flags & DC_EXEC) {
   462 			if (flags & DC_EXEC) {
   463 				owner = GetTileOwner(tile);
   463 				owner = GetTileOwner(tile);
  2144 	if (!IsTileOwner(tile, old_player)) return;
  2144 	if (!IsTileOwner(tile, old_player)) return;
  2145 
  2145 
  2146 	if (new_player != PLAYER_SPECTATOR) {
  2146 	if (new_player != PLAYER_SPECTATOR) {
  2147 		SetTileOwner(tile, new_player);
  2147 		SetTileOwner(tile, new_player);
  2148 	} else {
  2148 	} else {
  2149 		DoCommand(tile, 0, 0, DC_EXEC, CMD_LANDSCAPE_CLEAR);
  2149 		DoCommand(tile, 0, 0, DC_EXEC | DC_BANKRUPT, CMD_LANDSCAPE_CLEAR);
  2150 	}
  2150 	}
  2151 }
  2151 }
  2152 
  2152 
  2153 static const byte _fractcoords_behind[4] = { 0x8F, 0x8, 0x80, 0xF8 };
  2153 static const byte _fractcoords_behind[4] = { 0x8F, 0x8, 0x80, 0xF8 };
  2154 static const byte _fractcoords_enter[4] = { 0x8A, 0x48, 0x84, 0xA8 };
  2154 static const byte _fractcoords_enter[4] = { 0x8A, 0x48, 0x84, 0xA8 };