summaryrefslogtreecommitdiff
path: root/vehicle.h
diff options
context:
space:
mode:
authorCelestar <celestar@openttd.org>2004-12-08 15:26:57 +0000
committerCelestar <celestar@openttd.org>2004-12-08 15:26:57 +0000
commit6fd3fc10e347695b28c8b3d1e0074b5456cd8100 (patch)
tree98602eb5f4d3563f2c7af9080465d5bd94904fe8 /vehicle.h
parent547a2d1f9ff267bec683eae211a4b1070afd27f4 (diff)
downloadopenttd-6fd3fc10e347695b28c8b3d1e0074b5456cd8100.tar.xz
(svn r978) Fixed an endianess issue with the new Order system. Thanks to Bjarni, Oskar and Tron
Diffstat (limited to 'vehicle.h')
-rw-r--r--vehicle.h14
1 files changed, 9 insertions, 5 deletions
diff --git a/vehicle.h b/vehicle.h
index 596882eeb..178a77635 100644
--- a/vehicle.h
+++ b/vehicle.h
@@ -4,8 +4,13 @@
#include "vehicle_gui.h"
typedef struct Order {
+#ifdef TTD_LITTLE_ENDIAN /* XXX hack to avoid savegame revision bump */
uint8 type:4;
uint8 flags:4;
+#else
+ uint8 flags:4;
+ uint8 type:4;
+#endif
uint8 station;
} Order;
@@ -16,11 +21,10 @@ static inline uint16 PackOrder(const Order *order)
static inline Order UnpackOrder(uint16 packed)
{
- Order order = {
- (packed & 0x000f),
- (packed & 0x00f0) >> 4,
- (packed & 0xff00) >> 8
- };
+ Order order;
+ order.type = (packed & 0x000f);
+ order.flags = (packed & 0x00f0) >> 4,
+ order.station = (packed & 0xff00) >> 8;
return order;
}