(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 1eca6aefeb
commit 512db5248e
35 changed files with 201 additions and 305 deletions

View File

@@ -19,9 +19,8 @@
/* static */ bool AIVehicle::IsValidVehicle(VehicleID vehicle_id)
{
if (!::Vehicle::IsValidID(vehicle_id)) return false;
const Vehicle *v = ::Vehicle::Get(vehicle_id);
return v->owner == _current_company && (v->IsPrimaryVehicle() || (v->type == VEH_TRAIN && ::IsFreeWagon(v)));
const Vehicle *v = ::Vehicle::GetIfValid(vehicle_id);
return v != NULL && v->owner == _current_company && (v->IsPrimaryVehicle() || (v->type == VEH_TRAIN && ::IsFreeWagon(v)));
}
/* static */ int32 AIVehicle::GetNumWagons(VehicleID vehicle_id)