Reworking the control flow for my tactical role-playing game

Liam McGillivray yoshi.pit.link.mario at gmail.com
Sat Mar 23 23:59:18 UTC 2024


On Saturday, 23 March 2024 at 04:32:29 UTC, harakim wrote:
This comment points to a symptom of the circular
> dependency: //Always set `destroy` to false when calling from 
> the Unit destructor, to avoid an infinite loop.

I was just doing some work on the AI system, and I had a segfault 
every time the enemy was in reach to attack a unit. It turns out 
this was because the destructor was called. I replaced 
`destroy(unit)` with `map.deleteUnit(unit)`, and it solved the 
problem.


More information about the Digitalmars-d-learn mailing list