Fix waypoint maps crashing if there is no finish line
This commit is contained in:
parent
e5434e3f14
commit
2c90f46136
1 changed files with 5 additions and 2 deletions
|
|
@ -372,16 +372,19 @@ waypoint_t *K_GetSpawnWaypointForMobj(const mobj_t *mobj)
|
|||
waypoint_t *closestwaypoint = NULL;
|
||||
fixed_t closestdist = INT32_MAX;
|
||||
line_t *finish = P_FindNearestLine(finishline->mobj->x, finishline->mobj->y, nullptr, 2001); // erm... NULL? thanks hanagumi hall
|
||||
INT32 myside = P_PointOnLineSide(mobj->x, mobj->y, finish);
|
||||
INT32 myside = finish != NULL ? P_PointOnLineSide(mobj->x, mobj->y, finish) : 0;
|
||||
I_Assert(mobj != NULL);
|
||||
|
||||
if (finish == NULL)
|
||||
CONS_Alert(CONS_WARNING, "No finish line linedef found!\n");
|
||||
|
||||
for (size_t i = 0; i < numwaypoints; i++)
|
||||
{
|
||||
waypoint_t *checkwaypoint = &waypointheap[i];
|
||||
|
||||
if (!K_GetWaypointIsEnabled(checkwaypoint)
|
||||
|| checkwaypoint == finishline
|
||||
|| myside != P_PointOnLineSide(checkwaypoint->mobj->x, checkwaypoint->mobj->y, finish))
|
||||
|| (finish != NULL && myside != P_PointOnLineSide(checkwaypoint->mobj->x, checkwaypoint->mobj->y, finish)))
|
||||
continue;
|
||||
|
||||
fixed_t checkdist = P_AproxDistance(
|
||||
|
|
|
|||
Loading…
Reference in a new issue