MCPcopy Create free account
hub / github.com/OpenFodder/openfodder / PathNodePool

Method PathNodePool

Source/Utils/micropather.cpp:208–237  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

206
207
208PathNodePool::PathNodePool( unsigned _allocate, unsigned _typicalAdjacent )
209 : firstBlock( 0 ),
210 blocks( 0 ),
211#if defined( MICROPATHER_STRESS )
212 allocate( 32 ),
213#else
214 allocate( _allocate ),
215#endif
216 nAllocated( 0 ),
217 nAvailable( 0 )
218{
219 freeMemSentinel.InitSentinel();
220
221 cacheCap = allocate * _typicalAdjacent;
222 cacheSize = 0;
223 cache = (NodeCost*)malloc(cacheCap * sizeof(NodeCost));
224
225 // Want the behavior that if the actual number of states is specified, the cache
226 // will be at least that big.
227 hashShift = 3; // 8 (only useful for stress testing)
228#if !defined( MICROPATHER_STRESS )
229 while( HashSize() < allocate )
230 ++hashShift;
231#endif
232 hashTable = (PathNode**)calloc( HashSize(), sizeof(PathNode*) );
233
234 blocks = firstBlock = NewBlock();
235// printf( "HashSize=%d allocate=%d\n", HashSize(), allocate );
236 totalCollide = 0;
237}
238
239
240PathNodePool::~PathNodePool()

Callers

nothing calls this directly

Calls 1

InitSentinelMethod · 0.80

Tested by

no test coverage detected