From 55e1eab1a212108d5aed57ffe0b98146f52d430c Mon Sep 17 00:00:00 2001 From: darkvater Date: Sun, 30 Jan 2005 18:51:08 +0000 Subject: [PATCH] (svn r1739) - Fix: type checking when selling vehicles (TrueLight) --- aircraft_cmd.c | 2 +- ship_cmd.c | 2 +- train_cmd.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/aircraft_cmd.c b/aircraft_cmd.c index f832b27765..b66d0d6e7f 100644 --- a/aircraft_cmd.c +++ b/aircraft_cmd.c @@ -364,7 +364,7 @@ int32 CmdSellAircraft(int x, int y, uint32 flags, uint32 p1, uint32 p2) v = GetVehicle(p1); - if (!CheckOwnership(v->owner) || !CheckStoppedInHangar(v)) + if (v->type != VEH_Aircraft || !CheckOwnership(v->owner) || !CheckStoppedInHangar(v)) return CMD_ERROR; if (flags & DC_EXEC) { diff --git a/ship_cmd.c b/ship_cmd.c index c85377187a..0bab059ba4 100644 --- a/ship_cmd.c +++ b/ship_cmd.c @@ -919,7 +919,7 @@ int32 CmdSellShip(int x, int y, uint32 flags, uint32 p1, uint32 p2) v = GetVehicle(p1); - if (!CheckOwnership(v->owner)) + if (v->type != VEH_Ship || !CheckOwnership(v->owner)) return CMD_ERROR; if (!IsShipDepotTile(v->tile) || v->u.road.state != 0x80 || !(v->vehstatus&VS_STOPPED)) diff --git a/train_cmd.c b/train_cmd.c index 0b632029b6..f5fa01fe8d 100644 --- a/train_cmd.c +++ b/train_cmd.c @@ -873,7 +873,7 @@ int32 CmdSellRailWagon(int x, int y, uint32 flags, uint32 p1, uint32 p2) v = GetVehicle(p1); - if (v->type == 0 || !CheckOwnership(v->owner)) + if (v->type != VEH_Train || !CheckOwnership(v->owner)) return CMD_ERROR; // get first vehicle in chain