Skip to content

Commit

Permalink
Merge pull request #963 from arieshi255/fix-lut
Browse files Browse the repository at this point in the history
[3.x] Throw exception if duplicate definitions of actions are found
  • Loading branch information
SapphireMordred committed Jun 27, 2024
2 parents 88ae073 + e2e6b3e commit 2a0e423
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/world/Action/ActionLutData.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#include <fstream>
#include <filesystem>
#include <iostream>
#include <Logging/Logger.h>

using namespace Sapphire;
using namespace Sapphire::World::Action;
Expand Down Expand Up @@ -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 );
}

Expand Down

0 comments on commit 2a0e423

Please sign in to comment.