Strange Behavior of the game.creeps list
Bug #188395 reported by
simpsus
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
pyTD |
Fix Released
|
Undecided
|
Unassigned |
Bug Description
When a creep is dying, and the Game class tries to remove it from the "creeps" list via:
self.creeps.
it is not found in the list and an exception is thrown.
However the creep is of course in the list and this code does the job
for c in self.creeps:
if c.id == creep.id:
there seems to be an issue with how the remove function compares the creeps, especially because
c == creep
in the body of the if above is True....
Changed in pytd: | |
status: | New → Confirmed |
Changed in pytd: | |
status: | Confirmed → Fix Released |
To post a comment you must log in.
I couldn't actually replicate this behaviour, so I've switched the code back - if you do get it again, do the following:
* In the first line of the method, put "import pdb ; pdb.set_trace()"
* When the trace starts, run the following commands:
- print creep, id(creep)
- print self.creeps, [ id(c) for c in self.creeps ]
- print creep in self.creeps
Chuck the output of those onto this ticket, we'll have a closer look. If you haven't used pdb before, it's a worthwhile tool to get used to - helps a lot ;) Just never check a pdb statement in, it confuses the end users...