mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2026-04-27 12:31:54 +00:00
Convert k_waypoint.c to k_waypoint.cpp
This commit is contained in:
parent
535fc17875
commit
345e4475a3
2 changed files with 16 additions and 12 deletions
|
|
@ -117,7 +117,7 @@ add_executable(SRB2SDL2 MACOSX_BUNDLE WIN32
|
||||||
k_race.c
|
k_race.c
|
||||||
k_battle.c
|
k_battle.c
|
||||||
k_pwrlv.c
|
k_pwrlv.c
|
||||||
k_waypoint.c
|
k_waypoint.cpp
|
||||||
k_pathfind.c
|
k_pathfind.c
|
||||||
k_bheap.c
|
k_bheap.c
|
||||||
k_bot.c
|
k_bot.c
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@
|
||||||
// terms of the GNU General Public License, version 2.
|
// terms of the GNU General Public License, version 2.
|
||||||
// See the 'LICENSE' file for more details.
|
// See the 'LICENSE' file for more details.
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
/// \file k_waypoint.c
|
/// \file k_waypoint.cpp
|
||||||
/// \brief Waypoint handling from the relevant mobjs
|
/// \brief Waypoint handling from the relevant mobjs
|
||||||
/// Setup and interfacing with waypoints for the main game
|
/// Setup and interfacing with waypoints for the main game
|
||||||
|
|
||||||
|
|
@ -1768,7 +1768,7 @@ static waypoint_t *K_SearchWaypointGraph(
|
||||||
I_Assert(conditionalfunc != NULL);
|
I_Assert(conditionalfunc != NULL);
|
||||||
I_Assert(firstwaypoint != NULL);
|
I_Assert(firstwaypoint != NULL);
|
||||||
|
|
||||||
visitedarray = Z_Calloc(numwaypoints * sizeof(boolean), PU_STATIC, NULL);
|
visitedarray = static_cast<boolean*>(Z_Calloc(numwaypoints * sizeof(boolean), PU_STATIC, NULL));
|
||||||
foundwaypoint = K_TraverseWaypoints(firstwaypoint, conditionalfunc, condition, visitedarray);
|
foundwaypoint = K_TraverseWaypoints(firstwaypoint, conditionalfunc, condition, visitedarray);
|
||||||
Z_Free(visitedarray);
|
Z_Free(visitedarray);
|
||||||
|
|
||||||
|
|
@ -1929,16 +1929,18 @@ static void K_AddPrevToWaypoint(waypoint_t *const waypoint, waypoint_t *const pr
|
||||||
I_Assert(prevwaypoint != NULL);
|
I_Assert(prevwaypoint != NULL);
|
||||||
|
|
||||||
waypoint->numprevwaypoints++;
|
waypoint->numprevwaypoints++;
|
||||||
waypoint->prevwaypoints =
|
waypoint->prevwaypoints = static_cast<waypoint_t**>(
|
||||||
Z_Realloc(waypoint->prevwaypoints, waypoint->numprevwaypoints * sizeof(waypoint_t *), PU_LEVEL, NULL);
|
Z_Realloc(waypoint->prevwaypoints, waypoint->numprevwaypoints * sizeof(waypoint_t *), PU_LEVEL, NULL)
|
||||||
|
);
|
||||||
|
|
||||||
if (!waypoint->prevwaypoints)
|
if (!waypoint->prevwaypoints)
|
||||||
{
|
{
|
||||||
I_Error("K_AddPrevToWaypoint: Failed to reallocate memory for previous waypoints.");
|
I_Error("K_AddPrevToWaypoint: Failed to reallocate memory for previous waypoints.");
|
||||||
}
|
}
|
||||||
|
|
||||||
waypoint->prevwaypointdistances =
|
waypoint->prevwaypointdistances = static_cast<UINT32*>(
|
||||||
Z_Realloc(waypoint->prevwaypointdistances, waypoint->numprevwaypoints * sizeof(fixed_t), PU_LEVEL, NULL);
|
Z_Realloc(waypoint->prevwaypointdistances, waypoint->numprevwaypoints * sizeof(fixed_t), PU_LEVEL, NULL)
|
||||||
|
);
|
||||||
|
|
||||||
if (!waypoint->prevwaypointdistances)
|
if (!waypoint->prevwaypointdistances)
|
||||||
{
|
{
|
||||||
|
|
@ -1994,14 +1996,16 @@ static waypoint_t *K_MakeWaypoint(mobj_t *const mobj)
|
||||||
if (madewaypoint->numnextwaypoints != 0)
|
if (madewaypoint->numnextwaypoints != 0)
|
||||||
{
|
{
|
||||||
// Allocate memory to hold enough pointers to all of the next waypoints
|
// Allocate memory to hold enough pointers to all of the next waypoints
|
||||||
madewaypoint->nextwaypoints =
|
madewaypoint->nextwaypoints = static_cast<waypoint_t**>(
|
||||||
Z_Calloc(madewaypoint->numnextwaypoints * sizeof(waypoint_t *), PU_LEVEL, NULL);
|
Z_Calloc(madewaypoint->numnextwaypoints * sizeof(waypoint_t *), PU_LEVEL, NULL)
|
||||||
|
);
|
||||||
if (madewaypoint->nextwaypoints == NULL)
|
if (madewaypoint->nextwaypoints == NULL)
|
||||||
{
|
{
|
||||||
I_Error("K_MakeWaypoint: Out of Memory allocating next waypoints.");
|
I_Error("K_MakeWaypoint: Out of Memory allocating next waypoints.");
|
||||||
}
|
}
|
||||||
madewaypoint->nextwaypointdistances =
|
madewaypoint->nextwaypointdistances = static_cast<UINT32*>(
|
||||||
Z_Calloc(madewaypoint->numnextwaypoints * sizeof(fixed_t), PU_LEVEL, NULL);
|
Z_Calloc(madewaypoint->numnextwaypoints * sizeof(fixed_t), PU_LEVEL, NULL)
|
||||||
|
);
|
||||||
if (madewaypoint->nextwaypointdistances == NULL)
|
if (madewaypoint->nextwaypointdistances == NULL)
|
||||||
{
|
{
|
||||||
I_Error("K_MakeWaypoint: Out of Memory allocating next waypoint distances.");
|
I_Error("K_MakeWaypoint: Out of Memory allocating next waypoint distances.");
|
||||||
|
|
@ -2153,7 +2157,7 @@ static boolean K_AllocateWaypointHeap(void)
|
||||||
{
|
{
|
||||||
// Allocate space in the heap for every mobj, it's possible some mobjs aren't linked up and not all of the
|
// Allocate space in the heap for every mobj, it's possible some mobjs aren't linked up and not all of the
|
||||||
// heap allocated will be used, but it's a fairly reasonable assumption that this isn't going to be awful
|
// heap allocated will be used, but it's a fairly reasonable assumption that this isn't going to be awful
|
||||||
waypointheap = Z_Calloc(numwaypointmobjs * sizeof(waypoint_t), PU_LEVEL, NULL);
|
waypointheap = static_cast<waypoint_t*>(Z_Calloc(numwaypointmobjs * sizeof(waypoint_t), PU_LEVEL, NULL));
|
||||||
|
|
||||||
if (waypointheap == NULL)
|
if (waypointheap == NULL)
|
||||||
{
|
{
|
||||||
Loading…
Add table
Reference in a new issue