mirror of
https://github.com/SapphireServer/Sapphire.git
synced 2025-04-23 13:17:45 +00:00
Throw exception if duplicate definitions of actions are found
This commit is contained in:
parent
88ae073089
commit
e2e6b3e15d
1 changed files with 5 additions and 0 deletions
|
@ -3,6 +3,7 @@
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include <filesystem>
|
#include <filesystem>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
#include <Logging/Logger.h>
|
||||||
|
|
||||||
using namespace Sapphire;
|
using namespace Sapphire;
|
||||||
using namespace Sapphire::World::Action;
|
using namespace Sapphire::World::Action;
|
||||||
|
@ -138,6 +139,10 @@ bool ActionLutData::cacheActions()
|
||||||
{
|
{
|
||||||
auto id = std::stoi( i.key() );
|
auto id = std::stoi( i.key() );
|
||||||
auto action = i.value().get< ActionEntry >();
|
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 );
|
ActionLut::m_actionLut.try_emplace( id, action );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue