From fdc5e8760fb7ac0af8e7ebb98a2076db15e31082 Mon Sep 17 00:00:00 2001 From: aura Date: Mon, 16 Mar 2026 10:15:01 +0100 Subject: giga refactor, fix ALL the leaks --- src/editor/editor.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'src/editor/editor.cpp') 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; } -- cgit v1.2.3 From e59a032fb9afac6496acf3fba51a2a329bd0f992 Mon Sep 17 00:00:00 2001 From: aura Date: Mon, 16 Mar 2026 13:35:33 +0100 Subject: more editor work --- src/editor/editor.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/editor/editor.cpp') diff --git a/src/editor/editor.cpp b/src/editor/editor.cpp index e2267b8..bc14146 100644 --- a/src/editor/editor.cpp +++ b/src/editor/editor.cpp @@ -610,9 +610,9 @@ STAT editor_new_map( GAME_EDITOR* e, const char* mapname ) { m->startpos = { 10.f, 10.f, 0.f }; m->props.push( { .clr = { 1.f, 1.f, 1.f, 1.f } } ); m->walls.push( { + .propid = 0, .start = { 0 , 0, -40.f }, .end = { 10.f, 0, 80.f }, - .propid = 0 } ); CFG_SECTION* map_cfg = map_serialize( m ); -- cgit v1.2.3 From 991352b0d2767e6bd1a46f554db4ac9d208c13ad Mon Sep 17 00:00:00 2001 From: aura Date: Mon, 16 Mar 2026 15:40:03 +0100 Subject: finish prop rewrite --- src/editor/editor.cpp | 1 - 1 file changed, 1 deletion(-) (limited to 'src/editor/editor.cpp') diff --git a/src/editor/editor.cpp b/src/editor/editor.cpp index bc14146..ba61961 100644 --- a/src/editor/editor.cpp +++ b/src/editor/editor.cpp @@ -56,7 +56,6 @@ static U8 editor_clr_eq( const CLR& a, const CLR& b ) { static U8 editor_vertex_eq( const MAP_VERTEX& a, const MAP_VERTEX& b ) { return a.pos == b.pos - && a.normal == b.normal && a.uv == b.uv && editor_clr_eq( a.clr, b.clr ); } -- cgit v1.2.3