diff --git a/projects/openttd_vs80.vcproj b/projects/openttd_vs80.vcproj
--- 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
--- 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
--- 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
--- 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
--- 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
--- 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.h
deleted file mode 100644
--- a/src/waypoint.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/* $Id$ */
-
-/** @file waypoint.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)
-
- Waypoint(TileIndex tile = INVALID_TILE) : SpecializedStation(tile) { }
- ~Waypoint();
-
- void UpdateVirtCoord();
-
- /* virtual */ FORCEINLINE bool TileBelongsToRailStation(TileIndex tile) const
- {
- return IsRailWaypointTile(tile) && GetStationIndex(tile) == this->index;
- }
-
- /* virtual */ uint32 GetNewGRFVariable(const struct ResolverObject *object, byte variable, byte parameter, bool *available) const;
-
- /* virtual */ void GetTileArea(TileArea *ta, StationType type) const;
-};
-
-#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_base.h b/src/waypoint_base.h
new file mode 100644
--- /dev/null
+++ b/src/waypoint_base.h
@@ -0,0 +1,31 @@
+/* $Id$ */
+
+/** @file waypoint_base.h Base of waypoints. */
+
+#ifndef WAYPOINT_H
+#define WAYPOINT_H
+
+#include "waypoint_type.h"
+#include "station_base.h"
+
+struct Waypoint : SpecializedStation {
+ uint16 town_cn; ///< The Nth waypoint for this town (consecutive number)
+
+ Waypoint(TileIndex tile = INVALID_TILE) : SpecializedStation(tile) { }
+ ~Waypoint();
+
+ void UpdateVirtCoord();
+
+ /* virtual */ FORCEINLINE bool TileBelongsToRailStation(TileIndex tile) const
+ {
+ return IsRailWaypointTile(tile) && GetStationIndex(tile) == this->index;
+ }
+
+ /* virtual */ uint32 GetNewGRFVariable(const struct ResolverObject *object, byte variable, byte parameter, bool *available) const;
+
+ /* virtual */ void GetTileArea(TileArea *ta, StationType type) const;
+};
+
+#define FOR_ALL_WAYPOINTS(var) FOR_ALL_BASE_STATIONS_OF_TYPE(Waypoint, var)
+
+#endif /* WAYPOINT_H */
diff --git a/src/waypoint_cmd.cpp b/src/waypoint_cmd.cpp
--- 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
--- /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
--- 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
--- 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"