summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortruelight <truelight@openttd.org>2006-08-26 17:16:51 +0000
committertruelight <truelight@openttd.org>2006-08-26 17:16:51 +0000
commit43f53ca4fd3c0d73cc8cd0ae6a86dd30a2c5e718 (patch)
tree6f8b3fc024528fc088a38079d9fcf7fc6dd59e45
parentb17d389667891df6a30cd29acae5405eb27d895e (diff)
downloadopenttd-43f53ca4fd3c0d73cc8cd0ae6a86dd30a2c5e718.tar.xz
(svn r6145) -Codechange: added OrderID to indicate Order indexes out of the pool
-rw-r--r--openttd.h1
-rw-r--r--order.h4
-rw-r--r--order_cmd.c2
3 files changed, 4 insertions, 3 deletions
diff --git a/openttd.h b/openttd.h
index 29d9d0c9d..0e1baf020 100644
--- a/openttd.h
+++ b/openttd.h
@@ -41,6 +41,7 @@ typedef uint16 TownID;
typedef uint16 IndustryID;
typedef uint16 DepotID;
typedef uint16 WaypointID;
+typedef uint16 OrderID;
typedef byte PlayerID;
typedef byte VehicleOrderID; ///< The index of an order within its current vehicle (not pool related)
typedef byte CargoID;
diff --git a/order.h b/order.h
index b76800b57..05107b25e 100644
--- a/order.h
+++ b/order.h
@@ -82,7 +82,7 @@ typedef struct Order {
struct Order *next; ///< Pointer to next order. If NULL, end of list
- uint16 index; ///< Index of the order, is not saved or anything, just for reference
+ OrderID index; ///< Index of the order, is not saved or anything, just for reference
} Order;
#define MAX_BACKUP_ORDER_COUNT 40
@@ -103,7 +103,7 @@ extern MemoryPool _order_pool;
/**
* Get the pointer to the order with index 'index'
*/
-static inline Order *GetOrder(uint index)
+static inline Order *GetOrder(OrderID index)
{
return (Order*)GetItemFromPool(&_order_pool, index);
}
diff --git a/order_cmd.c b/order_cmd.c
index fb6d26a99..68ed40e5f 100644
--- a/order_cmd.c
+++ b/order_cmd.c
@@ -118,7 +118,7 @@ static Order *AllocateOrder(void)
* TODO - This is just a temporary stage, this will be removed. */
for (order = GetOrder(0); order != NULL; order = (order->index + 1 < GetOrderPoolSize()) ? GetOrder(order->index + 1) : NULL) {
if (!IsValidOrder(order)) {
- uint index = order->index;
+ OrderID index = order->index;
memset(order, 0, sizeof(*order));
order->index = index;