summaryrefslogtreecommitdiff
path: root/src/vehicle_cmd.cpp
diff options
context:
space:
mode:
authorfrosch <frosch@openttd.org>2010-04-17 14:55:49 +0000
committerfrosch <frosch@openttd.org>2010-04-17 14:55:49 +0000
commit2365a4dea0ffa0eac31193c70680368c4774903d (patch)
tree13f3c3eaed24c14c6ec6e8ec589ecf07af9400e5 /src/vehicle_cmd.cpp
parent5ecf2f7f8cb157d959c42b3396398f03d3f3fffb (diff)
downloadopenttd-2365a4dea0ffa0eac31193c70680368c4774903d.tar.xz
(svn r19657) -Fix: Add saneness checks for front vehicles.
Diffstat (limited to 'src/vehicle_cmd.cpp')
-rw-r--r--src/vehicle_cmd.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/vehicle_cmd.cpp b/src/vehicle_cmd.cpp
index 6a72fbbff..c621ed271 100644
--- a/src/vehicle_cmd.cpp
+++ b/src/vehicle_cmd.cpp
@@ -410,7 +410,7 @@ CommandCost CmdCloneVehicle(TileIndex tile, DoCommandFlag flags, uint32 p1, uint
uint32 build_argument = 2;
Vehicle *v = Vehicle::GetIfValid(p1);
- if (v == NULL) return CMD_ERROR;
+ if (v == NULL || !v->IsPrimaryVehicle()) return CMD_ERROR;
Vehicle *v_front = v;
Vehicle *w = NULL;
Vehicle *w_front = NULL;
@@ -629,7 +629,7 @@ CommandCost SendAllVehiclesToDepot(VehicleType type, DoCommandFlag flags, bool s
CommandCost CmdRenameVehicle(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
{
Vehicle *v = Vehicle::GetIfValid(p1);
- if (v == NULL) return CMD_ERROR;
+ if (v == NULL || !v->IsPrimaryVehicle()) return CMD_ERROR;
CommandCost ret = CheckOwnership(v->owner);
if (ret.Failed()) return ret;
@@ -663,7 +663,7 @@ CommandCost CmdRenameVehicle(TileIndex tile, DoCommandFlag flags, uint32 p1, uin
CommandCost CmdChangeServiceInt(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
{
Vehicle *v = Vehicle::GetIfValid(p1);
- if (v == NULL) return CMD_ERROR;
+ if (v == NULL || !v->IsPrimaryVehicle()) return CMD_ERROR;
CommandCost ret = CheckOwnership(v->owner);
if (ret.Failed()) return ret;