Fixed a IDDIT and IDDKT cheat codes bug#756
Conversation
…he iddkt and iddit cheats could no longer display them on the automap more than once (they did nothing when re-entered).
|
|
||
| // Validate current thinker, if any, to allow for the possibility that it was removed from the map since the last | ||
| // call | ||
| if(current && !IsThinkerInList(static_cast<Thinker *>(current))) |
There was a problem hiding this comment.
Thinker::removeDelayed, late when all references are gone. This will never happen as long as you have a valid current reference. Instead, what you should do is check if current->removed, and then P_ClearTarget(current) (not = nullptr because it will leak a reference).
| { | ||
| th = th->next; | ||
|
|
||
| if(!th) |
There was a problem hiding this comment.
Don't think !th can happen in any valid situation. Rather check if th->removed and continue.
Still, how do we handle RAVENRESPAWN artifacts where the Pickup.Remove animation does not lead to removal? They'll still exist in the game. Maybe check if the MF_SPECIAL flag is present? I didn't test this live. Also the same thing if item respawning is enabled; they'll just go into Pickup.Respawn without ever getting removed.
| if(current) | ||
| start_th = th = static_cast<Thinker *>(current); | ||
| else | ||
| start_th = th = &thinkercap; |
There was a problem hiding this comment.
Idea: when using iddkt, go through thinkerclasscap[th_enemies], not the main thinkercap. This will be a shorter list which only include the hostile monsters, not also the friends. You'll still need to check for MF_COUNTKILL so it doesn't also show lost souls (though it's up to you to decide if lost souls also need hunting down).
| while(th != start_th) | ||
| do | ||
| { | ||
| th = th->next; |
There was a problem hiding this comment.
Of course this will be with cnext if using the thinkerclasscap. I get that this fixes the actual observed bug.
Fixed a bug where only one item or monster remained on the map, and the iddkt and iddit cheats could no longer display them on the automap more than once (they did nothing when re-entered).
Related to #717