1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-04-01 21:06:43 +00:00

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()) if (scriptName.empty())
return false; // no script 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; int i = 0;
@ -751,7 +752,7 @@ namespace MWDialogue
MWBase::Environment::get().getWorld()->getStore().get<ESM::Dialogue>(); 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) for (; it != dialogs.end(); ++it)
{ {
if(it->mType == ESM::Dialogue::Topic) if(it->mType == ESM::Dialogue::Topic)

View file

@ -18,7 +18,8 @@ namespace MWDialogue
std::string JournalEntry::getText (const MWWorld::ESMStore& store) const 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()); for (std::vector<ESM::DialInfo>::const_iterator iter (dialogue->mInfo.begin());
iter!=dialogue->mInfo.end(); ++iter) iter!=dialogue->mInfo.end(); ++iter)

View file

@ -128,7 +128,7 @@ void ContainerBase::onSelectedItem(MyGUI::Widget* _sender)
if (isInventory()) if (isInventory())
{ {
const MWWorld::Store<ESM::GameSetting> &gmst = 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 // 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?) // 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 (); MWWorld::Ptr player = MWBase::Environment::get().getWorld ()->getPlayer ().getPlayer ();
MWMechanics::NpcStats& pcStats = MWWorld::Class::get(player).getNpcStats (player); 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) for (int i=0; i<3; ++i)
{ {
/// \todo mercantile skill /// \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"; 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) inline int getSpellSchool(const std::string& spellId, const MWWorld::Ptr& actor)
{ {
const ESM::Spell* spell = 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); return getSpellSchool(spell, actor);
} }

View file

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

View file

@ -17,10 +17,12 @@ namespace MWScript
{ {
addScript ("Main"); addScript ("Main");
for (MWWorld::RecListT<ESM::StartScript>::MapType::const_iterator iter MWWorld::Store<ESM::StartScript>::iterator iter =
(store.startScripts.list.begin()); store.get<ESM::StartScript>().begin();
iter != store.startScripts.list.end(); ++iter)
addScript (iter->second.mScript); for (; iter != store.get<ESM::StartScript>().end(); ++iter) {
addScript (iter->mScript);
}
} }
void GlobalScripts::addScript (const std::string& name) 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>(); const MWWorld::Store<ESM::Script>& scripts = mStore.get<ESM::Script>();
MWWorld::Store<ESM::Script>::iterator it = scripts.begin(); MWWorld::Store<ESM::Script>::iterator it = scripts.begin();
for (; it != scripts.end(); ++iter, ++count) for (; it != scripts.end(); ++it, ++count)
if (compile (it->mId)) if (compile (it->mId))
++success; ++success;

View file

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

View file

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