--- a/src/roadveh_cmd.cpp Sun Sep 09 21:14:29 2007 +0000
+++ b/src/roadveh_cmd.cpp Sun Sep 23 07:37:38 2007 +0000
@@ -180,11 +180,11 @@
if (HASBIT(GetRoadTypes(tile), ROADTYPE_TRAM) != HASBIT(EngInfo(p1)->misc_flags, EF_ROAD_TRAM)) return_cmd_error(STR_DEPOT_WRONG_DEPOT_TYPE);
- uint num_vehicles = 1 + CountArticulatedParts(p1);
+ uint num_vehicles = 1 + CountArticulatedParts(p1, false);
- /* Allow for the front and up to 10 articulated parts. */
- Vehicle *vl[11];
- memset(&vl, 0, sizeof(vl));
+ /* Allow for the front and the articulated parts, plus one to "terminate" the list. */
+ Vehicle **vl = (Vehicle**)alloca(sizeof(*vl) * (num_vehicles + 1));
+ memset(vl, 0, sizeof(*vl) * (num_vehicles + 1));
if (!Vehicle::AllocateList(vl, num_vehicles)) {
return_cmd_error(STR_00E1_TOO_MANY_VEHICLES_IN_GAME);
@@ -478,6 +478,7 @@
* Now we change the setting to apply the new one and let the vehicle head for the same depot.
* Note: the if is (true for requesting service == true for ordered to stop in depot) */
if (flags & DC_EXEC) {
+ CLRBIT(v->current_order.flags, OFB_PART_OF_ORDERS);
TOGGLEBIT(v->current_order.flags, OFB_HALT_IN_DEPOT);
InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, STATUS_BAR);
}