author | glx |
Sun, 15 Jun 2008 22:56:43 +0000 | |
branch | noai |
changeset 10973 | 8577bc56132c |
parent 10455 | 22c441f5adf9 |
permissions | -rw-r--r-- |
10249 | 1 |
/* $Id$ */ |
2 |
||
10455
22c441f5adf9
(svn r12997) [NoAI] -Sync: with trunk r12895:12996.
rubidium
parents:
10249
diff
changeset
|
3 |
/** @file depot_base.h Base for all depots (except hangars) */ |
10249 | 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 */ |