src/station_cmd.cpp
branchgamebalance
changeset 9908 0fa543611bbe
parent 9907 3b068c3a1c74
child 9909 dce9a6923bb7
--- a/src/station_cmd.cpp	Thu Apr 19 14:48:10 2007 +0000
+++ b/src/station_cmd.cpp	Tue Jun 12 11:56:35 2007 +0000
@@ -9,6 +9,7 @@
 #include "cmd_helper.h"
 #include "debug.h"
 #include "functions.h"
+#include "landscape.h"
 #include "station_map.h"
 #include "table/sprites.h"
 #include "table/strings.h"
@@ -118,7 +119,7 @@
 
 static Station* GetStationAround(TileIndex tile, int w, int h, StationID closest_station)
 {
-	// check around to see if there's any stations there
+	/* check around to see if there's any stations there */
 	BEGIN_TILE_LOOP(tile_cur, w + 2, h + 2, tile - TileDiffXY(1, 1))
 		if (IsTileType(tile_cur, MP_STATION)) {
 			StationID t = GetStationIndex(tile_cur);
@@ -1190,9 +1191,12 @@
 	/* If it is a drive-through stop check for valid axis */
 	if (is_drive_through && !IsValidAxis((Axis)p1)) return CMD_ERROR;
 	/* Road bits in the wrong direction */
-	if (build_over_road && (GetRoadBits(tile) & ((Axis)p1 == AXIS_X ? ROAD_Y : ROAD_X)) != 0) return CMD_ERROR;
+	if (build_over_road && (GetRoadBits(tile) & ((Axis)p1 == AXIS_X ? ROAD_Y : ROAD_X)) != 0) return_cmd_error(STR_DRIVE_THROUGH_ERROR_DIRECTION);
 	/* Not allowed to build over this road */
-	if (build_over_road && !IsTileOwner(tile, _current_player) && !(IsTileOwner(tile, OWNER_TOWN) && _patches.road_stop_on_town_road)) return CMD_ERROR;
+	if (build_over_road) {
+		if (IsTileOwner(tile, OWNER_TOWN) && !_patches.road_stop_on_town_road) return_cmd_error(STR_DRIVE_THROUGH_ERROR_ON_TOWN_ROAD);
+		if (!IsTileOwner(tile, OWNER_TOWN) && !CheckOwnership(GetTileOwner(tile))) return CMD_ERROR;
+	}
 
 	SET_EXPENSES_TYPE(EXPENSES_CONSTRUCTION);
 
@@ -1600,6 +1604,13 @@
 
 	int32 cost = w * h * _eco->GetPrice(CEconomy::REMOVE_AIRPORT);
 
+	Vehicle *v;
+	FOR_ALL_VEHICLES(v) {
+		if (!(v->type == VEH_AIRCRAFT && IsNormalAircraft(v))) continue;
+
+		if (v->u.air.targetairport == st->index && v->u.air.state != FLYING) return CMD_ERROR;
+	}
+
 	BEGIN_TILE_LOOP(tile_cur, w, h, tile) {
 		if (!EnsureNoVehicle(tile_cur)) return CMD_ERROR;
 
@@ -1949,7 +1960,7 @@
 		}
 
 		SpriteID pal;
-		if (_display_opt & DO_TRANS_BUILDINGS) {
+		if (HASBIT(_transparent_opt, TO_BUILDINGS)) {
 			SETBIT(image, PALETTE_MODIFIER_TRANSPARENT);
 			pal = PALETTE_TO_TRANSPARENT;
 		} else if (HASBIT(image, PALETTE_MODIFIER_COLOR)) {