Allow building multiple docks per station.

(cherry picked from commit 0110c4a35d383e0be2cbb53cbe9cbe6784abb3e9)

# Conflicts:
#	src/station_cmd.cpp
This commit is contained in:
keldorkatarn
2017-09-11 22:48:19 +02:00
committed by Jonathan G Rennison
parent d486d58d86
commit 1d3cf59d8a
26 changed files with 412 additions and 62 deletions

40
src/dock_base.h Normal file
View File

@@ -0,0 +1,40 @@
/* $Id: dock_base.h $ */
/*
* This file is part of OpenTTD.
* OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
* OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
*/
/** @file dock_base.h Base class for docks. */
#ifndef DOCK_BASE_H
#define DOCK_BASE_H
#include "station_type.h"
#include "tile_type.h"
#include "core/pool_type.hpp"
typedef Pool<Dock, DockID, 32, 64000> DockPool;
extern DockPool _dock_pool;
/** A Dock structure. */
struct Dock : DockPool::PoolItem<&_dock_pool> {
TileIndex sloped; ///< The sloped tile of the dock.
TileIndex flat; ///< Position on the map of the flat tile.
Dock *next; ///< Next dock of the given type at this station.
Dock(TileIndex s = INVALID_TILE, TileIndex f = INVALID_TILE) : sloped(s), flat(f), next(NULL) { }
~Dock() {}
inline Dock *GetNextDock() const { return this->next; }
static Dock *GetByTile(TileIndex tile);
};
#define FOR_ALL_DOCKS_FROM(var, start) FOR_ALL_ITEMS_FROM(Dock, dock_index, var, start)
#define FOR_ALL_DOCKS(var) FOR_ALL_DOCKS_FROM(var, 0)
#endif /* DOCK_BASE_H */