src/station_cmd.cpp
changeset 8010 362ba0e81391
parent 7954 57b51c69c072
child 8015 1144c1044b27
equal deleted inserted replaced
8009:e38f46188aad 8010:362ba0e81391
  1168 
  1168 
  1169 	SET_EXPENSES_TYPE(EXPENSES_CONSTRUCTION);
  1169 	SET_EXPENSES_TYPE(EXPENSES_CONSTRUCTION);
  1170 
  1170 
  1171 	/* Do the action for every tile into the area */
  1171 	/* Do the action for every tile into the area */
  1172 	BEGIN_TILE_LOOP(tile2, size_x, size_y, tile) {
  1172 	BEGIN_TILE_LOOP(tile2, size_x, size_y, tile) {
  1173 		/* Make sure the specified tile belongs to the current player, and that it is a railroad station. */
  1173 		/* Make sure the specified tile is a railroad station */
  1174 		if (!IsTileType(tile2, MP_STATION) || !IsRailwayStation(tile2) || !_patches.nonuniform_stations) {
  1174 		if (!IsTileType(tile2, MP_STATION) || !IsRailwayStation(tile2)) {
       
  1175 			continue;
       
  1176 		}
       
  1177 
       
  1178 		/* If there is a vehicle on ground, do not allow to remove (flood) the tile */
       
  1179 		if (!EnsureNoVehicleOnGround(tile2)) {
  1175 			continue;
  1180 			continue;
  1176 		}
  1181 		}
  1177 
  1182 
  1178 		/* Check ownership of station */
  1183 		/* Check ownership of station */
  1179 		Station *st = GetStationByTile(tile2);
  1184 		Station *st = GetStationByTile(tile2);
  1180 		if (_current_player != OWNER_WATER && (!CheckOwnership(st->owner) || !EnsureNoVehicleOnGround(tile2))) {
  1185 		if (_current_player != OWNER_WATER && !CheckOwnership(st->owner)) {
  1181 			continue;
  1186 			continue;
  1182 		}
  1187 		}
       
  1188 
       
  1189 		/* Do not allow removing from stations if non-uniform stations are not enabled
       
  1190 		 * The check must be here to give correct error message
       
  1191  		 */
       
  1192 		if (!_patches.nonuniform_stations) return_cmd_error(STR_306D_NONUNIFORM_STATIONS_DISALLOWED);
  1183 
  1193 
  1184 		/* If we reached here, the tile is valid so increase the quantity of tiles we will remove */
  1194 		/* If we reached here, the tile is valid so increase the quantity of tiles we will remove */
  1185 		quantity++;
  1195 		quantity++;
  1186 
  1196 
  1187 		if (flags & DC_EXEC) {
  1197 		if (flags & DC_EXEC) {