src/depot_base.h
author translators
Sun, 30 Nov 2008 18:46:32 +0000
changeset 10395 6fe57f7c5d8d
parent 9111 48ce04029fe4
permissions -rw-r--r--
(svn r14646) -Update: WebTranslator2 update to 2008-11-30 18:46:24
esperanto - 4 fixed by Athaba (4)
finnish - 1 changed by SuomiPoika (1)
indonesian - 16 fixed, 4 changed by fanioz (20)
korean - 1 fixed by dlunch (1)
lithuanian - 57 fixed, 20 changed by Enternald (77)
macedonian - 140 fixed, 1 changed by simonkoco (34), zharko (107)
persian - 21 fixed by ali sattari (21)
serbian - 5 fixed by dejac (5)
/* $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 */