Comments (3)
In simulation's update()
function, I have a check at the very bottom (below checkForFights
and updateColoniesStats
) that checks to see if any colonies are extinct. It looks like this:
for (Colony& colony : colonies) { if (colony.eliminated) removeColony(colony.id); }
eliminated
is a bool that is triggered when the ant population is equal to zero.
When debugging, I see that the error originates from removeColony(uint8_t colony_id) and occurs in the for loop with
c.stopFightsWith(colony_id);`
From there, the next error takes place in the Colony class in the stopFightsWith
function, inside of the for loop, at if(a.target) {
Where a.target
seems to be the problem. Here is the call stack:
Note that the first four lines have line numbers that should match with yours. Everything below operator bool() Line 359
probably differs from your code.
from antsimulator.
My thoughts:
I don't think anything I added to your code managed to cause this problem.
I think the problem comes from trying to iterate over the Ants of a colony that no longer exists (was deleted because population was 0). Maybe there is a problem with Ant.target when the colony is extinct, when there are no ants, or when the colony no longer exists?
In any case, debugging keeps pointing to lines of code involving if (ants.target)
, even when I try to patch this bug.
Let me know if there is anything I can do to help!
Regards,
Marco
from antsimulator.
Hello,
Thank you for your detailed analysis, I will look into this
from antsimulator.
Related Issues (20)
- Scaling for the editor GUI? HOT 4
- Commands HOT 3
- Can't run executable HOT 2
- Random Number Generator does not work HOT 4
- Is there a way to move the thingies that allow you to manipulate the game? HOT 2
- Speed up time? HOT 10
- Game Crash When 3 Colonies
- The program crashes when adding a colony outside of the map HOT 1
- Program crashes when maximum ants per colony is set under 1000
- Fails to load assets
- saving
- keeps saying "file not found"
- How to place stuff HOT 1
- CMake fail for Linux related to SFML HOT 1
- Adding multi-threading?
- How to adjust the panels??
- How to Compile, run it on MAC OS
- Compiling with docker fails (ubuntu 23.10)
- common grid/array2D library
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from antsimulator.