I am currently in the process of coding a roguelike, and teaching myself what I need as I go.
I am stuck on a problem which I found somewhat answered here: Best way to organize entities in a game?
I need to have an entity tree, with classes as described in the best response to that question.
It mentions iterating through a std::set to run each entity's "script" - but leaves some things I need to know unexplained.
In an implementation like that, how do I look something up with coordinates (ints in the class)? I suspect it's easier than running a For that iterates through everything until it finds the matching result...
How would I handle multiple things being in the same spot (item stacks etc)? I know I can have multiple instances of a class contain the same coords, but what would I get back from a look-up in that kind of situation?
Is there a way to iterate in, for example, descending order of an entity's "speed" stat?
Thanks~