summaryrefslogtreecommitdiff
path: root/src/roadveh.h
diff options
context:
space:
mode:
authormaedhros <maedhros@openttd.org>2007-06-11 14:00:16 +0000
committermaedhros <maedhros@openttd.org>2007-06-11 14:00:16 +0000
commit3e326085fa69da20e0a81182cbea4466016eb566 (patch)
tree890b370c5bc0ffbb3bd5a9eb55a4b0a3117acd29 /src/roadveh.h
parentbe0f5cf877bb2d7a74855f8988e50ca09624aabe (diff)
downloadopenttd-3e326085fa69da20e0a81182cbea4466016eb566.tar.xz
(svn r10097) -Feature: Add support for articulated road vehicles, or callbacks 11 and 17 for
road vehicles for those who prefer the technical explanation.
Diffstat (limited to 'src/roadveh.h')
-rw-r--r--src/roadveh.h43
1 files changed, 42 insertions, 1 deletions
diff --git a/src/roadveh.h b/src/roadveh.h
index f3c2f46d8..6547d7442 100644
--- a/src/roadveh.h
+++ b/src/roadveh.h
@@ -8,6 +8,42 @@
#include "vehicle.h"
+enum RoadVehicleSubType {
+ RVST_FRONT,
+ RVST_ARTIC_PART,
+};
+
+static inline bool IsRoadVehFront(const Vehicle *v)
+{
+ assert(v->type == VEH_ROAD);
+ return v->subtype == RVST_FRONT;
+}
+
+static inline void SetRoadVehFront(Vehicle *v)
+{
+ assert(v->type == VEH_ROAD);
+ v->subtype = RVST_FRONT;
+}
+
+static inline bool IsRoadVehArticPart(const Vehicle *v)
+{
+ assert(v->type == VEH_ROAD);
+ return v->subtype == RVST_ARTIC_PART;
+}
+
+static inline void SetRoadVehArticPart(Vehicle *v)
+{
+ assert(v->type == VEH_ROAD);
+ v->subtype = RVST_ARTIC_PART;
+}
+
+static inline bool RoadVehHasArticPart(const Vehicle *v)
+{
+ assert(v->type == VEH_ROAD);
+ return v->next != NULL && IsRoadVehArticPart(v->next);
+}
+
+
static inline bool IsRoadVehInDepot(const Vehicle* v)
{
assert(v->type == VEH_ROAD);
@@ -43,7 +79,12 @@ struct RoadVehicle : public Vehicle {
void UpdateDeltaXY(Direction direction);
ExpensesType GetExpenseType(bool income) const { return income ? EXPENSES_ROADVEH_INC : EXPENSES_ROADVEH_RUN; }
WindowClass GetVehicleListWindowClass() const { return WC_ROADVEH_LIST; }
- bool IsPrimaryVehicle() const { return true; }
+ bool IsPrimaryVehicle() const { return IsRoadVehFront(this); }
+ bool HasFront() const { return true; }
};
+byte GetRoadVehLength(const Vehicle *v);
+
+void RoadVehUpdateCache(Vehicle *v);
+
#endif /* ROADVEH_H */