From 0d99b6c71cd096599b4805d230483f3e4e958af1 Mon Sep 17 00:00:00 2001 From: rubidium Date: Sun, 24 May 2009 20:29:04 +0000 Subject: (svn r16421) -Codechange: do not unnecessarily remove constness or unnecessarily add it. --- src/ai/api/ai_vehicle.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'src/ai/api') diff --git a/src/ai/api/ai_vehicle.cpp b/src/ai/api/ai_vehicle.cpp index 6df24b875..fb6c8abdc 100644 --- a/src/ai/api/ai_vehicle.cpp +++ b/src/ai/api/ai_vehicle.cpp @@ -45,11 +45,11 @@ case VEH_ROAD: { uint total_length = 0; for (const Vehicle *u = v; u != NULL; u = u->Next()) { - total_length += ((RoadVehicle*)u)->rcache.cached_veh_length; + total_length += ((const RoadVehicle *)u)->rcache.cached_veh_length; } return total_length; } - case VEH_TRAIN: return ((Train *)v)->tcache.cached_total_length; + case VEH_TRAIN: return ((const Train *)v)->tcache.cached_total_length; default: return -1; } } @@ -85,11 +85,11 @@ EnforcePrecondition(false, ::Vehicle::Get(source_vehicle_id)->type == VEH_TRAIN); EnforcePrecondition(false, dest_vehicle_id == -1 || ::Vehicle::Get(dest_vehicle_id)->type == VEH_TRAIN); - const Train *v = (Train *)::Vehicle::Get(source_vehicle_id); + const Train *v = (const Train *)::Vehicle::Get(source_vehicle_id); while (source_wagon-- > 0) v = GetNextUnit(v); const Train *w = NULL; if (dest_vehicle_id != -1) { - w = (Train *)::Vehicle::Get(dest_vehicle_id); + w = (const Train *)::Vehicle::Get(dest_vehicle_id); while (dest_wagon-- > 0) w = GetNextUnit(w); } @@ -136,7 +136,7 @@ EnforcePrecondition(false, IsValidVehicle(vehicle_id) && wagon < GetNumWagons(vehicle_id)); EnforcePrecondition(false, ::Vehicle::Get(vehicle_id)->type == VEH_TRAIN); - const Train *v = (Train *)::Vehicle::Get(vehicle_id); + const Train *v = (const Train *)::Vehicle::Get(vehicle_id); while (wagon-- > 0) v = GetNextUnit(v); return AIObject::DoCommand(0, v->index, sell_attached_wagons ? 1 : 0, CMD_SELL_RAIL_WAGON); @@ -243,7 +243,7 @@ const Vehicle *v = ::Vehicle::Get(vehicle_id); if (v->type == VEH_TRAIN) { - while (wagon-- > 0) v = GetNextUnit((Train *)v); + while (wagon-- > 0) v = GetNextUnit((const Train *)v); } return v->engine_type; } @@ -281,7 +281,7 @@ const Vehicle *v = ::Vehicle::Get(vehicle_id); if (v->type == VEH_TRAIN) { - while (wagon-- > 0) v = GetNextUnit((Train *)v); + while (wagon-- > 0) v = GetNextUnit((const Train *)v); } return v->age; } -- cgit v1.2.3-70-g09d2