I've been working on a libtcod/C++ roguelike, and I've run into a small problem.
When the player goes between floors, the items from the previous floor stay on the new map, ending up in the walls, and each time I go between floors, more items generate until the map is swamped.
Is there any way to save a particular floor (perhaps with the seed) so that the actors' current x/y is preserved for reloading later?
Create a
Map
class which stores the map details (walls, stairs, etc), items on the floor and any monsters. Then you can create anstd::map<int, Map>
with the key being the floor number.Then whenever you change floors you check the
std::map
to see if theMap
object for that floor exists, if it does load it, if not create a newMap
.