mirror of
https://github.com/OpenMW/openmw.git
synced 2025-02-28 17:39:42 +00:00
Remove createRecord
functions from World because the only forward the argument to ESMStore that can be used directly.
This commit is contained in:
parent
a6584557e5
commit
227a993b94
25 changed files with 52 additions and 260 deletions
|
@ -147,7 +147,8 @@ namespace MWBase
|
|||
virtual MWWorld::Ptr getPlayerPtr() = 0;
|
||||
virtual MWWorld::ConstPtr getPlayerConstPtr() const = 0;
|
||||
|
||||
virtual const MWWorld::ESMStore& getStore() const = 0;
|
||||
virtual MWWorld::ESMStore& getStore() = 0;
|
||||
const MWWorld::ESMStore& getStore() const { return const_cast<MWBase::World*>(this)->getStore(); }
|
||||
|
||||
virtual const std::vector<int>& getESMVersions() const = 0;
|
||||
|
||||
|
@ -344,66 +345,6 @@ namespace MWBase
|
|||
///< Toggle a render mode.
|
||||
///< \return Resulting mode
|
||||
|
||||
virtual const ESM::Potion* createRecord(const ESM::Potion& record) = 0;
|
||||
///< Create a new record (of type potion) in the ESM store.
|
||||
/// \return pointer to created record
|
||||
|
||||
virtual const ESM::Spell* createRecord(const ESM::Spell& record) = 0;
|
||||
///< Create a new record (of type spell) in the ESM store.
|
||||
/// \return pointer to created record
|
||||
|
||||
virtual const ESM::Class* createRecord(const ESM::Class& record) = 0;
|
||||
///< Create a new record (of type class) in the ESM store.
|
||||
/// \return pointer to created record
|
||||
|
||||
virtual const ESM::Cell* createRecord(const ESM::Cell& record) = 0;
|
||||
///< Create a new record (of type cell) in the ESM store.
|
||||
/// \return pointer to created record
|
||||
|
||||
virtual const ESM::NPC* createRecord(const ESM::NPC& record) = 0;
|
||||
///< Create a new record (of type npc) in the ESM store.
|
||||
/// \return pointer to created record
|
||||
|
||||
virtual const ESM::Armor* createRecord(const ESM::Armor& record) = 0;
|
||||
///< Create a new record (of type armor) in the ESM store.
|
||||
/// \return pointer to created record
|
||||
|
||||
virtual const ESM::Weapon* createRecord(const ESM::Weapon& record) = 0;
|
||||
///< Create a new record (of type weapon) in the ESM store.
|
||||
/// \return pointer to created record
|
||||
|
||||
virtual const ESM::Clothing* createRecord(const ESM::Clothing& record) = 0;
|
||||
///< Create a new record (of type clothing) in the ESM store.
|
||||
/// \return pointer to created record
|
||||
|
||||
virtual const ESM::Enchantment* createRecord(const ESM::Enchantment& record) = 0;
|
||||
///< Create a new record (of type enchantment) in the ESM store.
|
||||
/// \return pointer to created record
|
||||
|
||||
virtual const ESM::Book* createRecord(const ESM::Book& record) = 0;
|
||||
///< Create a new record (of type book) in the ESM store.
|
||||
/// \return pointer to created record
|
||||
|
||||
virtual const ESM::CreatureLevList* createOverrideRecord(const ESM::CreatureLevList& record) = 0;
|
||||
///< Write this record to the ESM store, allowing it to override a pre-existing record with the same ID.
|
||||
/// \return pointer to created record
|
||||
|
||||
virtual const ESM::ItemLevList* createOverrideRecord(const ESM::ItemLevList& record) = 0;
|
||||
///< Write this record to the ESM store, allowing it to override a pre-existing record with the same ID.
|
||||
/// \return pointer to created record
|
||||
|
||||
virtual const ESM::Creature* createOverrideRecord(const ESM::Creature& record) = 0;
|
||||
///< Write this record to the ESM store, allowing it to override a pre-existing record with the same ID.
|
||||
/// \return pointer to created record
|
||||
|
||||
virtual const ESM::NPC* createOverrideRecord(const ESM::NPC& record) = 0;
|
||||
///< Write this record to the ESM store, allowing it to override a pre-existing record with the same ID.
|
||||
/// \return pointer to created record
|
||||
|
||||
virtual const ESM::Container* createOverrideRecord(const ESM::Container& record) = 0;
|
||||
///< Write this record to the ESM store, allowing it to override a pre-existing record with the same ID.
|
||||
/// \return pointer to created record
|
||||
|
||||
virtual MWWorld::Ptr placeObject(const MWWorld::ConstPtr& object, float cursorX, float cursorY, int amount) = 0;
|
||||
///< copy and place an object into the gameworld at the specified cursor position
|
||||
/// @param object
|
||||
|
|
|
@ -289,7 +289,7 @@ namespace MWClass
|
|||
newItem.mName = newName;
|
||||
newItem.mData.mEnchant = enchCharge;
|
||||
newItem.mEnchant = enchId;
|
||||
const ESM::Armor* record = MWBase::Environment::get().getWorld()->createRecord(newItem);
|
||||
const ESM::Armor* record = MWBase::Environment::get().getWorld()->getStore().insert(newItem);
|
||||
return record->mId;
|
||||
}
|
||||
|
||||
|
@ -300,8 +300,12 @@ namespace MWClass
|
|||
int armorSkillType = getEquipmentSkill(ptr);
|
||||
float armorSkill = actor.getClass().getSkill(actor, armorSkillType);
|
||||
|
||||
const MWBase::World* world = MWBase::Environment::get().getWorld();
|
||||
int iBaseArmorSkill = world->getStore().get<ESM::GameSetting>().find("iBaseArmorSkill")->mValue.getInteger();
|
||||
int iBaseArmorSkill = MWBase::Environment::get()
|
||||
.getWorld()
|
||||
->getStore()
|
||||
.get<ESM::GameSetting>()
|
||||
.find("iBaseArmorSkill")
|
||||
->mValue.getInteger();
|
||||
|
||||
if (ref->mBase->mData.mWeight == 0)
|
||||
return ref->mBase->mData.mArmor;
|
||||
|
|
|
@ -151,7 +151,7 @@ namespace MWClass
|
|||
newItem.mData.mIsScroll = 1;
|
||||
newItem.mData.mEnchant = enchCharge;
|
||||
newItem.mEnchant = enchId;
|
||||
const ESM::Book* record = MWBase::Environment::get().getWorld()->createRecord(newItem);
|
||||
const ESM::Book* record = MWBase::Environment::get().getWorld()->getStore().insert(newItem);
|
||||
return record->mId;
|
||||
}
|
||||
|
||||
|
|
|
@ -196,7 +196,7 @@ namespace MWClass
|
|||
newItem.mName = newName;
|
||||
newItem.mData.mEnchant = enchCharge;
|
||||
newItem.mEnchant = enchId;
|
||||
const ESM::Clothing* record = MWBase::Environment::get().getWorld()->createRecord(newItem);
|
||||
const ESM::Clothing* record = MWBase::Environment::get().getWorld()->getStore().insert(newItem);
|
||||
return record->mId;
|
||||
}
|
||||
|
||||
|
|
|
@ -91,8 +91,8 @@ namespace MWClass
|
|||
static const GMST staticGmst = [] {
|
||||
GMST gmst;
|
||||
|
||||
const MWBase::World* world = MWBase::Environment::get().getWorld();
|
||||
const MWWorld::Store<ESM::GameSetting>& store = world->getStore().get<ESM::GameSetting>();
|
||||
const MWWorld::Store<ESM::GameSetting>& store
|
||||
= MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>();
|
||||
|
||||
gmst.fMinWalkSpeedCreature = store.find("fMinWalkSpeedCreature");
|
||||
gmst.fMaxWalkSpeedCreature = store.find("fMaxWalkSpeedCreature");
|
||||
|
|
|
@ -276,8 +276,8 @@ namespace MWClass
|
|||
static const GMST staticGmst = [] {
|
||||
GMST gmst;
|
||||
|
||||
const MWBase::World* world = MWBase::Environment::get().getWorld();
|
||||
const MWWorld::Store<ESM::GameSetting>& store = world->getStore().get<ESM::GameSetting>();
|
||||
const MWWorld::Store<ESM::GameSetting>& store
|
||||
= MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>();
|
||||
|
||||
gmst.fMinWalkSpeed = store.find("fMinWalkSpeed");
|
||||
gmst.fMaxWalkSpeed = store.find("fMaxWalkSpeed");
|
||||
|
@ -536,8 +536,8 @@ namespace MWClass
|
|||
if (ptr.getRefData().getCustomData()
|
||||
&& ptr.getRefData().getCustomData()->asNpcCustomData().mNpcStats.isWerewolf())
|
||||
{
|
||||
const MWBase::World* world = MWBase::Environment::get().getWorld();
|
||||
const MWWorld::Store<ESM::GameSetting>& store = world->getStore().get<ESM::GameSetting>();
|
||||
const MWWorld::Store<ESM::GameSetting>& store
|
||||
= MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>();
|
||||
|
||||
return store.find("sWerewolfPopup")->mValue.getString();
|
||||
}
|
||||
|
@ -1195,8 +1195,8 @@ namespace MWClass
|
|||
|
||||
float Npc::getArmorRating(const MWWorld::Ptr& ptr) const
|
||||
{
|
||||
const MWBase::World* world = MWBase::Environment::get().getWorld();
|
||||
const MWWorld::Store<ESM::GameSetting>& store = world->getStore().get<ESM::GameSetting>();
|
||||
const MWWorld::Store<ESM::GameSetting>& store
|
||||
= MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>();
|
||||
|
||||
MWMechanics::NpcStats& stats = getNpcStats(ptr);
|
||||
const MWWorld::InventoryStore& invStore = getInventoryStore(ptr);
|
||||
|
|
|
@ -269,7 +269,7 @@ namespace MWClass
|
|||
newItem.mData.mEnchant = enchCharge;
|
||||
newItem.mEnchant = enchId;
|
||||
newItem.mData.mFlags |= ESM::Weapon::Magical;
|
||||
const ESM::Weapon* record = MWBase::Environment::get().getWorld()->createRecord(newItem);
|
||||
const ESM::Weapon* record = MWBase::Environment::get().getWorld()->getStore().insert(newItem);
|
||||
return record->mId;
|
||||
}
|
||||
|
||||
|
|
|
@ -416,7 +416,7 @@ namespace MWGui
|
|||
|
||||
MWBase::Environment::get().getWindowManager()->playSound(ESM::RefId::stringRefId("Mysticism Hit"));
|
||||
|
||||
const ESM::Spell* spell = MWBase::Environment::get().getWorld()->createRecord(mSpell);
|
||||
const ESM::Spell* spell = MWBase::Environment::get().getWorld()->getStore().insert(mSpell);
|
||||
|
||||
MWMechanics::CreatureStats& stats = player.getClass().getCreatureStats(player);
|
||||
MWMechanics::Spells& spells = stats.getSpells();
|
||||
|
|
|
@ -120,7 +120,7 @@ namespace MWLua
|
|||
|
||||
// Creates a new record in the world database.
|
||||
api["createRecord"] = sol::overload([](const ESM::Potion& potion) -> const ESM::Potion* {
|
||||
return MWBase::Environment::get().getWorld()->createRecord(potion);
|
||||
return MWBase::Environment::get().getWorld()->getStore().insert(potion);
|
||||
}
|
||||
// TODO: add here overloads for other records
|
||||
);
|
||||
|
|
|
@ -315,7 +315,7 @@ void MWMechanics::Alchemy::addPotion(const std::string& name)
|
|||
|
||||
const ESM::Potion* record = getRecord(newRecord);
|
||||
if (!record)
|
||||
record = MWBase::Environment::get().getWorld()->createRecord(newRecord);
|
||||
record = MWBase::Environment::get().getWorld()->getStore().insert(newRecord);
|
||||
|
||||
mAlchemist.getClass().getContainerStore(mAlchemist).add(record->mId, 1);
|
||||
}
|
||||
|
|
|
@ -98,7 +98,7 @@ namespace MWMechanics
|
|||
// Try to find a dynamic enchantment with the same stats, create a new one if not found.
|
||||
const ESM::Enchantment* enchantmentPtr = getRecord(enchantment);
|
||||
if (enchantmentPtr == nullptr)
|
||||
enchantmentPtr = MWBase::Environment::get().getWorld()->createRecord(enchantment);
|
||||
enchantmentPtr = MWBase::Environment::get().getWorld()->getStore().insert(enchantment);
|
||||
|
||||
// Apply the enchantment
|
||||
const ESM::RefId& newItemId
|
||||
|
|
|
@ -24,7 +24,7 @@ namespace MWMechanics
|
|||
{
|
||||
const int sign = it.mCount < 1 ? -1 : 1;
|
||||
it.mCount = sign * std::max(it.mCount * sign + amount, 0);
|
||||
MWBase::Environment::get().getWorld()->createOverrideRecord(copy);
|
||||
MWBase::Environment::get().getWorld()->getStore().overrideRecord(copy);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -34,7 +34,7 @@ namespace MWMechanics
|
|||
cont.mItem = itemId;
|
||||
cont.mCount = amount;
|
||||
copy.mInventory.mList.push_back(cont);
|
||||
MWBase::Environment::get().getWorld()->createOverrideRecord(copy);
|
||||
MWBase::Environment::get().getWorld()->getStore().overrideRecord(copy);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -440,7 +440,7 @@ namespace MWMechanics
|
|||
ESM::NPC player = *world->getPlayerPtr().get<ESM::NPC>()->mBase;
|
||||
player.mName = name;
|
||||
|
||||
world->createRecord(player);
|
||||
world->getStore().insert(player);
|
||||
|
||||
mUpdatePlayer = true;
|
||||
}
|
||||
|
@ -457,7 +457,7 @@ namespace MWMechanics
|
|||
player.mHair = hair;
|
||||
player.setIsMale(male);
|
||||
|
||||
world->createRecord(player);
|
||||
world->getStore().insert(player);
|
||||
|
||||
mRaceSelected = true;
|
||||
buildPlayer();
|
||||
|
@ -478,7 +478,7 @@ namespace MWMechanics
|
|||
ESM::NPC player = *world->getPlayerPtr().get<ESM::NPC>()->mBase;
|
||||
player.mClass = id;
|
||||
|
||||
world->createRecord(player);
|
||||
world->getStore().insert(player);
|
||||
|
||||
mClassSelected = true;
|
||||
buildPlayer();
|
||||
|
@ -489,12 +489,12 @@ namespace MWMechanics
|
|||
{
|
||||
MWBase::World* world = MWBase::Environment::get().getWorld();
|
||||
|
||||
const ESM::Class* ptr = world->createRecord(cls);
|
||||
const ESM::Class* ptr = world->getStore().insert(cls);
|
||||
|
||||
ESM::NPC player = *world->getPlayerPtr().get<ESM::NPC>()->mBase;
|
||||
player.mClass = ptr->mId;
|
||||
|
||||
world->createRecord(player);
|
||||
world->getStore().insert(player);
|
||||
|
||||
mClassSelected = true;
|
||||
buildPlayer();
|
||||
|
|
|
@ -33,7 +33,7 @@ namespace MWMechanics
|
|||
default:
|
||||
assert(false);
|
||||
}
|
||||
MWBase::Environment::get().getWorld()->createOverrideRecord(copy);
|
||||
MWBase::Environment::get().getWorld()->getStore().overrideRecord(copy);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -27,7 +27,7 @@ namespace
|
|||
T copy = *MWBase::Environment::get().getWorld()->getStore().get<T>().find(id);
|
||||
bool changed = function(copy.mSpells.mList);
|
||||
if (changed)
|
||||
MWBase::Environment::get().getWorld()->createOverrideRecord(copy);
|
||||
MWBase::Environment::get().getWorld()->getStore().overrideRecord(copy);
|
||||
return changed;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1506,7 +1506,7 @@ namespace MWScript
|
|||
ESM::CreatureLevList listCopy
|
||||
= *MWBase::Environment::get().getWorld()->getStore().get<ESM::CreatureLevList>().find(levId);
|
||||
addToLevList(&listCopy, creatureId, level);
|
||||
MWBase::Environment::get().getWorld()->createOverrideRecord(listCopy);
|
||||
MWBase::Environment::get().getWorld()->getStore().overrideRecord(listCopy);
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -1525,7 +1525,7 @@ namespace MWScript
|
|||
ESM::CreatureLevList listCopy
|
||||
= *MWBase::Environment::get().getWorld()->getStore().get<ESM::CreatureLevList>().find(levId);
|
||||
removeFromLevList(&listCopy, creatureId, level);
|
||||
MWBase::Environment::get().getWorld()->createOverrideRecord(listCopy);
|
||||
MWBase::Environment::get().getWorld()->getStore().overrideRecord(listCopy);
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -1544,7 +1544,7 @@ namespace MWScript
|
|||
ESM::ItemLevList listCopy
|
||||
= *MWBase::Environment::get().getWorld()->getStore().get<ESM::ItemLevList>().find(levId);
|
||||
addToLevList(&listCopy, itemId, level);
|
||||
MWBase::Environment::get().getWorld()->createOverrideRecord(listCopy);
|
||||
MWBase::Environment::get().getWorld()->getStore().overrideRecord(listCopy);
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -1563,7 +1563,7 @@ namespace MWScript
|
|||
ESM::ItemLevList listCopy
|
||||
= *MWBase::Environment::get().getWorld()->getStore().get<ESM::ItemLevList>().find(levId);
|
||||
removeFromLevList(&listCopy, itemId, level);
|
||||
MWBase::Environment::get().getWorld()->createOverrideRecord(listCopy);
|
||||
MWBase::Environment::get().getWorld()->getStore().overrideRecord(listCopy);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
#include <algorithm>
|
||||
#include <numeric>
|
||||
|
||||
#include "../mwbase/environment.hpp"
|
||||
#include "../mwbase/world.hpp"
|
||||
#include "../mwworld/esmstore.hpp"
|
||||
|
||||
|
@ -26,8 +27,7 @@ namespace MWSound
|
|||
{
|
||||
}
|
||||
|
||||
std::optional<ESM::RefId> RegionSoundSelector::getNextRandom(
|
||||
float duration, const ESM::RefId& regionName, const MWBase::World& world)
|
||||
std::optional<ESM::RefId> RegionSoundSelector::getNextRandom(float duration, const ESM::RefId& regionName)
|
||||
{
|
||||
mTimePassed += duration;
|
||||
|
||||
|
@ -44,7 +44,8 @@ namespace MWSound
|
|||
mSumChance = 0;
|
||||
}
|
||||
|
||||
const ESM::Region* const region = world.getStore().get<ESM::Region>().search(mLastRegionName);
|
||||
const ESM::Region* const region
|
||||
= MWBase::Environment::get().getWorld()->getStore().get<ESM::Region>().search(mLastRegionName);
|
||||
|
||||
if (region == nullptr)
|
||||
return {};
|
||||
|
|
|
@ -15,8 +15,7 @@ namespace MWSound
|
|||
class RegionSoundSelector
|
||||
{
|
||||
public:
|
||||
std::optional<ESM::RefId> getNextRandom(
|
||||
float duration, const ESM::RefId& regionName, const MWBase::World& world);
|
||||
std::optional<ESM::RefId> getNextRandom(float duration, const ESM::RefId& regionName);
|
||||
|
||||
RegionSoundSelector();
|
||||
|
||||
|
|
|
@ -24,9 +24,8 @@ namespace MWSound
|
|||
float mAudioMaxDistanceMult;
|
||||
};
|
||||
|
||||
AudioParams makeAudioParams(const MWBase::World& world)
|
||||
AudioParams makeAudioParams(const MWWorld::Store<ESM::GameSetting>& settings)
|
||||
{
|
||||
const auto& settings = world.getStore().get<ESM::GameSetting>();
|
||||
AudioParams params;
|
||||
params.mAudioDefaultMinDistance = settings.find("fAudioDefaultMinDistance")->mValue.getFloat();
|
||||
params.mAudioDefaultMaxDistance = settings.find("fAudioDefaultMaxDistance")->mValue.getFloat();
|
||||
|
@ -119,7 +118,8 @@ namespace MWSound
|
|||
|
||||
Sound_Buffer* SoundBufferPool::insertSound(const ESM::RefId& soundId, const ESM::Sound& sound)
|
||||
{
|
||||
static const AudioParams audioParams = makeAudioParams(*MWBase::Environment::get().getWorld());
|
||||
static const AudioParams audioParams
|
||||
= makeAudioParams(MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>());
|
||||
|
||||
float volume = static_cast<float>(std::pow(10.0, (sound.mData.mVolume / 255.0 * 3348.0 - 3348.0) / 2000.0));
|
||||
float min = sound.mData.mMinRange;
|
||||
|
|
|
@ -773,7 +773,7 @@ namespace MWSound
|
|||
if (mCurrentRegionSound && mOutput->isSoundPlaying(mCurrentRegionSound))
|
||||
return;
|
||||
|
||||
if (const auto next = mRegionSoundSelector.getNextRandom(duration, cell->getRegion(), *world))
|
||||
if (const auto next = mRegionSoundSelector.getNextRandom(duration, cell->getRegion()))
|
||||
mCurrentRegionSound = playSound(*next, 1.0f, 1.0f);
|
||||
}
|
||||
|
||||
|
|
|
@ -197,6 +197,7 @@ namespace MWWorld
|
|||
}
|
||||
|
||||
/// Insert a custom record (i.e. with a generated ID that will not clash will pre-existing records)
|
||||
/// \return pointer to created record
|
||||
template <class T>
|
||||
const T* insert(const T& x)
|
||||
{
|
||||
|
|
|
@ -389,8 +389,8 @@ void MWWorld::InventoryStore::autoEquipArmor(TSlots& slots_)
|
|||
return;
|
||||
}
|
||||
|
||||
const MWBase::World* world = MWBase::Environment::get().getWorld();
|
||||
const MWWorld::Store<ESM::GameSetting>& store = world->getStore().get<ESM::GameSetting>();
|
||||
const MWWorld::Store<ESM::GameSetting>& store
|
||||
= MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>();
|
||||
|
||||
static float fUnarmoredBase1 = store.find("fUnarmoredBase1")->mValue.getFloat();
|
||||
static float fUnarmoredBase2 = store.find("fUnarmoredBase2")->mValue.getFloat();
|
||||
|
|
|
@ -599,11 +599,6 @@ namespace MWWorld
|
|||
return mESMVersions;
|
||||
}
|
||||
|
||||
const MWWorld::ESMStore& World::getStore() const
|
||||
{
|
||||
return mStore;
|
||||
}
|
||||
|
||||
LocalScripts& World::getLocalScripts()
|
||||
{
|
||||
return mLocalScripts;
|
||||
|
@ -1721,95 +1716,6 @@ namespace MWWorld
|
|||
}
|
||||
}
|
||||
|
||||
const ESM::Potion* World::createRecord(const ESM::Potion& record)
|
||||
{
|
||||
return mStore.insert(record);
|
||||
}
|
||||
|
||||
const ESM::Class* World::createRecord(const ESM::Class& record)
|
||||
{
|
||||
return mStore.insert(record);
|
||||
}
|
||||
|
||||
const ESM::Spell* World::createRecord(const ESM::Spell& record)
|
||||
{
|
||||
return mStore.insert(record);
|
||||
}
|
||||
|
||||
const ESM::Cell* World::createRecord(const ESM::Cell& record)
|
||||
{
|
||||
return mStore.insert(record);
|
||||
}
|
||||
|
||||
const ESM::CreatureLevList* World::createOverrideRecord(const ESM::CreatureLevList& record)
|
||||
{
|
||||
return mStore.overrideRecord(record);
|
||||
}
|
||||
|
||||
const ESM::ItemLevList* World::createOverrideRecord(const ESM::ItemLevList& record)
|
||||
{
|
||||
return mStore.overrideRecord(record);
|
||||
}
|
||||
|
||||
const ESM::Creature* World::createOverrideRecord(const ESM::Creature& record)
|
||||
{
|
||||
return mStore.overrideRecord(record);
|
||||
}
|
||||
|
||||
const ESM::NPC* World::createOverrideRecord(const ESM::NPC& record)
|
||||
{
|
||||
return mStore.overrideRecord(record);
|
||||
}
|
||||
|
||||
const ESM::Container* World::createOverrideRecord(const ESM::Container& record)
|
||||
{
|
||||
return mStore.overrideRecord(record);
|
||||
}
|
||||
|
||||
const ESM::NPC* World::createRecord(const ESM::NPC& record)
|
||||
{
|
||||
bool update = false;
|
||||
|
||||
if (record.mId == "Player")
|
||||
{
|
||||
const ESM::NPC* player = mPlayer->getPlayer().get<ESM::NPC>()->mBase;
|
||||
|
||||
update = record.isMale() != player->isMale() || !(record.mRace == player->mRace)
|
||||
|| !(record.mHead == player->mHead) || !(record.mHair == player->mHair);
|
||||
}
|
||||
const ESM::NPC* ret = mStore.insert(record);
|
||||
if (update)
|
||||
{
|
||||
renderPlayer();
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
const ESM::Armor* World::createRecord(const ESM::Armor& record)
|
||||
{
|
||||
return mStore.insert(record);
|
||||
}
|
||||
|
||||
const ESM::Weapon* World::createRecord(const ESM::Weapon& record)
|
||||
{
|
||||
return mStore.insert(record);
|
||||
}
|
||||
|
||||
const ESM::Clothing* World::createRecord(const ESM::Clothing& record)
|
||||
{
|
||||
return mStore.insert(record);
|
||||
}
|
||||
|
||||
const ESM::Enchantment* World::createRecord(const ESM::Enchantment& record)
|
||||
{
|
||||
return mStore.insert(record);
|
||||
}
|
||||
|
||||
const ESM::Book* World::createRecord(const ESM::Book& record)
|
||||
{
|
||||
return mStore.insert(record);
|
||||
}
|
||||
|
||||
void World::update(float duration, bool paused)
|
||||
{
|
||||
if (mGoToJail && !paused)
|
||||
|
@ -3211,7 +3117,7 @@ namespace MWWorld
|
|||
{
|
||||
if (playing.insert(effect.mEffectId).second)
|
||||
{
|
||||
const auto magicEffect = getStore().get<ESM::MagicEffect>().find(effect.mEffectId);
|
||||
const auto magicEffect = mStore.get<ESM::MagicEffect>().find(effect.mEffectId);
|
||||
if (magicEffect->mData.mFlags & ESM::MagicEffect::ContinuousVfx)
|
||||
MWMechanics::playEffects(ptr, *magicEffect, false);
|
||||
}
|
||||
|
|
|
@ -235,7 +235,7 @@ namespace MWWorld
|
|||
MWWorld::Ptr getPlayerPtr() override;
|
||||
MWWorld::ConstPtr getPlayerConstPtr() const override;
|
||||
|
||||
const MWWorld::ESMStore& getStore() const override;
|
||||
MWWorld::ESMStore& getStore() override { return mStore; }
|
||||
|
||||
const std::vector<int>& getESMVersions() const override;
|
||||
|
||||
|
@ -428,66 +428,6 @@ namespace MWWorld
|
|||
///< Toggle a render mode.
|
||||
///< \return Resulting mode
|
||||
|
||||
const ESM::Potion* createRecord(const ESM::Potion& record) override;
|
||||
///< Create a new record (of type potion) in the ESM store.
|
||||
/// \return pointer to created record
|
||||
|
||||
const ESM::Spell* createRecord(const ESM::Spell& record) override;
|
||||
///< Create a new record (of type spell) in the ESM store.
|
||||
/// \return pointer to created record
|
||||
|
||||
const ESM::Class* createRecord(const ESM::Class& record) override;
|
||||
///< Create a new record (of type class) in the ESM store.
|
||||
/// \return pointer to created record
|
||||
|
||||
const ESM::Cell* createRecord(const ESM::Cell& record) override;
|
||||
///< Create a new record (of type cell) in the ESM store.
|
||||
/// \return pointer to created record
|
||||
|
||||
const ESM::NPC* createRecord(const ESM::NPC& record) override;
|
||||
///< Create a new record (of type npc) in the ESM store.
|
||||
/// \return pointer to created record
|
||||
|
||||
const ESM::Armor* createRecord(const ESM::Armor& record) override;
|
||||
///< Create a new record (of type armor) in the ESM store.
|
||||
/// \return pointer to created record
|
||||
|
||||
const ESM::Weapon* createRecord(const ESM::Weapon& record) override;
|
||||
///< Create a new record (of type weapon) in the ESM store.
|
||||
/// \return pointer to created record
|
||||
|
||||
const ESM::Clothing* createRecord(const ESM::Clothing& record) override;
|
||||
///< Create a new record (of type clothing) in the ESM store.
|
||||
/// \return pointer to created record
|
||||
|
||||
const ESM::Enchantment* createRecord(const ESM::Enchantment& record) override;
|
||||
///< Create a new record (of type enchantment) in the ESM store.
|
||||
/// \return pointer to created record
|
||||
|
||||
const ESM::Book* createRecord(const ESM::Book& record) override;
|
||||
///< Create a new record (of type book) in the ESM store.
|
||||
/// \return pointer to created record
|
||||
|
||||
const ESM::CreatureLevList* createOverrideRecord(const ESM::CreatureLevList& record) override;
|
||||
///< Write this record to the ESM store, allowing it to override a pre-existing record with the same ID.
|
||||
/// \return pointer to created record
|
||||
|
||||
const ESM::ItemLevList* createOverrideRecord(const ESM::ItemLevList& record) override;
|
||||
///< Write this record to the ESM store, allowing it to override a pre-existing record with the same ID.
|
||||
/// \return pointer to created record
|
||||
|
||||
const ESM::Creature* createOverrideRecord(const ESM::Creature& record) override;
|
||||
///< Write this record to the ESM store, allowing it to override a pre-existing record with the same ID.
|
||||
/// \return pointer to created record
|
||||
|
||||
const ESM::NPC* createOverrideRecord(const ESM::NPC& record) override;
|
||||
///< Write this record to the ESM store, allowing it to override a pre-existing record with the same ID.
|
||||
/// \return pointer to created record
|
||||
|
||||
const ESM::Container* createOverrideRecord(const ESM::Container& record) override;
|
||||
///< Write this record to the ESM store, allowing it to override a pre-existing record with the same ID.
|
||||
/// \return pointer to created record
|
||||
|
||||
void update(float duration, bool paused);
|
||||
void updatePhysics(
|
||||
float duration, bool paused, osg::Timer_t frameStart, unsigned int frameNumber, osg::Stats& stats);
|
||||
|
|
|
@ -179,7 +179,7 @@ MWWorld::CellStore& MWWorld::WorldModel::getExterior(int x, int y)
|
|||
record.mMapColor = 0;
|
||||
record.updateId();
|
||||
|
||||
cell = MWBase::Environment::get().getWorld()->createRecord(record);
|
||||
cell = MWBase::Environment::get().getWorld()->getStore().insert(record);
|
||||
}
|
||||
|
||||
CellStore* cellStore
|
||||
|
|
Loading…
Reference in a new issue