src/depot_base.h
author translators
Fri, 28 Nov 2008 18:47:49 +0000
changeset 10389 05465e8a465c
parent 9111 48ce04029fe4
permissions -rw-r--r--
(svn r14640) -Update: WebTranslator2 update to 2008-11-28 18:47:35
bulgarian - 1 fixed by Ar4i (1)
catalan - 1 fixed by arnaullv (1)
croatian - 43 fixed by knovak (43)
esperanto - 3 fixed by Athaba (3)
estonian - 8 fixed by t2t2 (8)
german - 1 fixed by Athaba (1)
latvian - 315 fixed, 112 changed by Reinis (414), yopzer (7), niko (6)
polish - 1 fixed by xaxa (1)
romanian - 6 fixed, 1 changed by kkmic (7)
ukrainian - 2 fixed by mad (2)
/* $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 */