summaryrefslogtreecommitdiff
path: root/src/ai/api
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2009-05-24 20:29:04 +0000
committerrubidium <rubidium@openttd.org>2009-05-24 20:29:04 +0000
commit0d99b6c71cd096599b4805d230483f3e4e958af1 (patch)
tree463b69c3b2ea6f697506be055622229767dfebc4 /src/ai/api
parent36e71c8df6fe1f4c303d98b609bb9cdd0c4b7e75 (diff)
downloadopenttd-0d99b6c71cd096599b4805d230483f3e4e958af1.tar.xz
(svn r16421) -Codechange: do not unnecessarily remove constness or unnecessarily add it.
Diffstat (limited to 'src/ai/api')
-rw-r--r--src/ai/api/ai_vehicle.cpp14
1 files changed, 7 insertions, 7 deletions
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;
}