forked from mirror/OpenTTD
(svn r6353) -Codechange: Make DestinationID a typedef of uin16, which is as large as any type of destinataion (StationID, DepotID, WaypointID) it can hold
DestinationID being a union of these types is just hassle without benefit and cannot be handled correctly everywhere because of local lack of information
This commit is contained in:
20
openttd.h
20
openttd.h
@@ -57,20 +57,14 @@ typedef uint16 WaypointID;
|
||||
typedef uint16 OrderID;
|
||||
typedef uint16 SignID;
|
||||
typedef uint16 EngineRenewID;
|
||||
typedef uint16 DestinationID;
|
||||
|
||||
typedef union DestinationID {
|
||||
StationID station;
|
||||
DepotID depot;
|
||||
WaypointID waypoint;
|
||||
uint16 disaster; ///< Please don't ask about it, but disasters uses orders to store stuff...
|
||||
} DestinationID;
|
||||
|
||||
/* All items of DestinationID has to be of the same size, because some part
|
||||
* of the code depends on the fact that DestinationID is the same for all
|
||||
* items inside DestinationID. Check PackOrder() */
|
||||
assert_compile(sizeof(StationID) == sizeof(DepotID));
|
||||
assert_compile(sizeof(StationID) == sizeof(WaypointID));
|
||||
assert_compile(sizeof(StationID) == sizeof(uint16));
|
||||
/* DestinationID must be at least as large as every these below, because it can
|
||||
* be any of them
|
||||
*/
|
||||
assert_compile(sizeof(DestinationID) == sizeof(DepotID));
|
||||
assert_compile(sizeof(DestinationID) == sizeof(WaypointID));
|
||||
assert_compile(sizeof(DestinationID) == sizeof(StationID));
|
||||
|
||||
typedef uint32 WindowNumber;
|
||||
typedef byte WindowClass;
|
||||
|
Reference in New Issue
Block a user