equal
deleted
inserted
replaced
|
1 /* $Id$ */ |
|
2 |
|
3 /** @file depot.h Base for all depots (except hangars) */ |
|
4 |
|
5 #ifndef DEPOT_BASE_H |
|
6 #define DEPOT_BASE_H |
|
7 |
|
8 #include "tile_type.h" |
|
9 #include "depot_type.h" |
|
10 #include "oldpool.h" |
|
11 #include "town_type.h" |
|
12 |
|
13 DECLARE_OLD_POOL(Depot, Depot, 3, 8000) |
|
14 |
|
15 struct Depot : PoolItem<Depot, DepotID, &_Depot_pool> { |
|
16 TileIndex xy; |
|
17 TownID town_index; |
|
18 |
|
19 Depot(TileIndex xy = 0) : xy(xy) {} |
|
20 ~Depot(); |
|
21 |
|
22 inline bool IsValid() const { return this->xy != 0; } |
|
23 }; |
|
24 |
|
25 static inline bool IsValidDepotID(DepotID index) |
|
26 { |
|
27 return index < GetDepotPoolSize() && GetDepot(index)->IsValid(); |
|
28 } |
|
29 |
|
30 Depot *GetDepotByTile(TileIndex tile); |
|
31 |
|
32 #define FOR_ALL_DEPOTS_FROM(d, start) for (d = GetDepot(start); d != NULL; d = (d->index + 1U < GetDepotPoolSize()) ? GetDepot(d->index + 1U) : NULL) if (d->IsValid()) |
|
33 #define FOR_ALL_DEPOTS(d) FOR_ALL_DEPOTS_FROM(d, 0) |
|
34 |
|
35 #endif /* DEPOT_BASE_H */ |