author | richk |
Tue, 17 Jun 2008 13:22:13 +0000 | |
branch | NewGRF_ports |
changeset 10994 | cd9968b6f96b |
parent 10724 | 68a692eacf22 |
permissions | -rw-r--r-- |
10242
52b4a9006029
(svn r12774) [NewGRF_ports] -Sync: with trunk r12742:12772.
richk
parents:
diff
changeset
|
1 |
/* $Id$ */ |
52b4a9006029
(svn r12774) [NewGRF_ports] -Sync: with trunk r12742:12772.
richk
parents:
diff
changeset
|
2 |
|
10724
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
3 |
/** @file depot_base.h Base for all depots (except hangars) */ |
10242
52b4a9006029
(svn r12774) [NewGRF_ports] -Sync: with trunk r12742:12772.
richk
parents:
diff
changeset
|
4 |
|
52b4a9006029
(svn r12774) [NewGRF_ports] -Sync: with trunk r12742:12772.
richk
parents:
diff
changeset
|
5 |
#ifndef DEPOT_BASE_H |
52b4a9006029
(svn r12774) [NewGRF_ports] -Sync: with trunk r12742:12772.
richk
parents:
diff
changeset
|
6 |
#define DEPOT_BASE_H |
52b4a9006029
(svn r12774) [NewGRF_ports] -Sync: with trunk r12742:12772.
richk
parents:
diff
changeset
|
7 |
|
52b4a9006029
(svn r12774) [NewGRF_ports] -Sync: with trunk r12742:12772.
richk
parents:
diff
changeset
|
8 |
#include "tile_type.h" |
52b4a9006029
(svn r12774) [NewGRF_ports] -Sync: with trunk r12742:12772.
richk
parents:
diff
changeset
|
9 |
#include "depot_type.h" |
52b4a9006029
(svn r12774) [NewGRF_ports] -Sync: with trunk r12742:12772.
richk
parents:
diff
changeset
|
10 |
#include "oldpool.h" |
52b4a9006029
(svn r12774) [NewGRF_ports] -Sync: with trunk r12742:12772.
richk
parents:
diff
changeset
|
11 |
#include "town_type.h" |
52b4a9006029
(svn r12774) [NewGRF_ports] -Sync: with trunk r12742:12772.
richk
parents:
diff
changeset
|
12 |
|
52b4a9006029
(svn r12774) [NewGRF_ports] -Sync: with trunk r12742:12772.
richk
parents:
diff
changeset
|
13 |
DECLARE_OLD_POOL(Depot, Depot, 3, 8000) |
52b4a9006029
(svn r12774) [NewGRF_ports] -Sync: with trunk r12742:12772.
richk
parents:
diff
changeset
|
14 |
|
52b4a9006029
(svn r12774) [NewGRF_ports] -Sync: with trunk r12742:12772.
richk
parents:
diff
changeset
|
15 |
struct Depot : PoolItem<Depot, DepotID, &_Depot_pool> { |
52b4a9006029
(svn r12774) [NewGRF_ports] -Sync: with trunk r12742:12772.
richk
parents:
diff
changeset
|
16 |
TileIndex xy; |
52b4a9006029
(svn r12774) [NewGRF_ports] -Sync: with trunk r12742:12772.
richk
parents:
diff
changeset
|
17 |
TownID town_index; |
52b4a9006029
(svn r12774) [NewGRF_ports] -Sync: with trunk r12742:12772.
richk
parents:
diff
changeset
|
18 |
|
52b4a9006029
(svn r12774) [NewGRF_ports] -Sync: with trunk r12742:12772.
richk
parents:
diff
changeset
|
19 |
Depot(TileIndex xy = 0) : xy(xy) {} |
52b4a9006029
(svn r12774) [NewGRF_ports] -Sync: with trunk r12742:12772.
richk
parents:
diff
changeset
|
20 |
~Depot(); |
52b4a9006029
(svn r12774) [NewGRF_ports] -Sync: with trunk r12742:12772.
richk
parents:
diff
changeset
|
21 |
|
52b4a9006029
(svn r12774) [NewGRF_ports] -Sync: with trunk r12742:12772.
richk
parents:
diff
changeset
|
22 |
inline bool IsValid() const { return this->xy != 0; } |
52b4a9006029
(svn r12774) [NewGRF_ports] -Sync: with trunk r12742:12772.
richk
parents:
diff
changeset
|
23 |
}; |
52b4a9006029
(svn r12774) [NewGRF_ports] -Sync: with trunk r12742:12772.
richk
parents:
diff
changeset
|
24 |
|
52b4a9006029
(svn r12774) [NewGRF_ports] -Sync: with trunk r12742:12772.
richk
parents:
diff
changeset
|
25 |
static inline bool IsValidDepotID(DepotID index) |
52b4a9006029
(svn r12774) [NewGRF_ports] -Sync: with trunk r12742:12772.
richk
parents:
diff
changeset
|
26 |
{ |
52b4a9006029
(svn r12774) [NewGRF_ports] -Sync: with trunk r12742:12772.
richk
parents:
diff
changeset
|
27 |
return index < GetDepotPoolSize() && GetDepot(index)->IsValid(); |
52b4a9006029
(svn r12774) [NewGRF_ports] -Sync: with trunk r12742:12772.
richk
parents:
diff
changeset
|
28 |
} |
52b4a9006029
(svn r12774) [NewGRF_ports] -Sync: with trunk r12742:12772.
richk
parents:
diff
changeset
|
29 |
|
52b4a9006029
(svn r12774) [NewGRF_ports] -Sync: with trunk r12742:12772.
richk
parents:
diff
changeset
|
30 |
Depot *GetDepotByTile(TileIndex tile); |
52b4a9006029
(svn r12774) [NewGRF_ports] -Sync: with trunk r12742:12772.
richk
parents:
diff
changeset
|
31 |
|
52b4a9006029
(svn r12774) [NewGRF_ports] -Sync: with trunk r12742:12772.
richk
parents:
diff
changeset
|
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()) |
52b4a9006029
(svn r12774) [NewGRF_ports] -Sync: with trunk r12742:12772.
richk
parents:
diff
changeset
|
33 |
#define FOR_ALL_DEPOTS(d) FOR_ALL_DEPOTS_FROM(d, 0) |
52b4a9006029
(svn r12774) [NewGRF_ports] -Sync: with trunk r12742:12772.
richk
parents:
diff
changeset
|
34 |
|
52b4a9006029
(svn r12774) [NewGRF_ports] -Sync: with trunk r12742:12772.
richk
parents:
diff
changeset
|
35 |
#endif /* DEPOT_BASE_H */ |