mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-01-18 21:18:10 +00:00
(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:
parent
1cdfa87b21
commit
3b2bcbf0f0
@ -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
|
* i.e.), so we give them all the NEW_CARGO triggered
|
||||||
* vehicle's portion of random bits. */
|
* vehicle's portion of random bits. */
|
||||||
assert(first);
|
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;
|
break;
|
||||||
|
|
||||||
case VEHICLE_TRIGGER_DEPOT:
|
case VEHICLE_TRIGGER_DEPOT:
|
||||||
|
@ -76,7 +76,7 @@ static void DrawOrdersWindow(Window *w)
|
|||||||
|
|
||||||
/* delete */
|
/* delete */
|
||||||
SetWindowWidgetDisabledState(w, 5,
|
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 */
|
/* non-stop only for trains */
|
||||||
SetWindowWidgetDisabledState(w, 6, v->type != VEH_Train || order == NULL);
|
SetWindowWidgetDisabledState(w, 6, v->type != VEH_Train || order == NULL);
|
||||||
|
@ -514,6 +514,7 @@ Vehicle *GetFirstVehicleInChain(const Vehicle *v)
|
|||||||
Vehicle* u;
|
Vehicle* u;
|
||||||
|
|
||||||
assert(v != NULL);
|
assert(v != NULL);
|
||||||
|
assert(v->type == VEH_Train);
|
||||||
|
|
||||||
if (v->first != NULL) {
|
if (v->first != NULL) {
|
||||||
if (IsFrontEngine(v->first) || IsFreeWagon(v->first)) return v->first;
|
if (IsFrontEngine(v->first) || IsFreeWagon(v->first)) return v->first;
|
||||||
|
Loading…
Reference in New Issue
Block a user