(svn r16527) -Codechange: use static member functions instead of simple casts when converting Vehicle to specialised vehicle types. Includes safety check

This commit is contained in:
smatz
2009-06-06 16:54:22 +00:00
parent c90819ff6d
commit 0c10006907
36 changed files with 185 additions and 161 deletions

View File

@@ -313,9 +313,8 @@ static bool DisasterTick_Ufo(DisasterVehicle *v)
return false;
} else {
/* Target a vehicle */
Vehicle *u_tmp = Vehicle::Get(v->dest_tile);
assert(u_tmp != NULL && u_tmp->type == VEH_ROAD && IsRoadVehFront(u_tmp));
RoadVehicle *u = (RoadVehicle *)u_tmp;
RoadVehicle *u = RoadVehicle::Get(v->dest_tile);
assert(u != NULL && u->type == VEH_ROAD && IsRoadVehFront(u));
uint dist = Delta(v->x_pos, u->x_pos) + Delta(v->y_pos, u->y_pos);