(svn r16352) -Codechange: use PoolItem::GetIfValid() instead of PoolItem::IsValidID() and PoolItem::Get()

This commit is contained in:
smatz
2009-05-18 16:21:28 +00:00
parent 5fe906e149
commit 8808f3beea
35 changed files with 201 additions and 305 deletions

View File

@@ -608,8 +608,9 @@ CommandCost CmdAutoreplaceVehicle(TileIndex tile, DoCommandFlag flags, uint32 p1
CommandCost cost = CommandCost(EXPENSES_NEW_VEHICLES, 0);
bool nothing_to_do = true;
if (!Vehicle::IsValidID(p1)) return CMD_ERROR;
Vehicle *v = Vehicle::Get(p1);
Vehicle *v = Vehicle::GetIfValid(p1);
if (v == NULL) return CMD_ERROR;
if (!CheckOwnership(v->owner)) return CMD_ERROR;
if (!v->IsInDepot()) return CMD_ERROR;
if (HASBITS(v->vehstatus, VS_CRASHED)) return CMD_ERROR;