4 * This file is part of OpenTTD.
5 * 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.
6 * 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.
7 * 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/>.
10 /** @file dock.cpp Implementation of the dock base class. */
13 #include "core/pool_func.hpp"
14 #include "dock_base.h"
15 #include "station_base.h"
17 /** The pool of docks. */
18 DockPool
_dock_pool("Dock");
19 INSTANTIATE_POOL_METHODS(Dock
)
22 * Find a dock at a given tile.
23 * @param tile Tile with a dock.
24 * @return The dock in the given tile.
27 /* static */ Dock
*Dock::GetByTile(TileIndex tile
)
29 const Station
*st
= Station::GetByTile(tile
);
31 for (Dock
*d
= st
->GetPrimaryDock();; d
= d
->next
) {
32 if (d
->sloped
== tile
|| d
->flat
== tile
) return d
;
33 assert(d
->next
!= nullptr);