Skip to content

Commit

Permalink
Fix undo duplicate model crashes
Browse files Browse the repository at this point in the history
  • Loading branch information
UnrealKaraulov committed Dec 2, 2023
1 parent 750b254 commit f312402
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 4 additions & 1 deletion src/editor/Command.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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));


Expand Down
2 changes: 1 addition & 1 deletion src/util/lang.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit f312402

Please sign in to comment.