From 2b72de44d5fb309036b619235ff9c0c68e8dfcce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ricardo=20Lu=C3=ADs=20Vaz=20Silva?= Date: Wed, 16 Apr 2025 23:20:23 -0300 Subject: [PATCH] use TryEmplace --- src/playsim/a_dynlight.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/playsim/a_dynlight.cpp b/src/playsim/a_dynlight.cpp index 4351592f7..934dbc081 100644 --- a/src/playsim/a_dynlight.cpp +++ b/src/playsim/a_dynlight.cpp @@ -430,11 +430,11 @@ void FDynamicLight::AddLightNode(FSection *section, side_t *sidedef) { auto updateFlatTList = [&](FSection *sec) { - touchlists->flat_tlist.Insert(sec, sec); + touchlists->flat_tlist.TryEmplace(sec, sec); }; auto updateWallTList = [&](side_t *sidedef) { - touchlists->wall_tlist.Insert(sidedef, sidedef); + touchlists->wall_tlist.TryEmplace(sidedef, sidedef); }; if (section) @@ -448,7 +448,7 @@ void FDynamicLight::AddLightNode(FSection *section, side_t *sidedef) node->lightsource = this; node->targ = section; - flatLightList->Insert(this, node); + flatLightList->TryEmplace(this, node); updateFlatTList(section); } } @@ -459,8 +459,8 @@ void FDynamicLight::AddLightNode(FSection *section, side_t *sidedef) node->targ = section; TMap u; - u.Insert(this, node); - Level->lightlists.flat_dlist.Insert(section, u); + u.TryEmplace(this, node); + Level->lightlists.flat_dlist.TryEmplace(section, u); updateFlatTList(section); } } @@ -475,7 +475,7 @@ void FDynamicLight::AddLightNode(FSection *section, side_t *sidedef) node->lightsource = this; node->targ = sidedef; - wallLightList->Insert(this, node); + wallLightList->TryEmplace(this, node); updateWallTList(sidedef); } } @@ -486,8 +486,8 @@ void FDynamicLight::AddLightNode(FSection *section, side_t *sidedef) node->targ = sidedef; TMap u; - u.Insert(this, node); - Level->lightlists.wall_dlist.Insert(sidedef, u); + u.TryEmplace(this, node); + Level->lightlists.wall_dlist.TryEmplace(sidedef, u); updateWallTList(sidedef); } }