2017-03-04 11:43:45 +00:00
|
|
|
/*
|
|
|
|
* 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 tunnel_base.h Base for all tunnels */
|
|
|
|
|
|
|
|
#ifndef TUNNEL_BASE_H
|
|
|
|
#define TUNNEL_BASE_H
|
|
|
|
|
|
|
|
#include "tunnel_map.h"
|
|
|
|
#include "core/pool_type.hpp"
|
|
|
|
|
|
|
|
struct Tunnel;
|
|
|
|
|
2017-03-04 23:49:55 +00:00
|
|
|
typedef Pool<Tunnel, TunnelID, 64, 1048576> TunnelPool;
|
2017-03-04 11:43:45 +00:00
|
|
|
extern TunnelPool _tunnel_pool;
|
|
|
|
|
|
|
|
struct Tunnel : TunnelPool::PoolItem<&_tunnel_pool> {
|
|
|
|
|
|
|
|
TileIndex tile_n; // North tile of tunnel.
|
|
|
|
TileIndex tile_s; // South tile of tunnel.
|
2017-03-05 14:32:17 +00:00
|
|
|
uint8 height; // Tunnel height
|
|
|
|
bool is_chunnel; // Whether this tunnel is a chunnel
|
2022-06-18 22:37:35 +00:00
|
|
|
uint8 style; // Style (new signals) of tunnel.
|
2017-03-04 11:43:45 +00:00
|
|
|
|
2017-03-04 12:36:01 +00:00
|
|
|
Tunnel() {}
|
2017-03-04 11:43:45 +00:00
|
|
|
~Tunnel();
|
|
|
|
|
2017-03-05 14:32:17 +00:00
|
|
|
Tunnel(TileIndex tile_n, TileIndex tile_s, uint8 height, bool is_chunnel) : tile_n(tile_n), tile_s(tile_s), height(height), is_chunnel(is_chunnel)
|
2017-03-04 23:49:55 +00:00
|
|
|
{
|
|
|
|
this->UpdateIndexes();
|
|
|
|
}
|
|
|
|
|
|
|
|
void UpdateIndexes();
|
|
|
|
|
2017-03-04 11:43:45 +00:00
|
|
|
static inline Tunnel *GetByTile(TileIndex tile)
|
|
|
|
{
|
|
|
|
return Tunnel::Get(GetTunnelIndex(tile));
|
|
|
|
}
|
2017-03-04 23:49:55 +00:00
|
|
|
|
|
|
|
static void PreCleanPool();
|
2017-03-04 11:43:45 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif /* TUNNEL_BASE_H */
|