diff --git a/projects/openttd_vs80.vcproj b/projects/openttd_vs80.vcproj
index c2484f44c4..0f0a7a3991 100644
--- a/projects/openttd_vs80.vcproj
+++ b/projects/openttd_vs80.vcproj
@@ -1612,7 +1612,11 @@
>
+
+
+
+
xy)) DoCommand(st->xy, 0, 0, DC_EXEC | DC_BANKRUPT, CMD_LANDSCAPE_CLEAR);
- if (st->facilities == 0) delete st;
- }
-
- /* The same for waypoints */
- Waypoint *wp;
- FOR_ALL_WAYPOINTS(wp) {
- delete wp;
+ if ((st->facilities & ~FACIL_WAYPOINT) == 0) delete st;
}
MarkWholeScreenDirty();
diff --git a/src/town_cmd.cpp b/src/town_cmd.cpp
index 5b4c64185c..13e93bfcf7 100644
--- a/src/town_cmd.cpp
+++ b/src/town_cmd.cpp
@@ -27,7 +27,6 @@
#include "newgrf_townname.h"
#include "newgrf_text.h"
#include "autoslope.h"
-#include "waypoint.h"
#include "transparency.h"
#include "tunnelbridge_map.h"
#include "strings_func.h"
diff --git a/src/vehicle_gui.cpp b/src/vehicle_gui.cpp
index a555c64f98..69da41a0ba 100644
--- a/src/vehicle_gui.cpp
+++ b/src/vehicle_gui.cpp
@@ -17,6 +17,7 @@
#include "newgrf_engine.h"
#include "newgrf_text.h"
#include "station_base.h"
+#include "waypoint_base.h"
#include "roadveh.h"
#include "train.h"
#include "aircraft.h"
diff --git a/src/vehicle_gui.h b/src/vehicle_gui.h
index 9ac62d506e..b205db17e4 100644
--- a/src/vehicle_gui.h
+++ b/src/vehicle_gui.h
@@ -10,7 +10,8 @@
#include "order_type.h"
#include "station_type.h"
#include "engine_type.h"
-#include "waypoint.h"
+#include "waypoint_type.h"
+#include "tile_type.h"
void DrawVehicleProfitButton(const Vehicle *v, int x, int y);
void ShowVehicleRefitWindow(const Vehicle *v, VehicleOrderID order, Window *parent);
diff --git a/src/viewport.cpp b/src/viewport.cpp
index e62ce5be9e..100d14c7b0 100644
--- a/src/viewport.cpp
+++ b/src/viewport.cpp
@@ -23,6 +23,7 @@
#include "landscape.h"
#include "viewport_func.h"
#include "station_base.h"
+#include "waypoint_base.h"
#include "town.h"
#include "signs_base.h"
#include "signs_func.h"
@@ -36,6 +37,7 @@
#include "vehicle_func.h"
#include "company_func.h"
#include "station_func.h"
+#include "waypoint_func.h"
#include "window_func.h"
#include "tilehighlight_func.h"
#include "window_gui.h"
diff --git a/src/waypoint.cpp b/src/waypoint.cpp
index 756fcd4c31..358d97dce0 100644
--- a/src/waypoint.cpp
+++ b/src/waypoint.cpp
@@ -5,13 +5,10 @@
#include "stdafx.h"
#include "strings_type.h"
-#include "rail.h"
-#include "station_base.h"
-#include "town.h"
-#include "waypoint.h"
+#include "order_func.h"
#include "window_func.h"
#include "newgrf_station.h"
-#include "order_func.h"
+#include "waypoint_base.h"
/**
* Draw a waypoint
diff --git a/src/waypoint.h b/src/waypoint_base.h
similarity index 65%
rename from src/waypoint.h
rename to src/waypoint_base.h
index 62715de852..99efefa0d3 100644
--- a/src/waypoint.h
+++ b/src/waypoint_base.h
@@ -1,18 +1,12 @@
/* $Id$ */
-/** @file waypoint.h Base of waypoints. */
+/** @file waypoint_base.h Base of waypoints. */
#ifndef WAYPOINT_H
#define WAYPOINT_H
#include "waypoint_type.h"
-#include "rail_map.h"
-#include "command_type.h"
#include "station_base.h"
-#include "town_type.h"
-#include "viewport_type.h"
-#include "date_type.h"
-#include "core/pool_type.hpp"
struct Waypoint : SpecializedStation {
uint16 town_cn; ///< The Nth waypoint for this town (consecutive number)
@@ -34,9 +28,4 @@ struct Waypoint : SpecializedStation {
#define FOR_ALL_WAYPOINTS(var) FOR_ALL_BASE_STATIONS_OF_TYPE(Waypoint, var)
-CommandCost RemoveTrainWaypoint(TileIndex tile, DoCommandFlag flags, bool justremove);
-void ShowWaypointWindow(const Waypoint *wp);
-void DrawWaypointSprite(int x, int y, int stat_id, RailType railtype);
-void MakeDefaultWaypointName(Waypoint *wp);
-
#endif /* WAYPOINT_H */
diff --git a/src/waypoint_cmd.cpp b/src/waypoint_cmd.cpp
index b24b219825..0cc2718b22 100644
--- a/src/waypoint_cmd.cpp
+++ b/src/waypoint_cmd.cpp
@@ -9,7 +9,7 @@
#include "economy_func.h"
#include "bridge_map.h"
#include "town.h"
-#include "waypoint.h"
+#include "waypoint_base.h"
#include "yapf/yapf.h"
#include "strings_func.h"
#include "gfx_func.h"
diff --git a/src/waypoint_func.h b/src/waypoint_func.h
new file mode 100644
index 0000000000..480f690b5b
--- /dev/null
+++ b/src/waypoint_func.h
@@ -0,0 +1,17 @@
+/* $Id$ */
+
+/** @file waypoint_func.h Functions related to waypoints. */
+
+#ifndef WAYPOINT_FUNC_H
+#define WAYPOINT_FUNC_H
+
+#include "rail_type.h"
+#include "command_type.h"
+#include "station_base.h"
+
+CommandCost RemoveTrainWaypoint(TileIndex tile, DoCommandFlag flags, bool justremove);
+void ShowWaypointWindow(const Waypoint *wp);
+void DrawWaypointSprite(int x, int y, int stat_id, RailType railtype);
+void MakeDefaultWaypointName(Waypoint *wp);
+
+#endif /* WAYPOINT_FUNC_H */
diff --git a/src/waypoint_gui.cpp b/src/waypoint_gui.cpp
index 1dc2175fa4..bfe3f04e9b 100644
--- a/src/waypoint_gui.cpp
+++ b/src/waypoint_gui.cpp
@@ -13,6 +13,7 @@
#include "command_func.h"
#include "company_func.h"
#include "window_func.h"
+#include "waypoint_base.h"
#include "table/strings.h"
diff --git a/src/yapf/yapf.hpp b/src/yapf/yapf.hpp
index 5b5a27c0e6..f0c3f49900 100644
--- a/src/yapf/yapf.hpp
+++ b/src/yapf/yapf.hpp
@@ -18,7 +18,7 @@
#include "../landscape.h"
#include "yapf.h"
#include "../pathfind.h"
-#include "../waypoint.h"
+#include "../waypoint_base.h"
#include "../debug.h"
#include "../settings_type.h"
#include "../tunnelbridge.h"