mirror of
https://github.com/TerryCavanagh/VVVVVV.git
synced 2026-11-24 14:29:20 +03:00
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:
1 parent
a926ce9851
commit
43bebecf3b
3 files changed
+46
-14
No files matched your search
@@ -22,6 +22,7 @@ class mapclass
|
||||
{
|
||||
public:
|
||||
mapclass(void);
|
||||
void destroy(void);
|
||||
|
||||
int getwidth(void);
|
||||
|
||||
@@ -33,6 +34,8 @@ public:
|
||||
|
||||
void settrinket(int x, int y);
|
||||
|
||||
void setroomname(const char* name);
|
||||
|
||||
void resetmap(void);
|
||||
|
||||
void resetnames(void);
|
||||
|
||||
Reference in new issue
Block a user