diff options
author | matthijs <matthijs@openttd.org> | 2006-12-05 13:58:20 +0000 |
---|---|---|
committer | matthijs <matthijs@openttd.org> | 2006-12-05 13:58:20 +0000 |
commit | 9218fc16e6fff350e6209b6b90b8597fc431f00f (patch) | |
tree | e23ebc401e3e8f7037ad38701e00a6bf1fb61136 /vehicle.c | |
parent | 681f994d16a71813144352b3a6ef05a22cb8b3ff (diff) | |
download | openttd-9218fc16e6fff350e6209b6b90b8597fc431f00f.tar.xz |
(svn r7372) - CodeChange: Rename all GetXXXArraySize() functions to GetNumXXX() and add GetMaxXXXIndex() functions. This prepares for the new pool interface.
Diffstat (limited to 'vehicle.c')
-rw-r--r-- | vehicle.c | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -2248,7 +2248,7 @@ static int32 MaybeReplaceVehicle(Vehicle *v, bool check, bool display_costs) /* Extend the list size for BuildDepotVehicleList() */ static inline void ExtendVehicleListSize(const Vehicle ***engine_list, uint16 *engine_list_length, uint16 step_size) { - *engine_list_length = min(*engine_list_length + step_size, GetVehicleArraySize()); + *engine_list_length = min(*engine_list_length + step_size, GetMaxVehicleIndex() + 1); *engine_list = realloc((void*)*engine_list, (*engine_list_length) * sizeof((*engine_list)[0])); } @@ -2391,7 +2391,7 @@ uint GenerateVehicleSortList(const Vehicle ***sort_list, uint16 *length_of_array (type == VEH_Train && IsFrontEngine(v)) || (type != VEH_Train && v->subtype <= subtype))) { /* TODO find a better estimate on the total number of vehicles for current player */ - if (n == *length_of_array) ExtendVehicleListSize(sort_list, length_of_array, GetVehicleArraySize()/4); + if (n == *length_of_array) ExtendVehicleListSize(sort_list, length_of_array, GetNumVehicles()/4); (*sort_list)[n++] = v; } } |