MCPcopy Create free account
hub / github.com/TombEngine/TombEngine / ClearLOT

Function ClearLOT

TombEngine/Game/control/lot.cpp:406–425  ·  view source on GitHub ↗

* @brief Resets the LOT pathfinding state for a new search. * * Clears the search queue (Head/Tail) and resets all node data. Must be called * before starting a new pathfinding search or when the creature's zone changes. * * The search uses a linked-list queue structure: * - Head: First box to expand in the search. * - Tail: Last box in the expansion queue. * - Each node's nextExpansion li

Source from the content-addressed store, hash-verified

404 * @param LOT Pointer to the LOTInfo structure to clear.
405 */
406void ClearLOT(LOTInfo* LOT)
407{
408 // Clear the BFS queue pointers.
409 LOT->Head = NO_VALUE; // First box to expand (front of queue).
410 LOT->Tail = NO_VALUE; // Last box in queue (for appending).
411
412 // Reset search state.
413 LOT->SearchNumber = 0; // Incremented each new search to invalidate old data.
414 LOT->TargetBox = NO_VALUE; // The box we're pathfinding TO.
415 LOT->RequiredBox = NO_VALUE; // The box we WANT to pathfind to (triggers recalc).
416
417 // Reset all node data.
418 auto* node = LOT->Node.data();
419 for (auto& node : LOT->Node)
420 {
421 node.exitBox = NO_VALUE; // Direction to target (filled by SearchLOT).
422 node.nextExpansion = NO_VALUE; // Next node in BFS queue.
423 node.searchNumber = 0; // Which search this node was visited in.
424 }
425}
426
427/**
428 * @brief Creates the navigable zone for a creature based on its starting position.

Callers 2

UpdateBadBoxesFunction · 0.85
InitializeSlotFunction · 0.85

Calls 1

dataMethod · 0.45

Tested by

no test coverage detected