Hi everyone -
In working on the wilderness system for Luminari, I need to change the names of rooms on the fly as the player enters them. I have been doing the following:
Code:
if (world[room].name)
free(world[room].name);
if(regions) {
world[room].name = strdup(region_table[regions->rnum].name);
} else {
world[room].name = "The Wilderness of Luminari";
}
This sets the room name to match the current region (a separate structure that is defined by a polygon, that is something for another post.)
Running this in valgrind says that I am performing an illegal free() at the line free(world[room].name).
If I just run this on the mud, it will crash the mud. This only happens occasionally, not for every room.
Anyone have any ideas? Has anyone been able to manage dynamic room names/descriptions? I am really at a loss, but it might just be because I have been staring at it for so long.
Thanks.