mirror of
https://github.com/DrBeef/Raze.git
synced 2024-11-15 08:52:00 +00:00
- Text code for AI state saving
This commit is contained in:
parent
91b7770e84
commit
488f8b1526
1 changed files with 9 additions and 0 deletions
|
@ -431,15 +431,18 @@ static AISTATE* allAIStates[] =
|
|||
void IndexAIState(AISTATE*& state)
|
||||
{
|
||||
int i = 0;
|
||||
auto savestate = state;
|
||||
for (auto cstate : allAIStates)
|
||||
{
|
||||
if (state == cstate)
|
||||
{
|
||||
state = (AISTATE*)(intptr_t)i;
|
||||
Printf("Indexing state %p as %d. State really is %p\n", savestate, i, state);
|
||||
return;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
Printf("Unable to index state %p. Not found in list\n", savestate);
|
||||
state = nullptr;
|
||||
}
|
||||
|
||||
|
@ -448,8 +451,14 @@ void UnindexAIState(AISTATE*& state)
|
|||
auto index = intptr_t(state);
|
||||
if (index >= 0 && index < countof(allAIStates))
|
||||
{
|
||||
Printf("Unindexing %i to state %p\n", int(index), state);
|
||||
state = allAIStates[index];
|
||||
}
|
||||
else
|
||||
{
|
||||
Printf("Unable to unindex state %d\n", int(index));
|
||||
state = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue