Make room names own their own memory

This makes it so room names are no longer pointers to someone else's
memory, and instead to set them you use `mapclass::setroomname`. If the
string is short enough to fit in a static, no-alloc buffer, then it gets
copied there. Otherwise, a new heap allocation is made that duplicates
the string, and the new pointer is used instead.

This makes it possible for room names to contain arbitrary data whose
origin is temporary (e.g. from a script command that could be added in
the future).
This commit is contained in:
Misa
2022-11-30 22:35:42 -08:00
parent a926ce9851
commit 43bebecf3b
3 changed files with 46 additions and 14 deletions

View File

@@ -755,6 +755,7 @@ static void cleanup(void)
graphics.destroy_buffers();
graphics.destroy();
music.destroy();
map.destroy();
NETWORK_shutdown();
SDL_Quit();
FILESYSTEM_deinit();