new interface in manualref, fix various typos

This commit is contained in:
greye 2012-11-06 13:43:48 +04:00
parent e74b2c060d
commit b3ad872845
10 changed files with 41 additions and 51 deletions

View file

@ -90,7 +90,8 @@ namespace
if (scriptName.empty())
return false; // no script
const ESM::Script *script = store.scripts.find (scriptName);
const ESM::Script *script =
store.get<ESM::Script>().find (scriptName);
int i = 0;
@ -751,7 +752,7 @@ namespace MWDialogue
MWBase::Environment::get().getWorld()->getStore().get<ESM::Dialogue>();
MWWordl::Store<ESM::Dialogue>::iterator it = dialogs.begin();
MWWorld::Store<ESM::Dialogue>::iterator it = dialogs.begin();
for (; it != dialogs.end(); ++it)
{
if(it->mType == ESM::Dialogue::Topic)

View file

@ -18,7 +18,8 @@ namespace MWDialogue
std::string JournalEntry::getText (const MWWorld::ESMStore& store) const
{
const ESM::Dialogue *dialogue = store.dialogs.find (mTopic);
const ESM::Dialogue *dialogue =
store.get<ESM::Dialogue>().find (mTopic);
for (std::vector<ESM::DialInfo>::const_iterator iter (dialogue->mInfo.begin());
iter!=dialogue->mInfo.end(); ++iter)

View file

@ -128,7 +128,7 @@ void ContainerBase::onSelectedItem(MyGUI::Widget* _sender)
if (isInventory())
{
const MWWorld::Store<ESM::GameSetting> &gmst =
MWWorld::Environment::get().getWorld()->getStore()->get<ESM::GameSetting>();
MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>();
// the player is trying to sell an item, check if the merchant accepts it
// also, don't allow selling gold (let's be better than Morrowind at this, can we?)

View file

@ -73,10 +73,13 @@ namespace MWGui
MWWorld::Ptr player = MWBase::Environment::get().getWorld ()->getPlayer ().getPlayer ();
MWMechanics::NpcStats& pcStats = MWWorld::Class::get(player).getNpcStats (player);
const MWWorld::Store<ESM::GameSetting> &gmst =
MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>();
for (int i=0; i<3; ++i)
{
/// \todo mercantile skill
int price = pcStats.getSkill (bestSkills[i].first).getBase() * MWBase::Environment::get().getWorld ()->getStore ().gameSettings.find("iTrainingMod")->getInt ();
int price = pcStats.getSkill (bestSkills[i].first).getBase() * gmst.find("iTrainingMod")->getInt ();
std::string skin = (price > mWindowManager.getInventoryWindow ()->getPlayerGold ()) ? "SandTextGreyedOut" : "SandTextButton";

View file

@ -63,7 +63,7 @@ namespace MWMechanics
inline int getSpellSchool(const std::string& spellId, const MWWorld::Ptr& actor)
{
const ESM::Spell* spell =
MWBase::Environment::get().getWorld()->getStore().get<ESM::Spell.().find(spellId);
MWBase::Environment::get().getWorld()->getStore().get<ESM::Spell>().find(spellId);
return getSpellSchool(spell, actor);
}

View file

@ -51,7 +51,7 @@ namespace MWScript
store.get<ESM::Apparatus>().search (name) ||
store.get<ESM::Armor>().search (name) ||
store.get<ESM::Book>().search (name) ||
store.get<ESM::Cloth>().search (name) ||
store.get<ESM::Clothing>().search (name) ||
store.get<ESM::Container>().search (name) ||
store.get<ESM::Creature>().search (name) ||
store.get<ESM::Door>().search (name) ||

View file

@ -17,10 +17,12 @@ namespace MWScript
{
addScript ("Main");
for (MWWorld::RecListT<ESM::StartScript>::MapType::const_iterator iter
(store.startScripts.list.begin());
iter != store.startScripts.list.end(); ++iter)
addScript (iter->second.mScript);
MWWorld::Store<ESM::StartScript>::iterator iter =
store.get<ESM::StartScript>().begin();
for (; iter != store.get<ESM::StartScript>().end(); ++iter) {
addScript (iter->mScript);
}
}
void GlobalScripts::addScript (const std::string& name)

View file

@ -131,7 +131,7 @@ namespace MWScript
const MWWorld::Store<ESM::Script>& scripts = mStore.get<ESM::Script>();
MWWorld::Store<ESM::Script>::iterator it = scripts.begin();
for (; it != scripts.end(); ++iter, ++count)
for (; it != scripts.end(); ++it, ++count)
if (compile (it->mId))
++success;

View file

@ -19,24 +19,7 @@ namespace MWWorld
ManualRef& operator= (const ManualRef&);
template<typename T>
bool create (const MWWorld::RecListT<T>& list, const std::string& name)
{
if (const T *instance = list.search (name))
{
LiveCellRef<T> ref;
ref.mBase = instance;
mRef = ref;
mPtr = Ptr (&boost::any_cast<LiveCellRef<T>&> (mRef), 0);
return true;
}
return false;
}
template<typename T>
bool create (const MWWorld::RecListWithIDT<T>& list, const std::string& name)
bool create (const MWWorld::Store<T>& list, const std::string& name)
{
if (const T *instance = list.search (name))
{
@ -57,26 +40,26 @@ namespace MWWorld
ManualRef (const MWWorld::ESMStore& store, const std::string& name)
{
// create
if (!create (store.activators, name) &&
!create (store.potions, name) &&
!create (store.appas, name) &&
!create (store.armors, name) &&
!create (store.books, name) &&
!create (store.clothes, name) &&
!create (store.containers, name) &&
!create (store.creatures, name) &&
!create (store.doors, name) &&
!create (store.ingreds, name) &&
!create (store.creatureLists, name) &&
!create (store.itemLists, name) &&
!create (store.lights, name) &&
!create (store.lockpicks, name) &&
!create (store.miscItems, name) &&
!create (store.npcs, name) &&
!create (store.probes, name) &&
!create (store.repairs, name) &&
!create (store.statics, name) &&
!create (store.weapons, name))
if (!create (store.get<ESM::Activator>(), name) &&
!create (store.get<ESM::Potion>(), name) &&
!create (store.get<ESM::Apparatus>(), name) &&
!create (store.get<ESM::Armor>(), name) &&
!create (store.get<ESM::Book>(), name) &&
!create (store.get<ESM::Clothing>(), name) &&
!create (store.get<ESM::Container>(), name) &&
!create (store.get<ESM::Creature>(), name) &&
!create (store.get<ESM::Door>(), name) &&
!create (store.get<ESM::Ingredient>(), name) &&
!create (store.get<ESM::CreatureLevList>(), name) &&
!create (store.get<ESM::ItemLevList>(), name) &&
!create (store.get<ESM::Light>(), name) &&
!create (store.get<ESM::Tool>(), name) &&
!create (store.get<ESM::Miscellaneous>(), name) &&
!create (store.get<ESM::NPC>(), name) &&
!create (store.get<ESM::Probe>(), name) &&
!create (store.get<ESM::Repair>(), name) &&
!create (store.get<ESM::Static>(), name) &&
!create (store.get<ESM::Weapon>(), name))
throw std::logic_error ("failed to create manual cell ref for " + name);
// initialise

View file

@ -844,7 +844,7 @@ namespace MWWorld
}
const T *find(int index) const {
T *ptr = search(index);
const T *ptr = search(index);
if (ptr == 0) {
std::ostringstream msg;
msg << "Object with index " << index << " not found";