(svn r8874) [0.5] -Backport from trunk (r8744, r8685):

- Call GetFirstVehicleInChain only for trains thus increasing performance in large games (r8744)
 - (Feature) Selecting "end of orders" and deleting will delete all the vehicle's orders (in unshared mode, shared is unchanged) (r8685)
This commit is contained in:
Darkvater 2007-02-24 01:47:26 +00:00
parent 1cdfa87b21
commit 3b2bcbf0f0
3 changed files with 3 additions and 2 deletions

View File

@ -1031,7 +1031,7 @@ static void DoTriggerVehicle(Vehicle *v, VehicleTrigger trigger, byte base_rando
* i.e.), so we give them all the NEW_CARGO triggered
* vehicle's portion of random bits. */
assert(first);
DoTriggerVehicle(GetFirstVehicleInChain(v), VEHICLE_TRIGGER_ANY_NEW_CARGO, new_random_bits, false);
DoTriggerVehicle((v->type == VEH_Train) ? GetFirstVehicleInChain(v) : v, VEHICLE_TRIGGER_ANY_NEW_CARGO, new_random_bits, false);
break;
case VEHICLE_TRIGGER_DEPOT:

View File

@ -76,7 +76,7 @@ static void DrawOrdersWindow(Window *w)
/* delete */
SetWindowWidgetDisabledState(w, 5,
(uint)v->num_orders + (shared_orders ? 1 : 0) <= (uint)WP(w, order_d).sel);
(uint)v->num_orders + ((shared_orders || v->num_orders != 0) ? 1 : 0) <= (uint)WP(w, order_d).sel);
/* non-stop only for trains */
SetWindowWidgetDisabledState(w, 6, v->type != VEH_Train || order == NULL);

View File

@ -514,6 +514,7 @@ Vehicle *GetFirstVehicleInChain(const Vehicle *v)
Vehicle* u;
assert(v != NULL);
assert(v->type == VEH_Train);
if (v->first != NULL) {
if (IsFrontEngine(v->first) || IsFreeWagon(v->first)) return v->first;