Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ERROR- RemoveCritter asked to remove a critter that dont exist. #1

Open
tung opened this issue Oct 24, 2011 · 2 comments
Open

ERROR- RemoveCritter asked to remove a critter that dont exist. #1

tung opened this issue Oct 24, 2011 · 2 comments

Comments

@tung
Copy link
Owner

tung commented Oct 24, 2011

"ERROR- RemoveCritter asked to remove a critter that dont exist."

This message appears every so often during play. The game still seems playable afterwards, but the map display is shifted slightly by it, which is ugly.

@james-conrad
Copy link

This seems to happen when a Critter is killed on its action (possibly by walking into a trap). In CritterAction it checks if the Critter's HP < 0, at which point it calls CritterDeath (a second time) on that Critter. This second call to CritterDeath is what's causing the error. You can protect against this by checking SC^.CAct before calling CritterDeath the second time.

diff --git a/cbrain.pp b/cbrain.pp
index c1e9ad2..8cda48f 100644
--- a/cbrain.pp
+++ b/cbrain.pp
@@ -462,11 +462,14 @@ begin
                end;
        end;

+       {Protect against the case where the creature has already died}
+       if SC^.CAct <> Nil then begin
                {Update the critter's status.}
                if NAttValue(C^.SF,NAG_StatusChange,SEF_Poison) <> 0 then begin
                        C^.HP := C^.HP - Random( 6 );
                end;
                UpdateStatusList( C^.SF );
+       end;

        if C^.HP < 0 then CritterDeath(SC,C,False);
        C := SC^.CAct;

@toastbar
Copy link

Wow thanks I've been waiting for this for 8 years.

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

No branches or pull requests

3 participants