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