Chunnel: Adjust struct Tunnel constructor
This commit is contained in:
@@ -2040,9 +2040,7 @@ bool AfterLoadGame()
|
|||||||
|
|
||||||
if (!Tunnel::CanAllocateItem()) return false;
|
if (!Tunnel::CanAllocateItem()) return false;
|
||||||
|
|
||||||
Tunnel *t = new Tunnel(start_tile);
|
const Tunnel *t = new Tunnel(start_tile, end_tile, false);
|
||||||
t->tile_s = end_tile;
|
|
||||||
t->is_chunnel = 0;
|
|
||||||
|
|
||||||
_m[start_tile].m2 = t->index;
|
_m[start_tile].m2 = t->index;
|
||||||
_m[end_tile].m2 = t->index;
|
_m[end_tile].m2 = t->index;
|
||||||
|
@@ -26,7 +26,8 @@ struct Tunnel : TunnelPool::PoolItem<&_tunnel_pool> {
|
|||||||
TileIndex tile_s; // South tile of tunnel.
|
TileIndex tile_s; // South tile of tunnel.
|
||||||
bool is_chunnel;
|
bool is_chunnel;
|
||||||
|
|
||||||
Tunnel(TileIndex tile_n = INVALID_TILE) : tile_n(tile_n) {}
|
Tunnel() {}
|
||||||
|
Tunnel(TileIndex tile_n, TileIndex tile_s, bool is_chunnel) : tile_n(tile_n), tile_s(tile_s), is_chunnel(is_chunnel) {}
|
||||||
~Tunnel();
|
~Tunnel();
|
||||||
|
|
||||||
static inline Tunnel *GetByTile(TileIndex tile)
|
static inline Tunnel *GetByTile(TileIndex tile)
|
||||||
|
@@ -814,9 +814,7 @@ CommandCost CmdBuildTunnel(TileIndex start_tile, DoCommandFlag flags, uint32 p1,
|
|||||||
if(start_tile > end_tile) Swap(tn, ts);
|
if(start_tile > end_tile) Swap(tn, ts);
|
||||||
|
|
||||||
if (!Tunnel::CanAllocateItem()) return CMD_ERROR;
|
if (!Tunnel::CanAllocateItem()) return CMD_ERROR;
|
||||||
Tunnel *t = new Tunnel(tn);
|
const Tunnel *t = new Tunnel(tn, ts, is_chunnel);
|
||||||
t->tile_s = ts;
|
|
||||||
t->is_chunnel = is_chunnel;
|
|
||||||
|
|
||||||
if (transport_type == TRANSPORT_RAIL) {
|
if (transport_type == TRANSPORT_RAIL) {
|
||||||
if (!IsTunnelTile(start_tile) && c != NULL) c->infrastructure.rail[railtype] += num_pieces;
|
if (!IsTunnelTile(start_tile) && c != NULL) c->infrastructure.rail[railtype] += num_pieces;
|
||||||
|
Reference in New Issue
Block a user