Replace many cases of if else if statements with I_Asserts.

This is done specifically on static functions that aren't used as callbacks.
This is done to keep the code cleaner, and the I_Asserts get compiled out in Release builds.
Logic is left in the "public" functions to avoid crashes as a result of the modules.
This commit is contained in:
Sryder 2020-03-21 19:00:00 +00:00
parent aeb6567b53
commit 3d3b8b6bc6
3 changed files with 357 additions and 577 deletions

View file

@ -18,21 +18,13 @@ static boolean K_BHeapItemValidate(bheap_t *heap, bheapitem_t *item)
{
boolean heapitemvalid = false;
if (heap == NULL)
{
CONS_Debug(DBG_GAMELOGIC, "NULL heap in K_BHeapItemValidate.\n");
}
else if (item == NULL)
{
CONS_Debug(DBG_GAMELOGIC, "NULL item in K_BHeapItemValidate.\n");
}
else
{
I_Assert(heap != NULL);
I_Assert(item != NULL);
if ((item->data != NULL) && (item->heapindex < SIZE_MAX / 2) && (item->owner == heap))
{
heapitemvalid = true;
}
}
return heapitemvalid;
}
@ -53,32 +45,14 @@ static boolean K_BHeapItemValidate(bheap_t *heap, bheapitem_t *item)
static bheapitem_t *K_BHeapItemsCompare(bheap_t *heap, bheapitem_t *item1, bheapitem_t *item2)
{
bheapitem_t *lowervalueitem = NULL;
if (heap == NULL)
{
CONS_Debug(DBG_GAMELOGIC, "NULL heap in K_BHeapItemsCompare.\n");
}
else if (K_BHeapValid(heap) == false)
{
CONS_Debug(DBG_GAMELOGIC, "Invalid heap in K_BHeapSwapItems.\n");
}
else if (item1 == NULL)
{
CONS_Debug(DBG_GAMELOGIC, "NULL item1 in K_BHeapItemsCompare.\n");
}
else if (item2 == NULL)
{
CONS_Debug(DBG_GAMELOGIC, "NULL item2 in K_BHeapItemsCompare.\n");
}
else if (K_BHeapItemValidate(heap, item1) == false)
{
CONS_Debug(DBG_GAMELOGIC, "Invalid item1 in K_BHeapItemsCompare.\n");
}
else if (K_BHeapItemValidate(heap, item2) == false)
{
CONS_Debug(DBG_GAMELOGIC, "Invalid item2 in K_BHeapItemsCompare.\n");
}
else
{
I_Assert(heap != NULL);
I_Assert(K_BHeapValid(heap));
I_Assert(item1 != NULL);
I_Assert(item2 != NULL);
I_Assert(K_BHeapItemValidate(heap, item1));
I_Assert(K_BHeapItemValidate(heap, item2));
if (item1->value < item2->value)
{
lowervalueitem = item1;
@ -87,7 +61,6 @@ static bheapitem_t *K_BHeapItemsCompare(bheap_t *heap, bheapitem_t *item1, bheap
{
lowervalueitem = item2;
}
}
return lowervalueitem;
}
@ -107,31 +80,13 @@ static bheapitem_t *K_BHeapItemsCompare(bheap_t *heap, bheapitem_t *item1, bheap
--------------------------------------------------*/
static void K_BHeapSwapItems(bheap_t *heap, bheapitem_t *item1, bheapitem_t *item2)
{
if (heap == NULL)
{
CONS_Debug(DBG_GAMELOGIC, "NULL heap in K_BHeapSwapItems.\n");
}
else if (K_BHeapValid(heap) == false)
{
CONS_Debug(DBG_GAMELOGIC, "Invalid heap in K_BHeapSwapItems.\n");
}
else if (item1 == NULL)
{
CONS_Debug(DBG_GAMELOGIC, "NULL item1 in K_BHeapSwapItems.\n");
}
else if (item2 == NULL)
{
CONS_Debug(DBG_GAMELOGIC, "NULL item2 in K_BHeapSwapItems.\n");
}
else if (K_BHeapItemValidate(heap, item1) == false)
{
CONS_Debug(DBG_GAMELOGIC, "Invalid item1 in K_BHeapSwapItems.\n");
}
else if (K_BHeapItemValidate(heap, item2) == false)
{
CONS_Debug(DBG_GAMELOGIC, "Invalid item2 in K_BHeapSwapItems.\n");
}
else
I_Assert(heap != NULL);
I_Assert(K_BHeapValid(heap));
I_Assert(item1 != NULL);
I_Assert(item2 != NULL);
I_Assert(K_BHeapItemValidate(heap, item1));
I_Assert(K_BHeapItemValidate(heap, item2));
{
size_t tempitemindex = item1->heapindex;
bheapitem_t tempitemstore = *item1;
@ -170,18 +125,10 @@ static size_t K_BHeapItemGetParentIndex(bheapitem_t *item)
{
size_t parentindex = SIZE_MAX;
if (item == NULL)
{
CONS_Debug(DBG_GAMELOGIC, "NULL item in K_BHeapItemGetParentIndex.\n");
}
else if (item->heapindex >= (SIZE_MAX / 2))
{
CONS_Debug(DBG_GAMELOGIC, "Bad item heapindex in K_BHeapItemGetParentIndex.\n");
}
else
{
I_Assert(item != NULL);
I_Assert(item->heapindex < (SIZE_MAX / 2));
parentindex = (item->heapindex - 1U) / 2U;
}
return parentindex;
}
@ -201,18 +148,10 @@ static size_t K_BHeapItemGetLeftChildIndex(bheapitem_t *item)
{
size_t leftchildindex = SIZE_MAX;
if (item == NULL)
{
CONS_Debug(DBG_GAMELOGIC, "NULL item in K_BHeapItemGetLeftChildIndex.\n");
}
else if (item->heapindex >= (SIZE_MAX / 2))
{
CONS_Debug(DBG_GAMELOGIC, "Bad item heapindex in K_BHeapItemGetLeftChildIndex.\n");
}
else
{
I_Assert(item != NULL);
I_Assert(item->heapindex < (SIZE_MAX / 2));
leftchildindex = (item->heapindex * 2U) + 1U;
}
return leftchildindex;
}
@ -232,18 +171,10 @@ static size_t K_BHeapItemGetRightChildIndex(bheapitem_t *item)
{
size_t rightchildindex = SIZE_MAX;
if (item == NULL)
{
CONS_Debug(DBG_GAMELOGIC, "NULL item in K_BHeapItemGetRightChildIndex.\n");
}
else if (item->heapindex >= (SIZE_MAX / 2))
{
CONS_Debug(DBG_GAMELOGIC, "Bad item heapindex in K_BHeapItemGetRightChildIndex.\n");
}
else
{
I_Assert(item != NULL);
I_Assert(item->heapindex < (SIZE_MAX / 2));
rightchildindex = (item->heapindex * 2U) + 2U;
}
return rightchildindex;
}
@ -262,20 +193,10 @@ static size_t K_BHeapItemGetRightChildIndex(bheapitem_t *item)
--------------------------------------------------*/
static void K_BHeapSortUp(bheap_t *heap, bheapitem_t *item)
{
if (heap == NULL)
{
CONS_Debug(DBG_GAMELOGIC, "NULL heap in K_BHeapSortUp.\n");
}
else if (K_BHeapValid(heap) == false)
{
CONS_Debug(DBG_GAMELOGIC, "Invalid heap in K_BHeapSortUp.\n");
}
else if (item == NULL)
{
CONS_Debug(DBG_GAMELOGIC, "NULL item in K_BHeapSortUp.\n");
}
else
{
I_Assert(heap != NULL);
I_Assert(K_BHeapValid(heap));
I_Assert(item != NULL);
if (item->heapindex > 0U)
{
size_t parentindex = SIZE_MAX;
@ -294,7 +215,6 @@ static void K_BHeapSortUp(bheap_t *heap, bheapitem_t *item)
}
} while (parentindex > 0U);
}
}
}
/*--------------------------------------------------
@ -311,20 +231,10 @@ static void K_BHeapSortUp(bheap_t *heap, bheapitem_t *item)
--------------------------------------------------*/
static void K_BHeapSortDown(bheap_t *heap, bheapitem_t *item)
{
if (heap == NULL)
{
CONS_Debug(DBG_GAMELOGIC, "NULL heap in K_BHeapSortDown.\n");
}
else if (K_BHeapValid(heap) == false)
{
CONS_Debug(DBG_GAMELOGIC, "Invalid heap in K_BHeapSortDown.\n");
}
else if (item == NULL)
{
CONS_Debug(DBG_GAMELOGIC, "NULL item in K_BHeapSortDown.\n");
}
else
{
I_Assert(heap != NULL);
I_Assert(K_BHeapValid(heap));
I_Assert(item != NULL);
if (heap->count > 0U)
{
size_t leftchildindex = SIZE_MAX;
@ -362,7 +272,6 @@ static void K_BHeapSortDown(bheap_t *heap, bheapitem_t *item)
{
noswapneeded = true;
}
}
else
{
@ -376,7 +285,6 @@ static void K_BHeapSortDown(bheap_t *heap, bheapitem_t *item)
} while (item->heapindex < (heap->count - 1U));
}
}
}
/*--------------------------------------------------

View file

@ -23,14 +23,10 @@ static const size_t DEFAULT_CLOSEDSET_CAPACITY = 8U;
static UINT32 K_NodeGetFScore(const pathfindnode_t *const node)
{
UINT32 fscore = UINT32_MAX;
if (node == NULL)
{
CONS_Debug(DBG_GAMELOGIC, "NULL node in K_PathfindNodeGetFScore.");
}
else
{
I_Assert(node != NULL);
fscore = node->gscore + node->hscore;
}
return fscore;
}
@ -52,7 +48,7 @@ static void K_NodeUpdateHeapIndex(void *const node, const size_t newheapindex)
{
if (node == NULL)
{
CONS_Debug(DBG_GAMELOGIC, "NULL node in K_PathfindNodeUpdateHeapIndex.\n");
CONS_Debug(DBG_GAMELOGIC, "NULL node in K_NodeUpdateHeapIndex.\n");
}
else
{
@ -84,18 +80,11 @@ static pathfindnode_t *K_NodesArrayContainsNodeData(
size_t nodesarraycount)
{
pathfindnode_t *foundnode = NULL;
size_t i = 0U;
I_Assert(nodesarray != NULL);
I_Assert(nodedata != NULL);
if (nodesarray == NULL)
{
CONS_Debug(DBG_GAMELOGIC, "NULL nodesarray in K_NodesArrayContainsWaypoint.\n");
}
else if (nodedata == NULL)
{
CONS_Debug(DBG_GAMELOGIC, "NULL nodedata in K_NodesArrayContainsWaypoint.\n");
}
else
{
size_t i;
// It is more likely that we'll find the node we are looking for from the end of the array
// Yes, the for loop looks weird, remember that size_t is unsigned and we want to check 0, after it hits 0 it
// will loop back up to SIZE_MAX
@ -107,7 +96,6 @@ static pathfindnode_t *K_NodesArrayContainsNodeData(
break;
}
}
}
return foundnode;
}
@ -127,18 +115,10 @@ static pathfindnode_t *K_NodesArrayContainsNodeData(
static boolean K_ClosedsetContainsNode(pathfindnode_t **closedset, pathfindnode_t *node, size_t closedsetcount)
{
boolean nodeisinclosedset = false;
size_t i = 0U;
if (closedset == NULL)
{
CONS_Debug(DBG_GAMELOGIC, "NULL closedset in K_PathfindClosedsetContainsNode.\n");
}
else if (node == NULL)
{
CONS_Debug(DBG_GAMELOGIC, "NULL node in K_PathfindClosedsetContainsNode.\n");
}
else
{
size_t i;
I_Assert(closedset != NULL);
I_Assert(node != NULL);
// It is more likely that we'll find the node we are looking for from the end of the array
// Yes, the for loop looks weird, remember that size_t is unsigned and we want to check 0, after it hits 0 it
// will loop back up to SIZE_MAX
@ -150,7 +130,6 @@ static boolean K_ClosedsetContainsNode(pathfindnode_t **closedset, pathfindnode_
break;
}
}
}
return nodeisinclosedset;
}
@ -227,15 +206,9 @@ static boolean K_ReconstructPath(path_t *const path, pathfindnode_t *const desti
{
boolean reconstructsuccess = false;
if (path == NULL)
{
CONS_Debug(DBG_GAMELOGIC, "NULL path in K_ReconstructPath.\n");
}
else if (destinationnode == NULL)
{
CONS_Debug(DBG_GAMELOGIC, "NULL destinationnode in K_ReconstructPath.\n");
}
else
I_Assert(path != NULL);
I_Assert(destinationnode != NULL);
{
size_t numnodes = 0U;
pathfindnode_t *thisnode = destinationnode;

View file

@ -345,21 +345,11 @@ static void K_DebugWaypointsSpawnLine(waypoint_t *const waypoint1, waypoint_t *c
UINT32 numofframes = 1; // If this was 0 it could divide by 0
// Error conditions
if (waypoint1 == NULL || waypoint2 == NULL)
{
CONS_Debug(DBG_GAMELOGIC, "NULL waypoint in K_DebugWaypointsSpawnLine.\n");
return;
}
if (waypoint1->mobj == NULL || waypoint2->mobj == NULL)
{
CONS_Debug(DBG_GAMELOGIC, "NULL mobj on waypoint in K_DebugWaypointsSpawnLine.\n");
return;
}
if (cv_kartdebugwaypoints.value == 0)
{
CONS_Debug(DBG_GAMELOGIC, "In K_DebugWaypointsSpawnLine when kartdebugwaypoints is off.\n");
return;
}
I_Assert(waypoint1 != NULL);
I_Assert(waypoint1->mobj != NULL);
I_Assert(waypoint2 != NULL);
I_Assert(waypoint2->mobj != NULL);
I_Assert(cv_kartdebugwaypoints.value != 0);
waypointmobj1 = waypoint1->mobj;
waypointmobj2 = waypoint2->mobj;
@ -603,15 +593,9 @@ static void K_UpdateNodesArrayBaseSize(size_t newnodesarraysize)
static UINT32 K_DistanceBetweenWaypoints(waypoint_t *const waypoint1, waypoint_t *const waypoint2)
{
UINT32 finaldist = UINT32_MAX;
if (waypoint1 == NULL)
{
CONS_Debug(DBG_GAMELOGIC, "NULL waypoint1 in K_DistanceBetweenWaypoints.\n");
}
else if (waypoint2 == NULL)
{
CONS_Debug(DBG_GAMELOGIC, "NULL waypoint2 in K_DistanceBetweenWaypoints.\n");
}
else
I_Assert(waypoint1 != NULL);
I_Assert(waypoint2 != NULL);
{
const fixed_t xydist =
P_AproxDistance(waypoint1->mobj->x - waypoint2->mobj->x, waypoint1->mobj->y - waypoint2->mobj->y);
@ -1104,21 +1088,12 @@ static boolean K_CheckWaypointForMobj(waypoint_t *const waypoint, void *const mo
boolean mobjsmatch = false;
// Error Conditions
if (waypoint == NULL)
I_Assert(waypoint != NULL);
I_Assert(waypoint->mobj != NULL);
I_Assert(mobjpointer != NULL);
{
CONS_Debug(DBG_GAMELOGIC, "NULL waypoint in K_CheckWaypointForMobj.\n");
}
else if (waypoint->mobj == NULL)
{
CONS_Debug(DBG_GAMELOGIC, "Waypoint has NULL mobj in K_CheckWaypointForMobj.\n");
}
else if (mobjpointer == NULL)
{
CONS_Debug(DBG_GAMELOGIC, "NULL mobjpointer in K_CheckWaypointForMobj.\n");
}
else
{
mobj_t *mobj = (mobj_t *)mobjpointer;
mobj_t *const mobj = (mobj_t *)mobjpointer;
if (P_MobjWasRemoved(mobj))
{
@ -1170,27 +1145,13 @@ static waypoint_t *K_TraverseWaypoints(
waypoint_t *foundwaypoint = NULL;
// Error conditions
if (condition == NULL)
{
CONS_Debug(DBG_GAMELOGIC, "NULL condition in K_TraverseWaypoints.\n");
}
else if (conditionalfunc == NULL)
{
CONS_Debug(DBG_GAMELOGIC, "NULL conditionalfunc in K_TraverseWaypoints.\n");
}
else if (visitedarray == NULL)
{
CONS_Debug(DBG_GAMELOGIC, "NULL visitedarray in K_TraverseWaypoints.\n");
}
else
{
I_Assert(condition != NULL);
I_Assert(conditionalfunc != NULL);
I_Assert(visitedarray != NULL);
searchwaypointstart:
if (waypoint == NULL)
{
CONS_Debug(DBG_GAMELOGIC, "NULL waypoint in K_TraverseWaypoints.\n");
}
else
I_Assert(waypoint != NULL);
{
size_t waypointindex = K_GetWaypointHeapIndex(waypoint);
// If we've already visited this waypoint, we've already checked the next waypoints, no point continuing
@ -1243,7 +1204,6 @@ searchwaypointstart:
}
}
}
}
return foundwaypoint;
}
@ -1270,24 +1230,13 @@ static waypoint_t *K_SearchWaypointGraph(
waypoint_t *foundwaypoint = NULL;
// Error conditions
if (condition == NULL)
{
CONS_Debug(DBG_GAMELOGIC, "NULL condition in K_SearchWaypointGraph.\n");
}
else if (conditionalfunc == NULL)
{
CONS_Debug(DBG_GAMELOGIC, "NULL conditionalfunc in K_SearchWaypointGraph.\n");
}
else if (firstwaypoint == NULL)
{
CONS_Debug(DBG_GAMELOGIC, "K_SearchWaypointsForMobj called when no first waypoint.\n");
}
else
{
I_Assert(condition != NULL);
I_Assert(conditionalfunc != NULL);
I_Assert(firstwaypoint != NULL);
visitedarray = Z_Calloc(numwaypoints * sizeof(boolean), PU_STATIC, NULL);
foundwaypoint = K_TraverseWaypoints(firstwaypoint, conditionalfunc, condition, visitedarray);
Z_Free(visitedarray);
}
return foundwaypoint;
}
@ -1339,20 +1288,10 @@ static waypoint_t *K_SearchWaypointHeap(
waypoint_t *foundwaypoint = NULL;
// Error conditions
if (condition == NULL)
{
CONS_Debug(DBG_GAMELOGIC, "NULL condition in K_SearchWaypointHeap.\n");
}
else if (conditionalfunc == NULL)
{
CONS_Debug(DBG_GAMELOGIC, "NULL conditionalfunc in K_SearchWaypointHeap.\n");
}
else if (waypointheap == NULL)
{
CONS_Debug(DBG_GAMELOGIC, "K_SearchWaypointHeap called when no waypointheap.\n");
}
else
{
I_Assert(condition != NULL);
I_Assert(conditionalfunc != NULL);
I_Assert(waypointheap != NULL);
// Simply search through the waypointheap for the waypoint which matches the condition. Much simpler when no
// pathfinding is needed. Search up to numwaypoints and NOT numwaypointmobjs as numwaypoints is the real number of
// waypoints setup in the heap while numwaypointmobjs ends up being the capacity
@ -1364,7 +1303,6 @@ static waypoint_t *K_SearchWaypointHeap(
break;
}
}
}
return foundwaypoint;
}
@ -1408,16 +1346,10 @@ waypoint_t *K_SearchWaypointHeapForMobj(mobj_t *const mobj)
--------------------------------------------------*/
static UINT32 K_SetupCircuitLength(void)
{
if ((firstwaypoint == NULL) || (numwaypoints == 0U))
{
CONS_Debug(DBG_GAMELOGIC, "K_SetupCircuitLength called with no waypoints.\n");
}
else if (finishline == NULL)
{
CONS_Debug(DBG_GAMELOGIC, "K_SetupCircuitLength called with no finishline waypoint.\n");
}
else
{
I_Assert(firstwaypoint != NULL);
I_Assert(numwaypoints > 0U);
I_Assert(finishline != NULL);
// The circuit length only makes sense in circuit maps, sprint maps do not need to use it
// The main usage of the circuit length is to add onto a player's distance to finish line so crossing the finish
// line places people correctly relative to each other
@ -1439,7 +1371,6 @@ static UINT32 K_SetupCircuitLength(void)
Z_Free(bestcircuitpath.array);
}
}
return circuitlength;
}
@ -1460,16 +1391,9 @@ static UINT32 K_SetupCircuitLength(void)
static void K_AddPrevToWaypoint(waypoint_t *const waypoint, waypoint_t *const prevwaypoint)
{
// Error conditions
if (waypoint == NULL)
{
CONS_Debug(DBG_SETUP, "NULL waypoint in K_AddPrevToWaypoint.\n");
}
else if (prevwaypoint == NULL)
{
CONS_Debug(DBG_SETUP, "NULL prevwaypoint in K_AddPrevToWaypoint.\n");
}
else
{
I_Assert(waypoint != NULL);
I_Assert(prevwaypoint != NULL);
waypoint->numprevwaypoints++;
waypoint->prevwaypoints =
Z_Realloc(waypoint->prevwaypoints, waypoint->numprevwaypoints * sizeof(waypoint_t *), PU_LEVEL, NULL);
@ -1488,7 +1412,6 @@ static void K_AddPrevToWaypoint(waypoint_t *const waypoint, waypoint_t *const pr
}
waypoint->prevwaypoints[waypoint->numprevwaypoints - 1] = prevwaypoint;
}
}
/*--------------------------------------------------
@ -1509,20 +1432,11 @@ static waypoint_t *K_MakeWaypoint(mobj_t *const mobj)
mobj_t *otherwaypointmobj = NULL;
// Error conditions
if (mobj == NULL || P_MobjWasRemoved(mobj))
{
CONS_Debug(DBG_SETUP, "NULL mobj in K_MakeWaypoint.\n");
}
else if (waypointcap == NULL)
{
CONS_Debug(DBG_SETUP, "K_MakeWaypoint called with NULL waypointcap.\n");
}
else if (numwaypoints >= numwaypointmobjs)
{
CONS_Debug(DBG_SETUP, "K_MakeWaypoint called with max waypoint capacity reached.\n");
}
else
{
I_Assert(mobj != NULL);
I_Assert(!P_MobjWasRemoved(mobj));
I_Assert(waypointcap != NULL); // No waypoint mobjs in map load
I_Assert(numwaypoints < numwaypointmobjs); // waypoint array reached max capacity
// numwaypoints is incremented later in K_SetupWaypoint
madewaypoint = &waypointheap[numwaypoints];
numwaypoints++;
@ -1556,7 +1470,6 @@ static waypoint_t *K_MakeWaypoint(mobj_t *const mobj)
I_Error("K_MakeWaypoint: Out of Memory allocating next waypoint distances.");
}
}
}
return madewaypoint;
}
@ -1578,20 +1491,11 @@ static waypoint_t *K_SetupWaypoint(mobj_t *const mobj)
waypoint_t *thiswaypoint = NULL;
// Error conditions
if (mobj == NULL || P_MobjWasRemoved(mobj))
{
CONS_Debug(DBG_SETUP, "NULL mobj in K_SetupWaypoint.\n");
}
else if (mobj->type != MT_WAYPOINT)
{
CONS_Debug(DBG_SETUP, "Non MT_WAYPOINT mobj in K_SetupWaypoint. Type=%d.\n", mobj->type);
}
else if (waypointcap == NULL)
{
CONS_Debug(DBG_SETUP, "K_SetupWaypoint called with NULL waypointcap.\n");
}
else
{
I_Assert(mobj != NULL);
I_Assert(!P_MobjWasRemoved(mobj));
I_Assert(mobj->type == MT_WAYPOINT);
I_Assert(waypointcap != NULL); // no waypoint mobjs in map load
// If we have waypoints already created, search through them first to see if this mobj is already added.
if (firstwaypoint != NULL)
{
@ -1665,7 +1569,6 @@ static waypoint_t *K_SetupWaypoint(mobj_t *const mobj)
CONS_Debug(DBG_SETUP, "K_SetupWaypoint failed to make new waypoint with ID %d.\n", mobj->movecount);
}
}
}
return thiswaypoint;
}
@ -1684,16 +1587,9 @@ static boolean K_AllocateWaypointHeap(void)
boolean allocationsuccessful = false;
// Error conditions
if (waypointheap != NULL)
{
CONS_Debug(DBG_SETUP, "K_AllocateWaypointHeap called when waypointheap is already allocated.\n");
}
else if (waypointcap == NULL)
{
CONS_Debug(DBG_SETUP, "K_AllocateWaypointHeap called with NULL waypointcap.\n");
}
else
{
I_Assert(waypointheap == NULL); // waypointheap is already allocated
I_Assert(waypointcap != NULL); // no waypoint mobjs at map load
// This should be an allocation for the first time. Reset the number of mobjs back to 0 if it's not already
numwaypointmobjs = 0;
@ -1729,7 +1625,6 @@ static boolean K_AllocateWaypointHeap(void)
{
CONS_Debug(DBG_SETUP, "No waypoint mobjs in waypointcap.\n");
}
}
return allocationsuccessful;
}
@ -1794,7 +1689,11 @@ boolean K_SetupWaypointList(void)
finishline = firstwaypoint;
}
(void)K_SetupCircuitLength();
if (K_SetupCircuitLength() == 0
&& ((mapheaderinfo[gamemap - 1]->levelflags & LF_SECTIONRACE) != LF_SECTIONRACE))
{
CONS_Alert(CONS_ERROR, "Circuit track waypoints do not form a circuit.\n");
}
setupsuccessful = true;
}