summaryrefslogtreecommitdiff
path: root/src/vehicle_base.h
diff options
context:
space:
mode:
authorfrosch <frosch@openttd.org>2009-05-09 13:37:18 +0000
committerfrosch <frosch@openttd.org>2009-05-09 13:37:18 +0000
commit677ea100b37b036d88e75f7fd27bcd9f79e6425d (patch)
tree8a0b0c7b14307007ccff3bcdb57475ba2ebc20c5 /src/vehicle_base.h
parenta8aa4e2148747bc880ee430a1fc600767d1e0f89 (diff)
downloadopenttd-677ea100b37b036d88e75f7fd27bcd9f79e6425d.tar.xz
(svn r16260) -Codechange: Add Vehicle::IncrementOrderIndex() to deduplicate some code.
Diffstat (limited to 'src/vehicle_base.h')
-rw-r--r--src/vehicle_base.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/vehicle_base.h b/src/vehicle_base.h
index 9a224d2de..ca6666118 100644
--- a/src/vehicle_base.h
+++ b/src/vehicle_base.h
@@ -598,6 +598,16 @@ public:
* @return the cost of the depot action.
*/
CommandCost SendToDepot(DoCommandFlag flags, DepotCommand command);
+
+ /**
+ * Increments cur_order_index, keeps care of the wrap-around and invalidates the GUI.
+ * Note: current_order is not invalidated.
+ */
+ void IncrementOrderIndex() {
+ this->cur_order_index++;
+ if (this->cur_order_index >= this->GetNumOrders()) this->cur_order_index = 0;
+ InvalidateVehicleOrder(this, 0);
+ }
};
/**