Skip to content

Fixed a IDDIT and IDDKT cheat codes bug#756

Open
DRON12261 wants to merge 2 commits into
team-eternity:masterfrom
dron12261games:dron12261-Fix_IDDIT_and_IDDKT_bug
Open

Fixed a IDDIT and IDDKT cheat codes bug#756
DRON12261 wants to merge 2 commits into
team-eternity:masterfrom
dron12261games:dron12261-Fix_IDDIT_and_IDDKT_bug

Conversation

@DRON12261

@DRON12261 DRON12261 commented May 23, 2026

Copy link
Copy Markdown
Contributor

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

…he iddkt and iddit cheats could no longer display them on the automap more than once (they did nothing when re-entered).
Comment thread source/am_map.cpp

// 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)))

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ If a thinker is not in the list, it means it was deleted (so it's no longer even in memory) in 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).

Comment thread source/am_map.cpp
{
th = th->next;

if(!th)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread source/am_map.cpp
if(current)
start_th = th = static_cast<Thinker *>(current);
else
start_th = th = &thinkercap;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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).

Comment thread source/am_map.cpp
while(th != start_th)
do
{
th = th->next;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Of course this will be with cnext if using the thinkerclasscap. I get that this fixes the actual observed bug.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants