diff options
author | rubidium <rubidium@openttd.org> | 2009-05-24 20:29:04 +0000 |
---|---|---|
committer | rubidium <rubidium@openttd.org> | 2009-05-24 20:29:04 +0000 |
commit | 0d99b6c71cd096599b4805d230483f3e4e958af1 (patch) | |
tree | 463b69c3b2ea6f697506be055622229767dfebc4 /src/ai | |
parent | 36e71c8df6fe1f4c303d98b609bb9cdd0c4b7e75 (diff) | |
download | openttd-0d99b6c71cd096599b4805d230483f3e4e958af1.tar.xz |
(svn r16421) -Codechange: do not unnecessarily remove constness or unnecessarily add it.
Diffstat (limited to 'src/ai')
-rw-r--r-- | src/ai/ai_info.cpp | 4 | ||||
-rw-r--r-- | src/ai/api/ai_vehicle.cpp | 14 |
2 files changed, 9 insertions, 9 deletions
diff --git a/src/ai/ai_info.cpp b/src/ai/ai_info.cpp index da9522d8d..2e6b052de 100644 --- a/src/ai/ai_info.cpp +++ b/src/ai/ai_info.cpp @@ -106,8 +106,8 @@ AIInfo::~AIInfo() { /* Free all allocated strings */ for (AIConfigItemList::iterator it = this->config_list.begin(); it != this->config_list.end(); it++) { - free((char *)(*it).name); - free((char *)(*it).description); + free((void*)(*it).name); + free((void*)(*it).description); if (it->labels != NULL) { for (LabelMapping::iterator it2 = (*it).labels->Begin(); it2 != (*it).labels->End(); it2++) { free(it2->second); 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; } |