From f3124026fb5f620bd36b0e3e89c250905347b78b Mon Sep 17 00:00:00 2001 From: Unreal Karaulov Date: Sat, 2 Dec 2023 14:34:02 +0300 Subject: [PATCH] Fix undo duplicate model crashes --- src/editor/Command.cpp | 5 ++++- src/util/lang.cpp | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/editor/Command.cpp b/src/editor/Command.cpp index 2151e820..4480ed72 100644 --- a/src/editor/Command.cpp +++ b/src/editor/Command.cpp @@ -307,12 +307,15 @@ void DuplicateBspModelCommand::undo() Bsp* map = getBsp(); BspRenderer* renderer = getBspRenderer(); - Entity* ent = map->ents[entIdx]; g_app->deselectObject(); map->replace_lumps(oldLumps); + map->update_ent_lump(); + + + Entity* ent = map->ents[entIdx]; ent->setOrAddKeyvalue("model", "*" + std::to_string(oldModelIdx)); diff --git a/src/util/lang.cpp b/src/util/lang.cpp index 8ee0571e..ce2c41bc 100644 --- a/src/util/lang.cpp +++ b/src/util/lang.cpp @@ -20,7 +20,7 @@ std::string get_localized_string(int id) if (itr == lang_db.end()) { - std::string value = ft->GetSection(g_settings.language)->GetValue(fmt::format("LANG_{:04}", id), fmt::format("LANG_{:04}", id)).AsString(); + std::string value = ft->GetSection(g_settings.language)->GetValue(fmt::format("LANG_{:04}", id), fmt::format("NO LANG_{:04}", id)).AsString(); replaceAll(value, "\\n", "\n"); lang_db[id] = value; return value;