From e2e6b3e15d8fb4408bedb9b4a04120069e2feeb2 Mon Sep 17 00:00:00 2001 From: Rushi <44952533+Skyliegirl33@users.noreply.github.com> Date: Thu, 27 Jun 2024 12:58:58 +0200 Subject: [PATCH] Throw exception if duplicate definitions of actions are found --- src/world/Action/ActionLutData.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/world/Action/ActionLutData.cpp b/src/world/Action/ActionLutData.cpp index d8a74a4d1..108f0b775 100644 --- a/src/world/Action/ActionLutData.cpp +++ b/src/world/Action/ActionLutData.cpp @@ -3,6 +3,7 @@ #include #include #include +#include using namespace Sapphire; using namespace Sapphire::World::Action; @@ -138,6 +139,10 @@ bool ActionLutData::cacheActions() { auto id = std::stoi( i.key() ); auto action = i.value().get< ActionEntry >(); + + if( ActionLut::m_actionLut.count( id ) > 0 ) + throw std::runtime_error( fmt::format( "Action with ID {} cannot be defined more than once (defined again in {})", i.key(), p.path().string() ) ); + ActionLut::m_actionLut.try_emplace( id, action ); }