#include #include "../mwbase/environment.hpp" #include "../mwworld/worldimp.hpp" #include "RecordHelper.hpp" bool RecordHelper::doesCreatureExist(const std::string& refId) { MWBase::World *world = MWBase::Environment::get().getWorld(); return world->getStore().get().search(refId); } bool RecordHelper::doesRaceExist(const std::string& raceId) { MWBase::World *world = MWBase::Environment::get().getWorld(); return world->getStore().get().search(raceId); } std::string RecordHelper::createCreatureRecord(const ESM::Creature& creature) { MWBase::World *world = MWBase::Environment::get().getWorld(); return world->createRecord(creature)->mId; } std::string RecordHelper::createNpcRecord(const ESM::NPC& npc) { MWBase::World *world = MWBase::Environment::get().getWorld(); return world->createRecord(npc)->mId; } void RecordHelper::updateCreatureRecord(const ESM::Creature& creature) { MWBase::World *world = MWBase::Environment::get().getWorld(); MWWorld::ESMStore *esmStore = const_cast(&world->getStore()); MWWorld::Store *creatureStore = const_cast *> (&esmStore->get()); creatureStore->insert(creature); } void RecordHelper::updateNpcRecord(const ESM::NPC& npc) { MWBase::World *world = MWBase::Environment::get().getWorld(); MWWorld::ESMStore *esmStore = const_cast(&world->getStore()); MWWorld::Store *npcStore = const_cast *> (&esmStore->get()); npcStore->insert(npc); }