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

Method Update

Source/Utils/micropather.cpp:135–165  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

133}
134
135void OpenQueue::Update( PathNode* pNode )
136{
137#ifdef DEBUG_PATH_DEEP
138 printf( "Open Update: " );
139 graph->PrintStateInfo( pNode->state );
140 printf( " total=%.1f\n", pNode->totalCost );
141#endif
142
143 MPASSERT( pNode->inOpen );
144
145 // If the node now cost less than the one before it,
146 // move it to the front of the list.
147 if ( pNode->prev != sentinel && pNode->totalCost < pNode->prev->totalCost ) {
148 pNode->Unlink();
149 sentinel->next->AddBefore( pNode );
150 }
151
152 // If the node is too high, move to the right.
153 if ( pNode->totalCost > pNode->next->totalCost ) {
154 PathNode* it = pNode->next;
155 pNode->Unlink();
156
157 while ( pNode->totalCost > it->totalCost )
158 it = it->next;
159
160 it->AddBefore( pNode );
161#ifdef DEBUG
162 sentinel->CheckList();
163#endif
164 }
165}
166
167
168class ClosedSet

Callers 2

SolveMethod · 0.80
SolveForNearStatesMethod · 0.80

Calls 4

PrintStateInfoMethod · 0.80
UnlinkMethod · 0.80
AddBeforeMethod · 0.80
CheckListMethod · 0.80

Tested by

no test coverage detected