summaryrefslogtreecommitdiff
path: root/src/tunnel_base.h
blob: 4a2493fa7fdf495b6db24a9ced2a35a67e79a5f9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
/* $Id$ */

/*
 * 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;

typedef Pool<Tunnel, TunnelID, 64, 64000> TunnelPool;
extern TunnelPool _tunnel_pool;

struct Tunnel : TunnelPool::PoolItem<&_tunnel_pool> {

	TileIndex tile_n; // North tile of tunnel.
	TileIndex tile_s; // South tile of tunnel.
	bool is_chunnel;

	Tunnel() {}
	Tunnel(TileIndex tile_n, TileIndex tile_s, bool is_chunnel) : tile_n(tile_n), tile_s(tile_s), is_chunnel(is_chunnel) {}
	~Tunnel();

	static inline Tunnel *GetByTile(TileIndex tile)
	{
		return Tunnel::Get(GetTunnelIndex(tile));
	}
};

#endif /* TUNNEL_BASE_H */