@@ -9,24 +9,25 @@
/** @file station_cmd.cpp Handling of station tiles. */
#include "stdafx.h"
#include "aircraft.h"
#include "bridge_map.h"
#include "cmd_helper.h"
#include "viewport_func.h"
#include "command_func.h"
#include "town.h"
#include "news_func.h"
#include "train.h"
#include "ship.h"
#include "roadveh.h"
#include "industry.h"
#include "newgrf_cargo.h"
#include "newgrf_debug.h"
#include "newgrf_station.h"
#include "newgrf_canal.h" /* For the buoy */
#include "pathfinder/yapf/yapf_cache.h"
#include "road_internal.h" /* For drawing catenary/checking road removal */
#include "autoslope.h"
#include "water.h"
#include "station_gui.h"
#include "strings_func.h"
@@ -2512,24 +2513,26 @@ CommandCost CmdBuildDock(TileIndex tile,
/**
* Remove a dock
* @param tile TileIndex been queried
* @param flags operation to perform
* @return cost or failure of operation
*/
static CommandCost RemoveDock(TileIndex tile, DoCommandFlag flags)
{
Station *st = Station::GetByTile(tile);
CommandCost ret = CheckOwnership(st->owner);
if (ret.Failed()) return ret;
TileIndex docking_location = TILE_ADD(st->dock_tile, ToTileIndexDiff(GetDockOffset(st->dock_tile)));
TileIndex tile1 = st->dock_tile;
TileIndex tile2 = tile1 + TileOffsByDiagDir(GetDockDirection(tile1));
ret = EnsureNoVehicleOnGround(tile1);
if (ret.Succeeded()) ret = EnsureNoVehicleOnGround(tile2);
if (flags & DC_EXEC) {
DoClearSquare(tile1);
MarkTileDirtyByTile(tile1);
MakeWaterKeepingClass(tile2, st->owner);
@@ -2537,24 +2540,36 @@ static CommandCost RemoveDock(TileIndex
st->rect.AfterRemoveTile(st, tile2);
st->dock_tile = INVALID_TILE;
st->facilities &= ~FACIL_DOCK;
Company::Get(st->owner)->infrastructure.station -= 2;
DirtyCompanyInfrastructureWindows(st->owner);
SetWindowWidgetDirty(WC_STATION_VIEW, st->index, WID_SV_SHIPS);
st->UpdateVirtCoord();
st->RecomputeIndustriesNear();
DeleteStationIfEmpty(st);
/* All ships that were going to our station, can't go to it anymore.
* Just clear the order, then automatically the next appropriate order
* will be selected and in case of no appropriate order it will just
* wander around the world. */
Ship *s;
FOR_ALL_SHIPS(s) {
if (s->dest_tile == docking_location) {
s->dest_tile = 0;
s->current_order.Free();
}
return CommandCost(EXPENSES_CONSTRUCTION, _price[PR_CLEAR_STATION_DOCK]);
#include "table/station_land.h"
const DrawTileSprites *GetStationTileLayout(StationType st, byte gfx)
return &_station_display_datas[st][gfx];
Status change: