summaryrefslogtreecommitdiff
path: root/waypoint.c
diff options
context:
space:
mode:
authortruelight <truelight@openttd.org>2006-08-26 16:46:32 +0000
committertruelight <truelight@openttd.org>2006-08-26 16:46:32 +0000
commit8358832f4a81063827caf503c5a7d7ff1b62e77a (patch)
treeaa8da22d3b3ff6be89bfd4a179fcc4da3e91518a /waypoint.c
parent65f5ec13f678b98686abc8e599fc87adc81c5d26 (diff)
downloadopenttd-8358832f4a81063827caf503c5a7d7ff1b62e77a.tar.xz
(svn r6143) -Codechange: DeleteWaypoint removes a waypoint from the pool
-Codechange: DestroyWaypoint is called by DeleteWaypoint to remove all things where a waypoint depends on. Last 2 changes to prepare for new pool system. Not pretty now, will be soon.
Diffstat (limited to 'waypoint.c')
-rw-r--r--waypoint.c24
1 files changed, 11 insertions, 13 deletions
diff --git a/waypoint.c b/waypoint.c
index aa29c7a84..25abc7d66 100644
--- a/waypoint.c
+++ b/waypoint.c
@@ -95,6 +95,16 @@ void UpdateAllWaypointSigns(void)
}
}
+/* Internal handler to delete a waypoint */
+void DestroyWaypoint(Waypoint *wp)
+{
+ RemoveOrderFromAllVehicles(OT_GOTO_WAYPOINT, (DestinationID)wp->index);
+
+ if (wp->string != STR_NULL) DeleteName(wp->string);
+
+ RedrawWaypointSign(wp);
+}
+
/* Set the default name for a waypoint */
static void MakeDefaultWaypointName(Waypoint* wp)
{
@@ -244,18 +254,6 @@ int32 CmdBuildTrainWaypoint(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
return _price.build_train_depot;
}
-/* Internal handler to delete a waypoint */
-static void DoDeleteWaypoint(Waypoint *wp)
-{
- wp->xy = 0;
-
- RemoveOrderFromAllVehicles(OT_GOTO_WAYPOINT, (DestinationID)wp->index);
-
- if (wp->string != STR_NULL) DeleteName(wp->string);
-
- RedrawWaypointSign(wp);
-}
-
/* Daily loop for waypoints */
void WaypointsDailyLoop(void)
{
@@ -263,7 +261,7 @@ void WaypointsDailyLoop(void)
/* Check if we need to delete a waypoint */
FOR_ALL_WAYPOINTS(wp) {
- if (wp->deleted != 0 && --wp->deleted == 0) DoDeleteWaypoint(wp);
+ if (wp->deleted != 0 && --wp->deleted == 0) DestroyWaypoint(wp);
}
}