- fixed a variable mixup in Dehacked weapon initialization.

This ultimately failed to set the weapon's AmmoUse field and made the weapon fail to detect it's out of ammo.
This commit is contained in:
Christoph Oelckers 2016-11-25 12:31:13 +01:00
commit 82e5e2daa9

View file

@ -3085,10 +3085,10 @@ void FinishDehPatch ()
StateVisited[state] = true;
for(unsigned j = 0; AmmoPerAttacks[j].func != NAME_None; j++)
{
if (AmmoPerAttacks[i].ptr == nullptr)
if (AmmoPerAttacks[j].ptr == nullptr)
{
auto p = dyn_cast<PFunction>(RUNTIME_CLASS(AStateProvider)->Symbols.FindSymbol(AmmoPerAttacks[i].func, true));
if (p != nullptr) AmmoPerAttacks[i].ptr = p->Variants[0].Implementation;
auto p = dyn_cast<PFunction>(RUNTIME_CLASS(AStateProvider)->Symbols.FindSymbol(AmmoPerAttacks[j].func, true));
if (p != nullptr) AmmoPerAttacks[j].ptr = p->Variants[0].Implementation;
}
if (state->ActionFunc == AmmoPerAttacks[j].ptr)
{