summaryrefslogtreecommitdiff
path: root/src/station_cmd.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/station_cmd.cpp')
-rw-r--r--src/station_cmd.cpp30
1 files changed, 28 insertions, 2 deletions
diff --git a/src/station_cmd.cpp b/src/station_cmd.cpp
index 64b83e8e2..c0774556f 100644
--- a/src/station_cmd.cpp
+++ b/src/station_cmd.cpp
@@ -2263,7 +2263,7 @@ CommandCost CmdBuildAirport(TileIndex tile, DoCommandFlag flags, uint32 p1, uint
st->RecomputeIndustriesNear();
InvalidateWindowData(WC_SELECT_STATION, 0, 0);
InvalidateWindowData(WC_STATION_LIST, st->owner, 0);
- SetWindowWidgetDirty(WC_STATION_VIEW, st->index, WID_SV_PLANES);
+ InvalidateWindowData(WC_STATION_VIEW, st->index);
if (_settings_game.economy.station_noise_level) {
SetWindowDirty(WC_TOWN_VIEW, st->town->index);
@@ -2339,7 +2339,7 @@ static CommandCost RemoveAirport(TileIndex tile, DoCommandFlag flags)
st->airport.Clear();
st->facilities &= ~FACIL_AIRPORT;
- SetWindowWidgetDirty(WC_STATION_VIEW, st->index, WID_SV_PLANES);
+ InvalidateWindowData(WC_STATION_VIEW, st->index);
if (_settings_game.economy.station_noise_level) {
SetWindowDirty(WC_TOWN_VIEW, st->town->index);
@@ -2358,6 +2358,32 @@ static CommandCost RemoveAirport(TileIndex tile, DoCommandFlag flags)
}
/**
+ * Open/close an airport to incoming aircraft.
+ * @param tile Unused.
+ * @param flags Operation to perform.
+ * @param p1 Station ID of the airport.
+ * @param p2 Unused.
+ * @param text unused
+ * @return the cost of this operation or an error
+ */
+CommandCost CmdOpenCloseAirport(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
+{
+ if (!Station::IsValidID(p1)) return CMD_ERROR;
+ Station *st = Station::Get(p1);
+
+ if (!(st->facilities & FACIL_AIRPORT)) return CMD_ERROR;
+
+ CommandCost ret = CheckOwnership(st->owner);
+ if (ret.Failed()) return ret;
+
+ if (flags & DC_EXEC) {
+ st->airport.flags ^= AIRPORT_CLOSED_block;
+ SetWindowWidgetDirty(WC_STATION_VIEW, st->index, WID_SV_CLOSE_AIRPORT);
+ }
+ return CommandCost();
+}
+
+/**
* Tests whether the company's vehicles have this station in orders
* @param station station ID
* @param include_company If true only check vehicles of \a company, if false only check vehicles of other companies