(svn r1730) - Fix: Ships and Aircrafts have to be build in depots owned by _current_player (hacked client protection)
authorbjarni
Sun, 30 Jan 2005 14:52:04 +0000
changeset 1226 cbcaba80c31c
parent 1225 0733ebeaa129
child 1227 3552f20fcfcb
(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
aircraft_cmd.c
ship_cmd.c
--- a/aircraft_cmd.c	Sun Jan 30 14:32:52 2005 +0000
+++ b/aircraft_cmd.c	Sun Jan 30 14:52:04 2005 +0000
@@ -163,6 +163,11 @@
 
 	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);
--- a/ship_cmd.c	Sun Jan 30 14:32:52 2005 +0000
+++ b/ship_cmd.c	Sun Jan 30 14:52:04 2005 +0000
@@ -841,6 +841,10 @@
 
 	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);