- Exhumed: fixed trap setup.

Must clear the structure before the first return and iterate over the walls by reference, otherwise bad pointers will get copied.
This commit is contained in:
Christoph Oelckers 2021-12-21 14:33:25 +01:00
parent beddf1e1ca
commit e42c3afbea

View file

@ -1210,6 +1210,7 @@ int BuildTrap(DExhumedActor* pActor, int edx, int ebx, int ecx)
int var_10 = ecx;
int nTrap = sTrap.Reserve(1);
sTrap[nTrap] = {};
ChangeActorStat(pActor, 0);
@ -1241,12 +1242,9 @@ int BuildTrap(DExhumedActor* pActor, int edx, int ebx, int ecx)
return nTrap;
}
sTrap[nTrap].pWall1 = nullptr;
sTrap[nTrap].pWall2 = nullptr;
auto pSector = pSprite->sector();
for(auto wal : wallsofsector(pSector))
for(auto& wal : wallsofsector(pSector))
{
if (var_18 == wal.hitag)
{