summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbjarni <bjarni@openttd.org>2006-10-10 20:11:48 +0000
committerbjarni <bjarni@openttd.org>2006-10-10 20:11:48 +0000
commit7954b834dfd5dcf1fdeeaa8c6c1c8c5728420b0c (patch)
tree6edbdd23a62d3b949fa70b72e428d5f8418a5750
parenta007c967c1004f54209d3220a8435c303ff3a419 (diff)
downloadopenttd-7954b834dfd5dcf1fdeeaa8c6c1c8c5728420b0c.tar.xz
(svn r6729) -Fix r6707: [build aircraft window] solved a crash when using a grf set with a buildable helicopter with a lower EngineID than the first buildable plane
Also removed a lot of const cast as they mess up the code and didn't help much
-rw-r--r--build_vehicle_gui.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/build_vehicle_gui.c b/build_vehicle_gui.c
index 6fb3d0828..002e69429 100644
--- a/build_vehicle_gui.c
+++ b/build_vehicle_gui.c
@@ -286,7 +286,7 @@ void CcBuildAircraft(bool success, TileIndex tile, uint32 p1, uint32 p2)
}
}
-static inline void ExtendEngineListSize(const EngineID **engine_list, uint16 *engine_list_length, uint16 step_size, uint16 max)
+static inline void ExtendEngineListSize(EngineID **engine_list, uint16 *engine_list_length, uint16 step_size, uint16 max)
{
*engine_list_length = min(*engine_list_length + step_size, max);
*engine_list = realloc((void*)*engine_list, (*engine_list_length) * sizeof((*engine_list)[0]));
@@ -310,17 +310,17 @@ static void GenerateBuildAircraftList(EngineID **planes, uint16 *num_planes, Eng
switch (avi->subtype) {
case AIR_CTOL: // Propeller planes
- if (*num_planes == plane_length) ExtendEngineListSize((const EngineID**)planes, &plane_length, 5, NUM_AIRCRAFT_ENGINES);
+ if (*num_planes == plane_length) ExtendEngineListSize(planes, &plane_length, 5, NUM_AIRCRAFT_ENGINES);
(*planes)[(*num_planes)++] = eid;
break;
case (AIR_CTOL | AIR_FAST): // Jet planes
- if (*num_jets == jet_length) ExtendEngineListSize((const EngineID**)jets, &jet_length, 5, NUM_AIRCRAFT_ENGINES);
+ if (*num_jets == jet_length) ExtendEngineListSize(jets, &jet_length, 5, NUM_AIRCRAFT_ENGINES);
(*jets)[(*num_jets)++] = eid;
break;
case 0: // Helicopters
- if (*num_helicopters == helicopter_length) ExtendEngineListSize((const EngineID**)helicopters, &plane_length, 5, NUM_AIRCRAFT_ENGINES);
+ if (*num_helicopters == helicopter_length) ExtendEngineListSize(helicopters, &helicopter_length, 5, NUM_AIRCRAFT_ENGINES);
(*helicopters)[(*num_helicopters)++] = eid;
break;
}