diff --git a/apps/openmw/mwmp/DedicatedPlayer.cpp b/apps/openmw/mwmp/DedicatedPlayer.cpp index 3ee25ac9a..2c0df877f 100644 --- a/apps/openmw/mwmp/DedicatedPlayer.cpp +++ b/apps/openmw/mwmp/DedicatedPlayer.cpp @@ -160,7 +160,7 @@ void DedicatedPlayer::setBaseInfo() if (!reference) { - npc.mId = RecordHelper::createNpcRecord(npc); + npc.mId = RecordHelper::createRecord(npc)->mId; createReference(npc.mId); } else @@ -202,7 +202,7 @@ void DedicatedPlayer::setShapeshift() // and reuse it if (creatureRecordId.empty()) { - creature.mId = creatureRecordId = RecordHelper::createCreatureRecord(creature); + creature.mId = creatureRecordId = RecordHelper::createRecord(creature)->mId; LOG_APPEND(TimedLog::LOG_INFO, "- Creating new creature record %s", creatureRecordId.c_str()); } else diff --git a/apps/openmw/mwmp/RecordHelper.cpp b/apps/openmw/mwmp/RecordHelper.cpp index 1cc9fcf37..97bc6d958 100644 --- a/apps/openmw/mwmp/RecordHelper.cpp +++ b/apps/openmw/mwmp/RecordHelper.cpp @@ -7,20 +7,6 @@ #include "RecordHelper.hpp" -std::string RecordHelper::createCreatureRecord(const ESM::Creature& record) -{ - MWBase::World *world = MWBase::Environment::get().getWorld(); - - return world->createRecord(record)->mId; -} - -std::string RecordHelper::createNpcRecord(const ESM::NPC& record) -{ - MWBase::World *world = MWBase::Environment::get().getWorld(); - - return world->createRecord(record)->mId; -} - void RecordHelper::overrideCreatureRecord(const mwmp::CreatureRecord& record) { const ESM::Creature &recordData = record.data; diff --git a/apps/openmw/mwmp/RecordHelper.hpp b/apps/openmw/mwmp/RecordHelper.hpp index a413afab0..5666df9e8 100644 --- a/apps/openmw/mwmp/RecordHelper.hpp +++ b/apps/openmw/mwmp/RecordHelper.hpp @@ -8,9 +8,6 @@ namespace RecordHelper { - std::string createCreatureRecord(const ESM::Creature& record); - std::string createNpcRecord(const ESM::NPC& record); - void overrideCreatureRecord(const mwmp::CreatureRecord& record); void overrideNpcRecord(const mwmp::NpcRecord& record); @@ -38,14 +35,6 @@ namespace RecordHelper void overrideLightRecord(const mwmp::LightRecord& record); void overrideCellRecord(const mwmp::CellRecord& record); - template - bool doesRecordIdExist(const std::string& id) - { - MWBase::World *world = MWBase::Environment::get().getWorld(); - - return world->getStore().get().search(id); - } - template void overrideRecord(const RecordType &record) { @@ -53,6 +42,22 @@ namespace RecordHelper world->getModifiableStore().overrideRecord(record); } + + template + const RecordType *createRecord(const RecordType &record) + { + MWBase::World *world = MWBase::Environment::get().getWorld(); + + return world->createRecord(record); + } + + template + bool doesRecordIdExist(const std::string& id) + { + MWBase::World *world = MWBase::Environment::get().getWorld(); + + return world->getStore().get().search(id); + } }