forked from teamnwah/openmw-tes3coop
update MWBase::World interface since records contains own id
This commit is contained in:
parent
f818fa1ebf
commit
9dc9098fa7
6 changed files with 17 additions and 21 deletions
|
@ -230,17 +230,17 @@ namespace MWBase
|
||||||
///< Toggle a render mode.
|
///< Toggle a render mode.
|
||||||
///< \return Resulting mode
|
///< \return Resulting mode
|
||||||
|
|
||||||
virtual std::pair<std::string, const ESM::Potion *> createRecord (const ESM::Potion& record)
|
virtual const ESM::Potion *createRecord (const ESM::Potion& record)
|
||||||
= 0;
|
= 0;
|
||||||
///< Create a new recrod (of type potion) in the ESM store.
|
///< Create a new recrod (of type potion) in the ESM store.
|
||||||
/// \return ID, pointer to created record
|
/// \return ID, pointer to created record
|
||||||
|
|
||||||
virtual std::pair<std::string, const ESM::Spell *> createRecord (const ESM::Spell& record)
|
virtual const ESM::Spell *createRecord (const ESM::Spell& record)
|
||||||
= 0;
|
= 0;
|
||||||
///< Create a new recrod (of type spell) in the ESM store.
|
///< Create a new recrod (of type spell) in the ESM store.
|
||||||
/// \return ID, pointer to created record
|
/// \return ID, pointer to created record
|
||||||
|
|
||||||
virtual std::pair<std::string, const ESM::Class *> createRecord (const ESM::Class& record)
|
virtual const ESM::Class *createRecord (const ESM::Class& record)
|
||||||
= 0;
|
= 0;
|
||||||
///< Create a new recrod (of type class) in the ESM store.
|
///< Create a new recrod (of type class) in the ESM store.
|
||||||
/// \return ID, pointer to created record
|
/// \return ID, pointer to created record
|
||||||
|
|
|
@ -336,12 +336,12 @@ namespace MWGui
|
||||||
|
|
||||||
MWBase::Environment::get().getSoundManager()->playSound ("Item Gold Up", 1.0, 1.0);
|
MWBase::Environment::get().getSoundManager()->playSound ("Item Gold Up", 1.0, 1.0);
|
||||||
|
|
||||||
std::pair<std::string, const ESM::Spell*> result = MWBase::Environment::get().getWorld()->createRecord(mSpell);
|
const ESM::Spell* spell = MWBase::Environment::get().getWorld()->createRecord(mSpell);
|
||||||
|
|
||||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayer().getPlayer();
|
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayer().getPlayer();
|
||||||
MWMechanics::CreatureStats& stats = MWWorld::Class::get(player).getCreatureStats(player);
|
MWMechanics::CreatureStats& stats = MWWorld::Class::get(player).getCreatureStats(player);
|
||||||
MWMechanics::Spells& spells = stats.getSpells();
|
MWMechanics::Spells& spells = stats.getSpells();
|
||||||
spells.add (result.first);
|
spells.add (spell->mId);
|
||||||
|
|
||||||
MWBase::Environment::get().getSoundManager()->playSound ("Item Gold Up", 1.0, 1.0);
|
MWBase::Environment::get().getSoundManager()->playSound ("Item Gold Up", 1.0, 1.0);
|
||||||
|
|
||||||
|
|
|
@ -279,7 +279,7 @@ void MWMechanics::Alchemy::addPotion (const std::string& name)
|
||||||
|
|
||||||
newRecord.mEffects.mList = mEffects;
|
newRecord.mEffects.mList = mEffects;
|
||||||
|
|
||||||
record = MWBase::Environment::get().getWorld()->createRecord (newRecord).second;
|
record = MWBase::Environment::get().getWorld()->createRecord (newRecord);
|
||||||
}
|
}
|
||||||
|
|
||||||
MWWorld::ManualRef ref (MWBase::Environment::get().getWorld()->getStore(), record->mId);
|
MWWorld::ManualRef ref (MWBase::Environment::get().getWorld()->getStore(), record->mId);
|
||||||
|
|
|
@ -327,10 +327,9 @@ namespace MWMechanics
|
||||||
{
|
{
|
||||||
MWBase::World *world = MWBase::Environment::get().getWorld();
|
MWBase::World *world = MWBase::Environment::get().getWorld();
|
||||||
|
|
||||||
std::pair<std::string, const ESM::Class *> res =
|
const ESM::Class *ptr = world->createRecord(cls);
|
||||||
world->createRecord(cls);
|
|
||||||
|
|
||||||
world->getPlayer().setClass(res.second->mId);
|
world->getPlayer().setClass(ptr->mId);
|
||||||
|
|
||||||
mClassSelected = true;
|
mClassSelected = true;
|
||||||
buildPlayer();
|
buildPlayer();
|
||||||
|
|
|
@ -779,22 +779,19 @@ namespace MWWorld
|
||||||
return mRendering->toggleRenderMode (mode);
|
return mRendering->toggleRenderMode (mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::pair<std::string, const ESM::Potion *> World::createRecord (const ESM::Potion& record)
|
const ESM::Potion *World::createRecord (const ESM::Potion& record)
|
||||||
{
|
{
|
||||||
const ESM::Potion *ptr = mStore.insert(record);
|
return mStore.insert(record);
|
||||||
return std::make_pair(ptr->mId, ptr);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
std::pair<std::string, const ESM::Class *> World::createRecord (const ESM::Class& record)
|
const ESM::Class *World::createRecord (const ESM::Class& record)
|
||||||
{
|
{
|
||||||
const ESM::Class *ptr = mStore.insert(record);
|
return mStore.insert(record);
|
||||||
return std::make_pair(ptr->mId, ptr);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
std::pair<std::string, const ESM::Spell *> World::createRecord (const ESM::Spell& record)
|
const ESM::Spell *World::createRecord (const ESM::Spell& record)
|
||||||
{
|
{
|
||||||
const ESM::Spell *ptr = mStore.insert(record);
|
return mStore.insert(record);
|
||||||
return std::make_pair(ptr->mId, ptr);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const ESM::Cell *World::createRecord (const ESM::Cell& record)
|
const ESM::Cell *World::createRecord (const ESM::Cell& record)
|
||||||
|
|
|
@ -250,15 +250,15 @@ namespace MWWorld
|
||||||
///< Toggle a render mode.
|
///< Toggle a render mode.
|
||||||
///< \return Resulting mode
|
///< \return Resulting mode
|
||||||
|
|
||||||
virtual std::pair<std::string, const ESM::Potion *> createRecord (const ESM::Potion& record);
|
virtual const ESM::Potion *createRecord (const ESM::Potion& record);
|
||||||
///< Create a new recrod (of type potion) in the ESM store.
|
///< Create a new recrod (of type potion) in the ESM store.
|
||||||
/// \return ID, pointer to created record
|
/// \return ID, pointer to created record
|
||||||
|
|
||||||
virtual std::pair<std::string, const ESM::Spell *> createRecord (const ESM::Spell& record);
|
virtual const ESM::Spell *createRecord (const ESM::Spell& record);
|
||||||
///< Create a new recrod (of type spell) in the ESM store.
|
///< Create a new recrod (of type spell) in the ESM store.
|
||||||
/// \return ID, pointer to created record
|
/// \return ID, pointer to created record
|
||||||
|
|
||||||
virtual std::pair<std::string, const ESM::Class *> createRecord (const ESM::Class& record);
|
virtual const ESM::Class *createRecord (const ESM::Class& record);
|
||||||
///< Create a new recrod (of type class) in the ESM store.
|
///< Create a new recrod (of type class) in the ESM store.
|
||||||
/// \return ID, pointer to created record
|
/// \return ID, pointer to created record
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue