From 8f33b469bef763e6603afe6b9818e2c3eee6999c Mon Sep 17 00:00:00 2001 From: Strangerke Date: Wed, 7 Sep 2016 07:14:50 +0200 Subject: DM: Get rid of a GOTO in projectileGetImpactCount --- engines/dm/projexpl.cpp | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) (limited to 'engines/dm') diff --git a/engines/dm/projexpl.cpp b/engines/dm/projexpl.cpp index c87a4fba8a..f5c0a71377 100644 --- a/engines/dm/projexpl.cpp +++ b/engines/dm/projexpl.cpp @@ -350,19 +350,18 @@ void ProjExpl::createExplosion(Thing explThing, uint16 attack, uint16 mapXCombo, int16 ProjExpl::projectileGetImpactCount(int16 impactType, int16 mapX, int16 mapY, int16 cell) { int16 impactCount = 0; _creatureDamageOutcome = k0_outcomeKilledNoCreaturesInGroup; -T0218001: - Thing curThing = _vm->_dungeonMan->getSquareFirstThing(mapX, mapY); - while (curThing != Thing::_endOfList) { - if (((curThing).getType() == k14_ProjectileThingType) && - ((curThing).getCell() == cell) && + + for (Thing curThing = _vm->_dungeonMan->getSquareFirstThing(mapX, mapY); curThing != Thing::_endOfList; ) { + if (((curThing).getType() == k14_ProjectileThingType) && ((curThing).getCell() == cell) && hasProjectileImpactOccurred(impactType, mapX, mapY, cell, curThing)) { projectileDeleteEvent(curThing); impactCount++; if ((impactType == kM1_CreatureElemType) && (_creatureDamageOutcome == k2_outcomeKilledAllCreaturesInGroup)) break; - goto T0218001; - } - curThing = _vm->_dungeonMan->getNextThing(curThing); + + Thing curThing = _vm->_dungeonMan->getSquareFirstThing(mapX, mapY); + } else + curThing = _vm->_dungeonMan->getNextThing(curThing); } return impactCount; } -- cgit v1.2.3