(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.
This commit is contained in:
truelight
2006-08-26 16:46:32 +00:00
parent db8dfcd6e9
commit 5dc121d1c1
2 changed files with 19 additions and 13 deletions

View File

@@ -55,6 +55,14 @@ static inline bool IsValidWaypointID(WaypointID index)
return index < GetWaypointPoolSize() && IsValidWaypoint(GetWaypoint(index));
}
void DestroyWaypoint(Waypoint *wp);
static inline void DeleteWaypoint(Waypoint *wp)
{
DestroyWaypoint(wp);
wp->xy = 0;
}
#define FOR_ALL_WAYPOINTS_FROM(wp, start) for (wp = GetWaypoint(start); wp != NULL; wp = (wp->index + 1 < GetWaypointPoolSize()) ? GetWaypoint(wp->index + 1) : NULL) if (IsValidWaypoint(wp))
#define FOR_ALL_WAYPOINTS(wp) FOR_ALL_WAYPOINTS_FROM(wp, 0)