mirror of
https://gitlab.com/skmp/dca3-game.git
synced 2025-09-08 21:50:52 +02:00
move InfoForTileCars, InfoForTilePeds to obj pool; they only live during init
This commit is contained in:
@@ -34,6 +34,9 @@ CPathInfoForObject *InfoForTilePeds;
|
|||||||
CTempDetachedNode *DetachedNodesCars;
|
CTempDetachedNode *DetachedNodesCars;
|
||||||
CTempDetachedNode *DetachedNodesPeds;
|
CTempDetachedNode *DetachedNodesPeds;
|
||||||
|
|
||||||
|
void* obj_alloc(size_t size);
|
||||||
|
void obj_free(void* ptr);
|
||||||
|
|
||||||
bool
|
bool
|
||||||
CPedPath::CalcPedRoute(int8 pathType, CVector position, CVector destination, CVector *pointPoses, int16 *pointsFound, int16 maxPoints)
|
CPedPath::CalcPedRoute(int8 pathType, CVector position, CVector destination, CVector *pointPoses, int16 *pointsFound, int16 maxPoints)
|
||||||
{
|
{
|
||||||
@@ -245,15 +248,22 @@ CPathFind::Init(void)
|
|||||||
void
|
void
|
||||||
CPathFind::AllocatePathFindInfoMem(int16 numPathGroups)
|
CPathFind::AllocatePathFindInfoMem(int16 numPathGroups)
|
||||||
{
|
{
|
||||||
delete[] InfoForTileCars;
|
assert(numPathGroups == 4500);
|
||||||
InfoForTileCars = nil;
|
|
||||||
delete[] InfoForTilePeds;
|
if (InfoForTileCars) {
|
||||||
InfoForTilePeds = nil;
|
obj_free(InfoForTileCars);
|
||||||
|
InfoForTileCars = nil;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (InfoForTilePeds) {
|
||||||
|
obj_free(InfoForTilePeds);
|
||||||
|
InfoForTilePeds = nil;
|
||||||
|
}
|
||||||
|
|
||||||
// NB: MIAMI doesn't use numPathGroups here but hardcodes 4500
|
// NB: MIAMI doesn't use numPathGroups here but hardcodes 4500
|
||||||
InfoForTileCars = new CPathInfoForObject[12*numPathGroups];
|
InfoForTileCars = (CPathInfoForObject*) obj_alloc(sizeof(CPathInfoForObject)*12*numPathGroups);
|
||||||
memset(InfoForTileCars, 0, 12*numPathGroups*sizeof(CPathInfoForObject));
|
memset(InfoForTileCars, 0, 12*numPathGroups*sizeof(CPathInfoForObject));
|
||||||
InfoForTilePeds = new CPathInfoForObject[12*numPathGroups];
|
InfoForTilePeds = (CPathInfoForObject*) obj_alloc(sizeof(CPathInfoForObject)*12*numPathGroups);
|
||||||
memset(InfoForTilePeds, 0, 12*numPathGroups*sizeof(CPathInfoForObject));
|
memset(InfoForTilePeds, 0, 12*numPathGroups*sizeof(CPathInfoForObject));
|
||||||
|
|
||||||
// unused
|
// unused
|
||||||
@@ -438,10 +448,15 @@ CPathFind::PreparePathData(void)
|
|||||||
CountFloodFillGroups(PATH_CAR);
|
CountFloodFillGroups(PATH_CAR);
|
||||||
CountFloodFillGroups(PATH_PED);
|
CountFloodFillGroups(PATH_PED);
|
||||||
|
|
||||||
delete[] InfoForTileCars;
|
if (InfoForTileCars) {
|
||||||
InfoForTileCars = nil;
|
obj_free(InfoForTileCars);
|
||||||
delete[] InfoForTilePeds;
|
InfoForTileCars = nil;
|
||||||
InfoForTilePeds = nil;
|
}
|
||||||
|
|
||||||
|
if (InfoForTilePeds) {
|
||||||
|
obj_free(InfoForTilePeds);
|
||||||
|
InfoForTilePeds = nil;
|
||||||
|
}
|
||||||
|
|
||||||
delete[] DetachedNodesCars;
|
delete[] DetachedNodesCars;
|
||||||
DetachedNodesCars = nil;
|
DetachedNodesCars = nil;
|
||||||
|
Reference in New Issue
Block a user