if (ch->in_room) // <—– fix?
damage(ch,ch,dam,sn,DAM_LIGHTNING,TRUE);
level -= 4; /* decrement damage */
SmartIterator it = room.iterate_chars();
while (it.hasNext()) {
Character c = it.next();
// do stuff
}
SmartIterator it = room.iterate_chars();
–>
Room::iterate_chars():
- construct an iteration state object
- set its current-character pointer to self.first_character_in_room
while (it.hasNext()) {
–>
iterator state object :: hasNext() :
- if current pointer is null: return false
- else:
- if current pointer is valid: return true
- else:
- recursively apply this logic to the next character
Character c = it.next();
–>
iterator state object :: next():
- basically same as above, but modify state while you're at it, and return the character in question
It's on line 1271 of magic.c under spell_chain_lightning.
I'm assuming this is an attempt to check if the player dies after he's damaged. This should never really work correctly. Does ROM even have a mechanism to work with this? I suppose you could check ch->position == POS_DEAD.