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

37
src/dock.cpp Normal file
View File

@@ -0,0 +1,37 @@
/* $Id: dock.cpp $ */
/*
* 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.cpp Implementation of the dock base class. */
#include "stdafx.h"
#include "core/pool_func.hpp"
#include "dock_base.h"
#include "station_base.h"
/** The pool of docks. */
DockPool _dock_pool("Dock");
INSTANTIATE_POOL_METHODS(Dock)
/**
* Find a dock at a given tile.
* @param tile Tile with a dock.
* @return The dock in the given tile.
* @pre IsDockTile()
*/
/* static */ Dock *Dock::GetByTile(TileIndex tile)
{
const Station *st = Station::GetByTile(tile);
for (Dock *d = st->GetPrimaryDock();; d = d->next) {
if (d->sloped == tile || d->flat == tile) return d;
assert(d->next != NULL);
}
NOT_REACHED();
}