diff options
| author | aura <nw@moneybot.cc> | 2026-03-16 10:15:01 +0100 |
|---|---|---|
| committer | aura <nw@moneybot.cc> | 2026-03-16 10:15:01 +0100 |
| commit | fdc5e8760fb7ac0af8e7ebb98a2076db15e31082 (patch) | |
| tree | c94991e1e594c7703295aa413caf40786f343c1f /src/editor/editor.cpp | |
| parent | e2829336cfedb39d23263f75b61ed969c8193534 (diff) | |
giga refactor, fix ALL the leaks
Diffstat (limited to 'src/editor/editor.cpp')
| -rw-r--r-- | src/editor/editor.cpp | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/src/editor/editor.cpp b/src/editor/editor.cpp index dee5080..e2267b8 100644 --- a/src/editor/editor.cpp +++ b/src/editor/editor.cpp @@ -604,8 +604,8 @@ STAT editor_new_map( GAME_EDITOR* e, const char* mapname ) { WORLD_MAP* m = new WORLD_MAP; defer( map_free( e->game, m ) ); - strcpy( m->name, mapname ); - strcat( m->name, ".hmap" ); + m->name = mapname; + m->name += ".hmap"; m->startpos = { 10.f, 10.f, 0.f }; m->props.push( { .clr = { 1.f, 1.f, 1.f, 1.f } } ); @@ -641,11 +641,10 @@ STAT editor_save_map( GAME_EDITOR* e ) { if( !serialized ) return STAT_ERR; defer( cfg_free( serialized ) ); - char full_path[256]; - sprintf( full_path, "../assets/maps/%s", e->map->name ); + STR full_path = { "../assets/maps/%s", e->map->name.data }; if( !OK( cfg_save( serialized, full_path ) ) ) { - dlog( "failed to save map %s", full_path ); + dlog( "failed to save map %s", full_path.data ); return STAT_ERR; } |
