depot.h
changeset 1718 96d76767ea93
parent 1650 4a5141e10b72
child 1790 47963a0cfca3
equal deleted inserted replaced
1717:44bff152f15f 1718:96d76767ea93
    26 static inline uint16 GetDepotPoolSize(void)
    26 static inline uint16 GetDepotPoolSize(void)
    27 {
    27 {
    28 	return _depot_pool.total_items;
    28 	return _depot_pool.total_items;
    29 }
    29 }
    30 
    30 
       
    31 static inline bool IsDepotIndex(uint index)
       
    32 {
       
    33 	return index < GetDepotPoolSize();
       
    34 }
       
    35 
    31 #define FOR_ALL_DEPOTS_FROM(d, start) for (d = GetDepot(start); d != NULL; d = (d->index + 1 < GetDepotPoolSize()) ? GetDepot(d->index + 1) : NULL)
    36 #define FOR_ALL_DEPOTS_FROM(d, start) for (d = GetDepot(start); d != NULL; d = (d->index + 1 < GetDepotPoolSize()) ? GetDepot(d->index + 1) : NULL)
    32 #define FOR_ALL_DEPOTS(d) FOR_ALL_DEPOTS_FROM(d, 0)
    37 #define FOR_ALL_DEPOTS(d) FOR_ALL_DEPOTS_FROM(d, 0)
    33 
    38 
    34 #define MIN_SERVINT_PERCENT  5
    39 #define MIN_SERVINT_PERCENT  5
    35 #define MAX_SERVINT_PERCENT 90
    40 #define MAX_SERVINT_PERCENT 90
    42 VARDEF TileIndex _last_built_ship_depot_tile;
    47 VARDEF TileIndex _last_built_ship_depot_tile;
    43 
    48 
    44 /**
    49 /**
    45  * Check if a depot really exists.
    50  * Check if a depot really exists.
    46  */
    51  */
    47 static inline bool IsValidDepot(Depot* depot)
    52 static inline bool IsValidDepot(const Depot* depot)
    48 {
    53 {
    49 	return depot->xy != 0; /* XXX: Replace by INVALID_TILE someday */
    54 	return depot->xy != 0; /* XXX: Replace by INVALID_TILE someday */
    50 }
    55 }
    51 
    56 
    52 /**
    57 /**