summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbjarni <bjarni@openttd.org>2005-01-30 14:52:04 +0000
committerbjarni <bjarni@openttd.org>2005-01-30 14:52:04 +0000
commit0cfb483677a46b8c04c562acad5222ce3a8aa741 (patch)
tree4623477c0a77662b7cbaa5ddf34e25846628e4c4
parent0a7546b6abb13c9ea287e7cf76af9f7af1746c2b (diff)
downloadopenttd-0cfb483677a46b8c04c562acad5222ce3a8aa741.tar.xz
(svn r1730) - Fix: Ships and Aircrafts have to be build in depots owned by _current_player (hacked client protection)
now all 4 types of vehicles have to be build in depots. Note: there is a wordaround for AI players since the AI handle aircraft building in a weird way
-rw-r--r--aircraft_cmd.c5
-rw-r--r--ship_cmd.c4
2 files changed, 9 insertions, 0 deletions
diff --git a/aircraft_cmd.c b/aircraft_cmd.c
index e1a486329..f832b2776 100644
--- a/aircraft_cmd.c
+++ b/aircraft_cmd.c
@@ -163,6 +163,11 @@ int32 CmdBuildAircraft(int x, int y, uint32 flags, uint32 p1, uint32 p2)
if (!IsEngineBuildable(p1, VEH_Aircraft)) return CMD_ERROR;
+ // Workaround: TODO: make AI players try to build planes in a hangar instead of just an airport tile.
+ if (!IsAircraftHangarTile((TileIndex)tile) && IS_HUMAN_PLAYER(_current_player)) return CMD_ERROR;
+
+ if (_map_owner[tile] != _current_player) return CMD_ERROR;
+
SET_EXPENSES_TYPE(EXPENSES_NEW_VEHICLES);
value = EstimateAircraftCost(p1);
diff --git a/ship_cmd.c b/ship_cmd.c
index c7330b9d2..c85377187 100644
--- a/ship_cmd.c
+++ b/ship_cmd.c
@@ -841,6 +841,10 @@ int32 CmdBuildShip(int x, int y, uint32 flags, uint32 p1, uint32 p2)
if (!IsEngineBuildable(p1, VEH_Ship)) return CMD_ERROR;
+ if (!IsShipDepotTile((TileIndex)tile)) return CMD_ERROR;
+
+ if (_map_owner[tile] != _current_player) return CMD_ERROR;
+
SET_EXPENSES_TYPE(EXPENSES_NEW_VEHICLES);
value = EstimateShipCost(p1);