mirror of
				https://github.com/OpenMW/openmw.git
				synced 2025-10-29 03:26:38 +00:00 
			
		
		
		
	Merge remote-tracking branch 'scrawl/master'
This commit is contained in:
		
						commit
						85707b5e3e
					
				
					 89 changed files with 531 additions and 422 deletions
				
			
		|  | @ -511,13 +511,13 @@ void OMW::Engine::activate() | ||||||
|     MWScript::InterpreterContext interpreterContext (&ptr.getRefData().getLocals(), ptr); |     MWScript::InterpreterContext interpreterContext (&ptr.getRefData().getLocals(), ptr); | ||||||
| 
 | 
 | ||||||
|     boost::shared_ptr<MWWorld::Action> action = |     boost::shared_ptr<MWWorld::Action> action = | ||||||
|         MWWorld::Class::get (ptr).activate (ptr, MWBase::Environment::get().getWorld()->getPlayer().getPlayer()); |         MWWorld::Class::get (ptr).activate (ptr, MWBase::Environment::get().getWorld()->getPlayerPtr()); | ||||||
| 
 | 
 | ||||||
|     interpreterContext.activate (ptr, action); |     interpreterContext.activate (ptr, action); | ||||||
| 
 | 
 | ||||||
|     std::string script = MWWorld::Class::get (ptr).getScript (ptr); |     std::string script = MWWorld::Class::get (ptr).getScript (ptr); | ||||||
| 
 | 
 | ||||||
|     MWBase::Environment::get().getWorld()->breakInvisibility(MWBase::Environment::get().getWorld()->getPlayer().getPlayer()); |     MWBase::Environment::get().getWorld()->breakInvisibility(MWBase::Environment::get().getWorld()->getPlayerPtr()); | ||||||
| 
 | 
 | ||||||
|     if (!script.empty()) |     if (!script.empty()) | ||||||
|     { |     { | ||||||
|  |  | ||||||
|  | @ -104,13 +104,17 @@ namespace MWBase | ||||||
|              * @brief Commit a crime. If any actors witness the crime and report it, |              * @brief Commit a crime. If any actors witness the crime and report it, | ||||||
|              *        reportCrime will be called automatically. |              *        reportCrime will be called automatically. | ||||||
|              * @param arg Depends on \a type, e.g. for Theft, the value of the item that was stolen. |              * @param arg Depends on \a type, e.g. for Theft, the value of the item that was stolen. | ||||||
|  |              * @return was the crime reported? | ||||||
|              */ |              */ | ||||||
|             virtual void commitCrime (const MWWorld::Ptr& ptr, const MWWorld::Ptr& victim, |             virtual bool commitCrime (const MWWorld::Ptr& ptr, const MWWorld::Ptr& victim, | ||||||
|                                       OffenseType type, int arg=0) = 0; |                                       OffenseType type, int arg=0) = 0; | ||||||
|             virtual void reportCrime (const MWWorld::Ptr& ptr, const MWWorld::Ptr& victim, |             virtual void reportCrime (const MWWorld::Ptr& ptr, const MWWorld::Ptr& victim, | ||||||
|                                       OffenseType type, int arg=0) = 0; |                                       OffenseType type, int arg=0) = 0; | ||||||
|             /// Utility to check if taking this item is illegal and calling commitCrime if so
 |             /// Utility to check if taking this item is illegal and calling commitCrime if so
 | ||||||
|             virtual void itemTaken (const MWWorld::Ptr& ptr, const MWWorld::Ptr& item, int count) = 0; |             virtual void itemTaken (const MWWorld::Ptr& ptr, const MWWorld::Ptr& item, int count) = 0; | ||||||
|  |             /// Attempt sleeping in a bed. If this is illegal, call commitCrime.
 | ||||||
|  |             /// @return was it illegal, and someone saw you doing it?
 | ||||||
|  |             virtual bool sleepInBed (const MWWorld::Ptr& ptr, const MWWorld::Ptr& bed) = 0; | ||||||
| 
 | 
 | ||||||
|             enum PersuasionType |             enum PersuasionType | ||||||
|             { |             { | ||||||
|  |  | ||||||
|  | @ -112,6 +112,7 @@ namespace MWBase | ||||||
|             virtual const MWWorld::Fallback *getFallback () const = 0; |             virtual const MWWorld::Fallback *getFallback () const = 0; | ||||||
| 
 | 
 | ||||||
|             virtual MWWorld::Player& getPlayer() = 0; |             virtual MWWorld::Player& getPlayer() = 0; | ||||||
|  |             virtual MWWorld::Ptr getPlayerPtr() = 0; | ||||||
| 
 | 
 | ||||||
|             virtual const MWWorld::ESMStore& getStore() const = 0; |             virtual const MWWorld::ESMStore& getStore() const = 0; | ||||||
| 
 | 
 | ||||||
|  | @ -430,11 +431,10 @@ namespace MWBase | ||||||
| 
 | 
 | ||||||
|             virtual bool findInteriorPositionInWorldSpace(MWWorld::CellStore* cell, Ogre::Vector3& result) = 0; |             virtual bool findInteriorPositionInWorldSpace(MWWorld::CellStore* cell, Ogre::Vector3& result) = 0; | ||||||
| 
 | 
 | ||||||
|             /// Teleports \a ptr to the reference of \a id (e.g. DivineMarker, PrisonMarker, TempleMarker)
 |             /// Teleports \a ptr to the closest reference of \a id (e.g. DivineMarker, PrisonMarker, TempleMarker)
 | ||||||
|             /// closest to \a worldPos.
 |  | ||||||
|             /// @note id must be lower case
 |             /// @note id must be lower case
 | ||||||
|             virtual void teleportToClosestMarker (const MWWorld::Ptr& ptr, |             virtual void teleportToClosestMarker (const MWWorld::Ptr& ptr, | ||||||
|                                                   const std::string& id, Ogre::Vector3 worldPos) = 0; |                                                   const std::string& id) = 0; | ||||||
| 
 | 
 | ||||||
|             enum DetectionType |             enum DetectionType | ||||||
|             { |             { | ||||||
|  | @ -447,6 +447,10 @@ namespace MWBase | ||||||
|             /// @note This also works for references in containers.
 |             /// @note This also works for references in containers.
 | ||||||
|             virtual void listDetectedReferences (const MWWorld::Ptr& ptr, std::vector<MWWorld::Ptr>& out, |             virtual void listDetectedReferences (const MWWorld::Ptr& ptr, std::vector<MWWorld::Ptr>& out, | ||||||
|                                                   DetectionType type) = 0; |                                                   DetectionType type) = 0; | ||||||
|  | 
 | ||||||
|  |             /// Update the value of some globals according to the world state, which may be used by dialogue entries.
 | ||||||
|  |             /// This should be called when initiating a dialogue.
 | ||||||
|  |             virtual void updateDialogueGlobals() = 0; | ||||||
|     }; |     }; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -17,7 +17,6 @@ | ||||||
| #include "../mwworld/physicssystem.hpp" | #include "../mwworld/physicssystem.hpp" | ||||||
| #include "../mwworld/nullaction.hpp" | #include "../mwworld/nullaction.hpp" | ||||||
| #include "../mwworld/containerstore.hpp" | #include "../mwworld/containerstore.hpp" | ||||||
| #include "../mwworld/player.hpp" |  | ||||||
| 
 | 
 | ||||||
| #include "../mwrender/objects.hpp" | #include "../mwrender/objects.hpp" | ||||||
| #include "../mwrender/renderinginterface.hpp" | #include "../mwrender/renderinginterface.hpp" | ||||||
|  |  | ||||||
|  | @ -14,7 +14,6 @@ | ||||||
| #include "../mwworld/cellstore.hpp" | #include "../mwworld/cellstore.hpp" | ||||||
| #include "../mwworld/physicssystem.hpp" | #include "../mwworld/physicssystem.hpp" | ||||||
| #include "../mwworld/nullaction.hpp" | #include "../mwworld/nullaction.hpp" | ||||||
| #include "../mwworld/player.hpp" |  | ||||||
| 
 | 
 | ||||||
| #include "../mwgui/tooltips.hpp" | #include "../mwgui/tooltips.hpp" | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -16,7 +16,6 @@ | ||||||
| #include "../mwworld/actionopen.hpp" | #include "../mwworld/actionopen.hpp" | ||||||
| #include "../mwworld/actiontrap.hpp" | #include "../mwworld/actiontrap.hpp" | ||||||
| #include "../mwworld/physicssystem.hpp" | #include "../mwworld/physicssystem.hpp" | ||||||
| #include "../mwworld/player.hpp" |  | ||||||
| #include "../mwworld/inventorystore.hpp" | #include "../mwworld/inventorystore.hpp" | ||||||
| 
 | 
 | ||||||
| #include "../mwgui/tooltips.hpp" | #include "../mwgui/tooltips.hpp" | ||||||
|  | @ -108,7 +107,7 @@ namespace MWClass | ||||||
|         const std::string lockedSound = "LockedChest"; |         const std::string lockedSound = "LockedChest"; | ||||||
|         const std::string trapActivationSound = "Disarm Trap Fail"; |         const std::string trapActivationSound = "Disarm Trap Fail"; | ||||||
| 
 | 
 | ||||||
|         MWWorld::Ptr player = MWBase::Environment::get().getWorld ()->getPlayer().getPlayer(); |         MWWorld::Ptr player = MWBase::Environment::get().getWorld ()->getPlayerPtr(); | ||||||
|         MWWorld::InventoryStore& invStore = MWWorld::Class::get(player).getInventoryStore(player); |         MWWorld::InventoryStore& invStore = MWWorld::Class::get(player).getInventoryStore(player); | ||||||
| 
 | 
 | ||||||
|         bool needKey = ptr.getCellRef().mLockLevel>0; |         bool needKey = ptr.getCellRef().mLockLevel>0; | ||||||
|  |  | ||||||
|  | @ -100,7 +100,7 @@ namespace MWClass | ||||||
| 
 | 
 | ||||||
|             // TODO: this is not quite correct, in vanilla the merchant's gold pool is not available in his inventory.
 |             // TODO: this is not quite correct, in vanilla the merchant's gold pool is not available in his inventory.
 | ||||||
|             // (except for gold you gave him)
 |             // (except for gold you gave him)
 | ||||||
|             data->mContainerStore.add("gold_001", ref->mBase->mData.mGold, ptr); |             data->mContainerStore.add(MWWorld::ContainerStore::sGoldId, ref->mBase->mData.mGold, ptr); | ||||||
| 
 | 
 | ||||||
|             // store
 |             // store
 | ||||||
|             ptr.getRefData().setCustomData (data.release()); |             ptr.getRefData().setCustomData (data.release()); | ||||||
|  |  | ||||||
|  | @ -8,7 +8,6 @@ | ||||||
| #include "../mwbase/windowmanager.hpp" | #include "../mwbase/windowmanager.hpp" | ||||||
| #include "../mwbase/soundmanager.hpp" | #include "../mwbase/soundmanager.hpp" | ||||||
| 
 | 
 | ||||||
| #include "../mwworld/player.hpp" |  | ||||||
| #include "../mwworld/ptr.hpp" | #include "../mwworld/ptr.hpp" | ||||||
| #include "../mwworld/nullaction.hpp" | #include "../mwworld/nullaction.hpp" | ||||||
| #include "../mwworld/failedaction.hpp" | #include "../mwworld/failedaction.hpp" | ||||||
|  | @ -97,7 +96,7 @@ namespace MWClass | ||||||
| 
 | 
 | ||||||
|         if (needKey && hasKey) |         if (needKey && hasKey) | ||||||
|         { |         { | ||||||
|             if(actor == MWBase::Environment::get().getWorld()->getPlayer().getPlayer()) |             if(actor == MWBase::Environment::get().getWorld()->getPlayerPtr()) | ||||||
|                 MWBase::Environment::get().getWindowManager()->messageBox(keyName + " #{sKeyUsed}"); |                 MWBase::Environment::get().getWindowManager()->messageBox(keyName + " #{sKeyUsed}"); | ||||||
|             ptr.getCellRef().mLockLevel = 0; |             ptr.getCellRef().mLockLevel = 0; | ||||||
|             // using a key disarms the trap
 |             // using a key disarms the trap
 | ||||||
|  | @ -118,7 +117,7 @@ namespace MWClass | ||||||
|             { |             { | ||||||
|                 // teleport door
 |                 // teleport door
 | ||||||
|                 /// \todo remove this if clause once ActionTeleport can also support other actors
 |                 /// \todo remove this if clause once ActionTeleport can also support other actors
 | ||||||
|                 if (MWBase::Environment::get().getWorld()->getPlayer().getPlayer()==actor) |                 if (MWBase::Environment::get().getWorld()->getPlayerPtr()==actor) | ||||||
|                 { |                 { | ||||||
|                     boost::shared_ptr<MWWorld::Action> action(new MWWorld::ActionTeleport (ref->mRef.mDestCell, ref->mRef.mDoorDest)); |                     boost::shared_ptr<MWWorld::Action> action(new MWWorld::ActionTeleport (ref->mRef.mDestCell, ref->mRef.mDoorDest)); | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -12,7 +12,6 @@ | ||||||
| #include "../mwworld/cellstore.hpp" | #include "../mwworld/cellstore.hpp" | ||||||
| #include "../mwworld/physicssystem.hpp" | #include "../mwworld/physicssystem.hpp" | ||||||
| #include "../mwworld/actioneat.hpp" | #include "../mwworld/actioneat.hpp" | ||||||
| #include "../mwworld/player.hpp" |  | ||||||
| #include "../mwworld/nullaction.hpp" | #include "../mwworld/nullaction.hpp" | ||||||
| 
 | 
 | ||||||
| #include "../mwmechanics/npcstats.hpp" | #include "../mwmechanics/npcstats.hpp" | ||||||
|  | @ -153,7 +152,7 @@ namespace MWClass | ||||||
|             text += MWGui::ToolTips::getMiscString(ref->mBase->mScript, "Script"); |             text += MWGui::ToolTips::getMiscString(ref->mBase->mScript, "Script"); | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|         MWWorld::Ptr player = MWBase::Environment::get().getWorld ()->getPlayer ().getPlayer(); |         MWWorld::Ptr player = MWBase::Environment::get().getWorld ()->getPlayerPtr(); | ||||||
|         MWMechanics::NpcStats& npcStats = MWWorld::Class::get(player).getNpcStats (player); |         MWMechanics::NpcStats& npcStats = MWWorld::Class::get(player).getNpcStats (player); | ||||||
|         int alchemySkill = npcStats.getSkill (ESM::Skill::Alchemy).getBase(); |         int alchemySkill = npcStats.getSkill (ESM::Skill::Alchemy).getBase(); | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -93,7 +93,9 @@ namespace MWClass | ||||||
|         MWWorld::LiveCellRef<ESM::Miscellaneous> *ref = |         MWWorld::LiveCellRef<ESM::Miscellaneous> *ref = | ||||||
|             ptr.get<ESM::Miscellaneous>(); |             ptr.get<ESM::Miscellaneous>(); | ||||||
| 
 | 
 | ||||||
|         int value = (ptr.getCellRef().mGoldValue == 1) ? ref->mBase->mData.mValue : ptr.getCellRef().mGoldValue; |         int value = ref->mBase->mData.mValue; | ||||||
|  |         if (ptr.getCellRef().mGoldValue > 1 && ptr.getRefData().getCount() == 1) | ||||||
|  |             value = ptr.getCellRef().mGoldValue; | ||||||
| 
 | 
 | ||||||
|         if (ptr.getCellRef().mSoul != "") |         if (ptr.getCellRef().mSoul != "") | ||||||
|         { |         { | ||||||
|  |  | ||||||
|  | @ -328,7 +328,7 @@ namespace MWClass | ||||||
| 
 | 
 | ||||||
|             // TODO: this is not quite correct, in vanilla the merchant's gold pool is not available in his inventory.
 |             // TODO: this is not quite correct, in vanilla the merchant's gold pool is not available in his inventory.
 | ||||||
|             // (except for gold you gave him)
 |             // (except for gold you gave him)
 | ||||||
|             getContainerStore(ptr).add("gold_001", gold, ptr); |             getContainerStore(ptr).add(MWWorld::ContainerStore::sGoldId, gold, ptr); | ||||||
| 
 | 
 | ||||||
|             getInventoryStore(ptr).autoEquip(ptr); |             getInventoryStore(ptr).autoEquip(ptr); | ||||||
|         } |         } | ||||||
|  |  | ||||||
|  | @ -13,7 +13,6 @@ | ||||||
| #include "../mwworld/cellstore.hpp" | #include "../mwworld/cellstore.hpp" | ||||||
| #include "../mwworld/containerstore.hpp" | #include "../mwworld/containerstore.hpp" | ||||||
| #include "../mwworld/physicssystem.hpp" | #include "../mwworld/physicssystem.hpp" | ||||||
| #include "../mwworld/player.hpp" |  | ||||||
| #include "../mwworld/nullaction.hpp" | #include "../mwworld/nullaction.hpp" | ||||||
| 
 | 
 | ||||||
| #include "../mwgui/tooltips.hpp" | #include "../mwgui/tooltips.hpp" | ||||||
|  | @ -133,7 +132,7 @@ namespace MWClass | ||||||
|         info.effects = MWGui::Widgets::MWEffectList::effectListFromESM(&ref->mBase->mEffects); |         info.effects = MWGui::Widgets::MWEffectList::effectListFromESM(&ref->mBase->mEffects); | ||||||
| 
 | 
 | ||||||
|         // hide effects the player doesnt know about
 |         // hide effects the player doesnt know about
 | ||||||
|         MWWorld::Ptr player = MWBase::Environment::get().getWorld ()->getPlayer ().getPlayer(); |         MWWorld::Ptr player = MWBase::Environment::get().getWorld ()->getPlayerPtr(); | ||||||
|         MWMechanics::NpcStats& npcStats = MWWorld::Class::get(player).getNpcStats (player); |         MWMechanics::NpcStats& npcStats = MWWorld::Class::get(player).getNpcStats (player); | ||||||
|         int alchemySkill = npcStats.getSkill (ESM::Skill::Alchemy).getBase(); |         int alchemySkill = npcStats.getSkill (ESM::Skill::Alchemy).getBase(); | ||||||
|         int i=0; |         int i=0; | ||||||
|  | @ -167,7 +166,7 @@ namespace MWClass | ||||||
|         MWWorld::LiveCellRef<ESM::Potion> *ref = |         MWWorld::LiveCellRef<ESM::Potion> *ref = | ||||||
|             ptr.get<ESM::Potion>(); |             ptr.get<ESM::Potion>(); | ||||||
| 
 | 
 | ||||||
|         MWWorld::Ptr actor = MWBase::Environment::get().getWorld()->getPlayer().getPlayer(); |         MWWorld::Ptr actor = MWBase::Environment::get().getWorld()->getPlayerPtr(); | ||||||
| 
 | 
 | ||||||
|         // remove used potion (assume it is present in inventory)
 |         // remove used potion (assume it is present in inventory)
 | ||||||
|         ptr.getContainerStore()->remove(ptr, 1, actor); |         ptr.getContainerStore()->remove(ptr, 1, actor); | ||||||
|  |  | ||||||
|  | @ -30,7 +30,6 @@ | ||||||
| #include "../mwworld/class.hpp" | #include "../mwworld/class.hpp" | ||||||
| #include "../mwworld/containerstore.hpp" | #include "../mwworld/containerstore.hpp" | ||||||
| #include "../mwworld/esmstore.hpp" | #include "../mwworld/esmstore.hpp" | ||||||
| #include "../mwworld/player.hpp" |  | ||||||
| 
 | 
 | ||||||
| #include "../mwgui/dialogue.hpp" | #include "../mwgui/dialogue.hpp" | ||||||
| 
 | 
 | ||||||
|  | @ -144,6 +143,7 @@ namespace MWDialogue | ||||||
| 
 | 
 | ||||||
|         //setup the list of topics known by the actor. Topics who are also on the knownTopics list will be added to the GUI
 |         //setup the list of topics known by the actor. Topics who are also on the knownTopics list will be added to the GUI
 | ||||||
|         updateTopics(); |         updateTopics(); | ||||||
|  |         updateGlobals(); | ||||||
| 
 | 
 | ||||||
|         //greeting
 |         //greeting
 | ||||||
|         const MWWorld::Store<ESM::Dialogue> &dialogs = |         const MWWorld::Store<ESM::Dialogue> &dialogs = | ||||||
|  | @ -299,6 +299,11 @@ namespace MWDialogue | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  |     void DialogueManager::updateGlobals() | ||||||
|  |     { | ||||||
|  |         MWBase::Environment::get().getWorld()->updateDialogueGlobals(); | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|     void DialogueManager::updateTopics() |     void DialogueManager::updateTopics() | ||||||
|     { |     { | ||||||
|         std::list<std::string> keywordList; |         std::list<std::string> keywordList; | ||||||
|  | @ -493,7 +498,7 @@ namespace MWDialogue | ||||||
|         else if (curDisp + mTemporaryDispositionChange > 100) |         else if (curDisp + mTemporaryDispositionChange > 100) | ||||||
|             mTemporaryDispositionChange = 100 - curDisp; |             mTemporaryDispositionChange = 100 - curDisp; | ||||||
| 
 | 
 | ||||||
|         MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayer().getPlayer(); |         MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr(); | ||||||
|         MWWorld::Class::get(player).skillUsageSucceeded(player, ESM::Skill::Speechcraft, success ? 0 : 1); |         MWWorld::Class::get(player).skillUsageSucceeded(player, ESM::Skill::Speechcraft, success ? 0 : 1); | ||||||
| 
 | 
 | ||||||
|         std::string text; |         std::string text; | ||||||
|  |  | ||||||
|  | @ -40,6 +40,7 @@ namespace MWDialogue | ||||||
|             void parseText (const std::string& text); |             void parseText (const std::string& text); | ||||||
| 
 | 
 | ||||||
|             void updateTopics(); |             void updateTopics(); | ||||||
|  |             void updateGlobals(); | ||||||
| 
 | 
 | ||||||
|             bool compile (const std::string& cmd,std::vector<Interpreter::Type_Code>& code); |             bool compile (const std::string& cmd,std::vector<Interpreter::Type_Code>& code); | ||||||
|             void executeScript (const std::string& script); |             void executeScript (const std::string& script); | ||||||
|  |  | ||||||
|  | @ -8,7 +8,6 @@ | ||||||
| #include "../mwbase/dialoguemanager.hpp" | #include "../mwbase/dialoguemanager.hpp" | ||||||
| 
 | 
 | ||||||
| #include "../mwworld/class.hpp" | #include "../mwworld/class.hpp" | ||||||
| #include "../mwworld/player.hpp" |  | ||||||
| #include "../mwworld/containerstore.hpp" | #include "../mwworld/containerstore.hpp" | ||||||
| #include "../mwworld/inventorystore.hpp" | #include "../mwworld/inventorystore.hpp" | ||||||
| 
 | 
 | ||||||
|  | @ -93,7 +92,7 @@ bool MWDialogue::Filter::testActor (const ESM::DialInfo& info) const | ||||||
| 
 | 
 | ||||||
| bool MWDialogue::Filter::testPlayer (const ESM::DialInfo& info) const | bool MWDialogue::Filter::testPlayer (const ESM::DialInfo& info) const | ||||||
| { | { | ||||||
|     const MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayer().getPlayer(); |     const MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr(); | ||||||
| 
 | 
 | ||||||
|     // check player faction
 |     // check player faction
 | ||||||
|     if (!info.mPcFaction.empty()) |     if (!info.mPcFaction.empty()) | ||||||
|  | @ -212,7 +211,7 @@ bool MWDialogue::Filter::testSelectStructNumeric (const SelectWrapper& select) c | ||||||
| 
 | 
 | ||||||
|         case SelectWrapper::Function_PcHealthPercent: |         case SelectWrapper::Function_PcHealthPercent: | ||||||
|         { |         { | ||||||
|             MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayer().getPlayer(); |             MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr(); | ||||||
| 
 | 
 | ||||||
|             float ratio = MWWorld::Class::get (player).getCreatureStats (player).getHealth().getCurrent() / |             float ratio = MWWorld::Class::get (player).getCreatureStats (player).getHealth().getCurrent() / | ||||||
|                 MWWorld::Class::get (player).getCreatureStats (player).getHealth().getModified(); |                 MWWorld::Class::get (player).getCreatureStats (player).getHealth().getModified(); | ||||||
|  | @ -222,7 +221,7 @@ bool MWDialogue::Filter::testSelectStructNumeric (const SelectWrapper& select) c | ||||||
| 
 | 
 | ||||||
|         case SelectWrapper::Function_PcDynamicStat: |         case SelectWrapper::Function_PcDynamicStat: | ||||||
|         { |         { | ||||||
|             MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayer().getPlayer(); |             MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr(); | ||||||
| 
 | 
 | ||||||
|             float value = MWWorld::Class::get (player).getCreatureStats (player). |             float value = MWWorld::Class::get (player).getCreatureStats (player). | ||||||
|                 getDynamic (select.getArgument()).getCurrent(); |                 getDynamic (select.getArgument()).getCurrent(); | ||||||
|  | @ -246,7 +245,7 @@ bool MWDialogue::Filter::testSelectStructNumeric (const SelectWrapper& select) c | ||||||
| 
 | 
 | ||||||
| int MWDialogue::Filter::getSelectStructInteger (const SelectWrapper& select) const | int MWDialogue::Filter::getSelectStructInteger (const SelectWrapper& select) const | ||||||
| { | { | ||||||
|     MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayer().getPlayer(); |     MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr(); | ||||||
| 
 | 
 | ||||||
|     switch (select.getFunction()) |     switch (select.getFunction()) | ||||||
|     { |     { | ||||||
|  | @ -420,7 +419,7 @@ int MWDialogue::Filter::getSelectStructInteger (const SelectWrapper& select) con | ||||||
| 
 | 
 | ||||||
| bool MWDialogue::Filter::getSelectStructBoolean (const SelectWrapper& select) const | bool MWDialogue::Filter::getSelectStructBoolean (const SelectWrapper& select) const | ||||||
| { | { | ||||||
|     MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayer().getPlayer(); |     MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr(); | ||||||
| 
 | 
 | ||||||
|     switch (select.getFunction()) |     switch (select.getFunction()) | ||||||
|     { |     { | ||||||
|  | @ -508,9 +507,7 @@ bool MWDialogue::Filter::getSelectStructBoolean (const SelectWrapper& select) co | ||||||
|             std::string faction = |             std::string faction = | ||||||
|                 MWWorld::Class::get (mActor).getNpcStats (mActor).getFactionRanks().begin()->first; |                 MWWorld::Class::get (mActor).getNpcStats (mActor).getFactionRanks().begin()->first; | ||||||
| 
 | 
 | ||||||
|             std::set<std::string>& expelled = MWWorld::Class::get (player).getNpcStats (player).getExpelled(); |             return player.getClass().getNpcStats(player).getExpelled(faction); | ||||||
| 
 |  | ||||||
|             return expelled.find (faction)!=expelled.end(); |  | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|         case SelectWrapper::Function_PcVampire: |         case SelectWrapper::Function_PcVampire: | ||||||
|  |  | ||||||
|  | @ -8,7 +8,6 @@ | ||||||
| #include "../mwbase/soundmanager.hpp" | #include "../mwbase/soundmanager.hpp" | ||||||
| #include "../mwbase/windowmanager.hpp" | #include "../mwbase/windowmanager.hpp" | ||||||
| 
 | 
 | ||||||
| #include "../mwworld/player.hpp" |  | ||||||
| #include "../mwworld/class.hpp" | #include "../mwworld/class.hpp" | ||||||
| 
 | 
 | ||||||
| #include "inventoryitemmodel.hpp" | #include "inventoryitemmodel.hpp" | ||||||
|  | @ -143,9 +142,9 @@ namespace MWGui | ||||||
| 
 | 
 | ||||||
|     void AlchemyWindow::open() |     void AlchemyWindow::open() | ||||||
|     { |     { | ||||||
|         mAlchemy.setAlchemist (MWBase::Environment::get().getWorld()->getPlayer().getPlayer()); |         mAlchemy.setAlchemist (MWBase::Environment::get().getWorld()->getPlayerPtr()); | ||||||
| 
 | 
 | ||||||
|         InventoryItemModel* model = new InventoryItemModel(MWBase::Environment::get().getWorld()->getPlayer().getPlayer()); |         InventoryItemModel* model = new InventoryItemModel(MWBase::Environment::get().getWorld()->getPlayerPtr()); | ||||||
|         mSortModel = new SortFilterItemModel(model); |         mSortModel = new SortFilterItemModel(model); | ||||||
|         mSortModel->setFilter(SortFilterItemModel::Filter_OnlyIngredients); |         mSortModel->setFilter(SortFilterItemModel::Filter_OnlyIngredients); | ||||||
|         mItemView->setModel (mSortModel); |         mItemView->setModel (mSortModel); | ||||||
|  | @ -154,7 +153,7 @@ namespace MWGui | ||||||
| 
 | 
 | ||||||
|         int index = 0; |         int index = 0; | ||||||
| 
 | 
 | ||||||
|         mAlchemy.setAlchemist (MWBase::Environment::get().getWorld()->getPlayer().getPlayer()); |         mAlchemy.setAlchemist (MWBase::Environment::get().getWorld()->getPlayerPtr()); | ||||||
| 
 | 
 | ||||||
|         for (MWMechanics::Alchemy::TToolsIterator iter (mAlchemy.beginTools()); |         for (MWMechanics::Alchemy::TToolsIterator iter (mAlchemy.beginTools()); | ||||||
|             iter!=mAlchemy.endTools() && index<static_cast<int> (mApparatus.size()); ++iter, ++index) |             iter!=mAlchemy.endTools() && index<static_cast<int> (mApparatus.size()); ++iter, ++index) | ||||||
|  |  | ||||||
|  | @ -8,7 +8,6 @@ | ||||||
| #include "../mwbase/windowmanager.hpp" | #include "../mwbase/windowmanager.hpp" | ||||||
| 
 | 
 | ||||||
| #include "../mwworld/actiontake.hpp" | #include "../mwworld/actiontake.hpp" | ||||||
| #include "../mwworld/player.hpp" |  | ||||||
| 
 | 
 | ||||||
| #include "formatting.hpp" | #include "formatting.hpp" | ||||||
| 
 | 
 | ||||||
|  | @ -138,7 +137,7 @@ namespace MWGui | ||||||
|         MWBase::Environment::get().getSoundManager()->playSound("Item Book Up", 1.0, 1.0); |         MWBase::Environment::get().getSoundManager()->playSound("Item Book Up", 1.0, 1.0); | ||||||
| 
 | 
 | ||||||
|         MWWorld::ActionTake take(mBook); |         MWWorld::ActionTake take(mBook); | ||||||
|         take.execute (MWBase::Environment::get().getWorld()->getPlayer().getPlayer()); |         take.execute (MWBase::Environment::get().getWorld()->getPlayerPtr()); | ||||||
| 
 | 
 | ||||||
|         MWBase::Environment::get().getWindowManager()->removeGuiMode(GM_Book); |         MWBase::Environment::get().getWindowManager()->removeGuiMode(GM_Book); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|  | @ -13,7 +13,6 @@ | ||||||
| #include "../mwmechanics/creaturestats.hpp" | #include "../mwmechanics/creaturestats.hpp" | ||||||
| #include "../mwworld/class.hpp" | #include "../mwworld/class.hpp" | ||||||
| #include "../mwworld/fallback.hpp" | #include "../mwworld/fallback.hpp" | ||||||
| #include "../mwworld/player.hpp" |  | ||||||
| 
 | 
 | ||||||
| namespace | namespace | ||||||
| { | { | ||||||
|  | @ -47,7 +46,7 @@ namespace | ||||||
| 
 | 
 | ||||||
|     void updatePlayerHealth() |     void updatePlayerHealth() | ||||||
|     { |     { | ||||||
|         MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayer().getPlayer(); |         MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr(); | ||||||
|         MWMechanics::CreatureStats& creatureStats = MWWorld::Class::get(player).getCreatureStats(player); |         MWMechanics::CreatureStats& creatureStats = MWWorld::Class::get(player).getCreatureStats(player); | ||||||
| 
 | 
 | ||||||
|         creatureStats.updateHealth(); |         creatureStats.updateHealth(); | ||||||
|  | @ -220,7 +219,7 @@ namespace MWGui | ||||||
|                 mReviewDialog->setBirthSign(mPlayerBirthSignId); |                 mReviewDialog->setBirthSign(mPlayerBirthSignId); | ||||||
| 
 | 
 | ||||||
|                 { |                 { | ||||||
|                     MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayer().getPlayer(); |                     MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr(); | ||||||
|                     const MWMechanics::CreatureStats& stats = MWWorld::Class::get(player).getCreatureStats(player); |                     const MWMechanics::CreatureStats& stats = MWWorld::Class::get(player).getCreatureStats(player); | ||||||
| 
 | 
 | ||||||
|                     mReviewDialog->setHealth ( stats.getHealth()  ); |                     mReviewDialog->setHealth ( stats.getHealth()  ); | ||||||
|  |  | ||||||
|  | @ -10,7 +10,6 @@ | ||||||
| #include "../mwbase/mechanicsmanager.hpp" | #include "../mwbase/mechanicsmanager.hpp" | ||||||
| 
 | 
 | ||||||
| #include "../mwworld/class.hpp" | #include "../mwworld/class.hpp" | ||||||
| #include "../mwworld/player.hpp" |  | ||||||
| #include "../mwworld/containerstore.hpp" | #include "../mwworld/containerstore.hpp" | ||||||
| 
 | 
 | ||||||
| #include "../mwmechanics/pickpocket.hpp" | #include "../mwmechanics/pickpocket.hpp" | ||||||
|  | @ -223,7 +222,7 @@ namespace MWGui | ||||||
|         if (mPtr.getTypeName() == typeid(ESM::NPC).name() && !loot) |         if (mPtr.getTypeName() == typeid(ESM::NPC).name() && !loot) | ||||||
|         { |         { | ||||||
|             // we are stealing stuff
 |             // we are stealing stuff
 | ||||||
|             MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayer().getPlayer(); |             MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr(); | ||||||
|             mModel = new PickpocketItemModel(player, new InventoryItemModel(container)); |             mModel = new PickpocketItemModel(player, new InventoryItemModel(container)); | ||||||
|         } |         } | ||||||
|         else |         else | ||||||
|  | @ -251,12 +250,12 @@ namespace MWGui | ||||||
|                 && !mPickpocketDetected |                 && !mPickpocketDetected | ||||||
|                 ) |                 ) | ||||||
|         { |         { | ||||||
|             MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayer().getPlayer(); |             MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr(); | ||||||
|             MWMechanics::Pickpocket pickpocket(player, mPtr); |             MWMechanics::Pickpocket pickpocket(player, mPtr); | ||||||
|             if (pickpocket.finish()) |             if (pickpocket.finish()) | ||||||
|             { |             { | ||||||
|                 MWBase::Environment::get().getMechanicsManager()->reportCrime( |                 MWBase::Environment::get().getMechanicsManager()->reportCrime( | ||||||
|                             player, MWWorld::Ptr(), MWBase::MechanicsManager::OT_Pickpocket); |                             player, mPtr, MWBase::MechanicsManager::OT_Pickpocket); | ||||||
|                 MWBase::Environment::get().getWindowManager()->removeGuiMode(MWGui::GM_Container); |                 MWBase::Environment::get().getWindowManager()->removeGuiMode(MWGui::GM_Container); | ||||||
|                 MWBase::Environment::get().getDialogueManager()->say(mPtr, "Thief"); |                 MWBase::Environment::get().getDialogueManager()->say(mPtr, "Thief"); | ||||||
|                 mPickpocketDetected = true; |                 mPickpocketDetected = true; | ||||||
|  | @ -325,7 +324,7 @@ namespace MWGui | ||||||
| 
 | 
 | ||||||
|     bool ContainerWindow::onTakeItem(const ItemStack &item, int count) |     bool ContainerWindow::onTakeItem(const ItemStack &item, int count) | ||||||
|     { |     { | ||||||
|         MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayer().getPlayer(); |         MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr(); | ||||||
|         if (dynamic_cast<PickpocketItemModel*>(mModel)) |         if (dynamic_cast<PickpocketItemModel*>(mModel)) | ||||||
|         { |         { | ||||||
|             MWMechanics::Pickpocket pickpocket(player, mPtr); |             MWMechanics::Pickpocket pickpocket(player, mPtr); | ||||||
|  |  | ||||||
|  | @ -12,7 +12,6 @@ | ||||||
| #include "../mwmechanics/npcstats.hpp" | #include "../mwmechanics/npcstats.hpp" | ||||||
| 
 | 
 | ||||||
| #include "../mwworld/class.hpp" | #include "../mwworld/class.hpp" | ||||||
| #include "../mwworld/player.hpp" |  | ||||||
| #include "../mwworld/containerstore.hpp" | #include "../mwworld/containerstore.hpp" | ||||||
| 
 | 
 | ||||||
| #include "../mwdialogue/dialoguemanagerimp.hpp" | #include "../mwdialogue/dialoguemanagerimp.hpp" | ||||||
|  | @ -21,7 +20,6 @@ | ||||||
| #include "list.hpp" | #include "list.hpp" | ||||||
| #include "tradewindow.hpp" | #include "tradewindow.hpp" | ||||||
| #include "spellbuyingwindow.hpp" | #include "spellbuyingwindow.hpp" | ||||||
| #include "inventorywindow.hpp" |  | ||||||
| #include "travelwindow.hpp" | #include "travelwindow.hpp" | ||||||
| #include "bookpage.hpp" | #include "bookpage.hpp" | ||||||
| 
 | 
 | ||||||
|  | @ -69,24 +67,24 @@ namespace MWGui | ||||||
| 
 | 
 | ||||||
|     void PersuasionDialog::onPersuade(MyGUI::Widget *sender) |     void PersuasionDialog::onPersuade(MyGUI::Widget *sender) | ||||||
|     { |     { | ||||||
|         MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayer().getPlayer(); |         MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr(); | ||||||
|         MWBase::MechanicsManager::PersuasionType type; |         MWBase::MechanicsManager::PersuasionType type; | ||||||
|         if (sender == mAdmireButton) type = MWBase::MechanicsManager::PT_Admire; |         if (sender == mAdmireButton) type = MWBase::MechanicsManager::PT_Admire; | ||||||
|         else if (sender == mIntimidateButton) type = MWBase::MechanicsManager::PT_Intimidate; |         else if (sender == mIntimidateButton) type = MWBase::MechanicsManager::PT_Intimidate; | ||||||
|         else if (sender == mTauntButton) type = MWBase::MechanicsManager::PT_Taunt; |         else if (sender == mTauntButton) type = MWBase::MechanicsManager::PT_Taunt; | ||||||
|         else if (sender == mBribe10Button) |         else if (sender == mBribe10Button) | ||||||
|         { |         { | ||||||
|             player.getClass().getContainerStore(player).remove("gold_001", 10, player); |             player.getClass().getContainerStore(player).remove(MWWorld::ContainerStore::sGoldId, 10, player); | ||||||
|             type = MWBase::MechanicsManager::PT_Bribe10; |             type = MWBase::MechanicsManager::PT_Bribe10; | ||||||
|         } |         } | ||||||
|         else if (sender == mBribe100Button) |         else if (sender == mBribe100Button) | ||||||
|         { |         { | ||||||
|             player.getClass().getContainerStore(player).remove("gold_001", 100, player); |             player.getClass().getContainerStore(player).remove(MWWorld::ContainerStore::sGoldId, 100, player); | ||||||
|             type = MWBase::MechanicsManager::PT_Bribe100; |             type = MWBase::MechanicsManager::PT_Bribe100; | ||||||
|         } |         } | ||||||
|         else /*if (sender == mBribe1000Button)*/ |         else /*if (sender == mBribe1000Button)*/ | ||||||
|         { |         { | ||||||
|             player.getClass().getContainerStore(player).remove("gold_001", 1000, player); |             player.getClass().getContainerStore(player).remove(MWWorld::ContainerStore::sGoldId, 1000, player); | ||||||
|             type = MWBase::MechanicsManager::PT_Bribe1000; |             type = MWBase::MechanicsManager::PT_Bribe1000; | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|  | @ -100,7 +98,8 @@ namespace MWGui | ||||||
|         WindowModal::open(); |         WindowModal::open(); | ||||||
|         center(); |         center(); | ||||||
| 
 | 
 | ||||||
|         int playerGold = MWBase::Environment::get().getWindowManager()->getInventoryWindow()->getPlayerGold(); |         MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr(); | ||||||
|  |         int playerGold = player.getClass().getContainerStore(player).count(MWWorld::ContainerStore::sGoldId); | ||||||
| 
 | 
 | ||||||
|         mBribe10Button->setEnabled (playerGold >= 10); |         mBribe10Button->setEnabled (playerGold >= 10); | ||||||
|         mBribe100Button->setEnabled (playerGold >= 100); |         mBribe100Button->setEnabled (playerGold >= 100); | ||||||
|  |  | ||||||
|  | @ -5,13 +5,11 @@ | ||||||
| #include "../mwbase/environment.hpp" | #include "../mwbase/environment.hpp" | ||||||
| #include "../mwbase/world.hpp" | #include "../mwbase/world.hpp" | ||||||
| #include "../mwbase/soundmanager.hpp" | #include "../mwbase/soundmanager.hpp" | ||||||
| #include "../mwworld/player.hpp" |  | ||||||
| #include "../mwworld/manualref.hpp" |  | ||||||
| #include "../mwworld/class.hpp" | #include "../mwworld/class.hpp" | ||||||
|  | #include "../mwworld/containerstore.hpp" | ||||||
| 
 | 
 | ||||||
| #include "itemselection.hpp" | #include "itemselection.hpp" | ||||||
| #include "container.hpp" | #include "container.hpp" | ||||||
| #include "inventorywindow.hpp" |  | ||||||
| 
 | 
 | ||||||
| #include "sortfilteritemmodel.hpp" | #include "sortfilteritemmodel.hpp" | ||||||
| 
 | 
 | ||||||
|  | @ -106,7 +104,7 @@ namespace MWGui | ||||||
| 
 | 
 | ||||||
|     void EnchantingDialog::startSelfEnchanting(MWWorld::Ptr soulgem) |     void EnchantingDialog::startSelfEnchanting(MWWorld::Ptr soulgem) | ||||||
|     { |     { | ||||||
|         MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayer().getPlayer(); |         MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr(); | ||||||
| 
 | 
 | ||||||
|         mEnchanting.setSelfEnchanting(true); |         mEnchanting.setSelfEnchanting(true); | ||||||
|         mEnchanting.setEnchanter(player); |         mEnchanting.setEnchanter(player); | ||||||
|  | @ -149,7 +147,7 @@ namespace MWGui | ||||||
|         mItemSelectionDialog->eventItemSelected += MyGUI::newDelegate(this, &EnchantingDialog::onItemSelected); |         mItemSelectionDialog->eventItemSelected += MyGUI::newDelegate(this, &EnchantingDialog::onItemSelected); | ||||||
|         mItemSelectionDialog->eventDialogCanceled += MyGUI::newDelegate(this, &EnchantingDialog::onItemCancel); |         mItemSelectionDialog->eventDialogCanceled += MyGUI::newDelegate(this, &EnchantingDialog::onItemCancel); | ||||||
|         mItemSelectionDialog->setVisible(true); |         mItemSelectionDialog->setVisible(true); | ||||||
|         mItemSelectionDialog->openContainer(MWBase::Environment::get().getWorld()->getPlayer().getPlayer()); |         mItemSelectionDialog->openContainer(MWBase::Environment::get().getWorld()->getPlayerPtr()); | ||||||
|         mItemSelectionDialog->setFilter(SortFilterItemModel::Filter_OnlyEnchantable); |         mItemSelectionDialog->setFilter(SortFilterItemModel::Filter_OnlyEnchantable); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  | @ -236,7 +234,7 @@ namespace MWGui | ||||||
|         mItemSelectionDialog->eventItemSelected += MyGUI::newDelegate(this, &EnchantingDialog::onSoulSelected); |         mItemSelectionDialog->eventItemSelected += MyGUI::newDelegate(this, &EnchantingDialog::onSoulSelected); | ||||||
|         mItemSelectionDialog->eventDialogCanceled += MyGUI::newDelegate(this, &EnchantingDialog::onSoulCancel); |         mItemSelectionDialog->eventDialogCanceled += MyGUI::newDelegate(this, &EnchantingDialog::onSoulCancel); | ||||||
|         mItemSelectionDialog->setVisible(true); |         mItemSelectionDialog->setVisible(true); | ||||||
|         mItemSelectionDialog->openContainer(MWBase::Environment::get().getWorld()->getPlayer().getPlayer()); |         mItemSelectionDialog->openContainer(MWBase::Environment::get().getWorld()->getPlayerPtr()); | ||||||
|         mItemSelectionDialog->setFilter(SortFilterItemModel::Filter_OnlyChargedSoulstones); |         mItemSelectionDialog->setFilter(SortFilterItemModel::Filter_OnlyChargedSoulstones); | ||||||
| 
 | 
 | ||||||
|         //MWBase::Environment::get().getWindowManager()->messageBox("#{sInventorySelectNoSoul}");
 |         //MWBase::Environment::get().getWindowManager()->messageBox("#{sInventorySelectNoSoul}");
 | ||||||
|  | @ -290,7 +288,9 @@ namespace MWGui | ||||||
|         mEnchanting.setNewItemName(mName->getCaption()); |         mEnchanting.setNewItemName(mName->getCaption()); | ||||||
|         mEnchanting.setEffect(mEffectList); |         mEnchanting.setEffect(mEffectList); | ||||||
| 
 | 
 | ||||||
|         if (mEnchanting.getEnchantPrice() > MWBase::Environment::get().getWindowManager()->getInventoryWindow()->getPlayerGold()) |         MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr(); | ||||||
|  |         int playerGold = player.getClass().getContainerStore(player).count(MWWorld::ContainerStore::sGoldId); | ||||||
|  |         if (mEnchanting.getEnchantPrice() > playerGold) | ||||||
|         { |         { | ||||||
|             MWBase::Environment::get().getWindowManager()->messageBox ("#{sNotifyMessage18}"); |             MWBase::Environment::get().getWindowManager()->messageBox ("#{sNotifyMessage18}"); | ||||||
|             return; |             return; | ||||||
|  |  | ||||||
|  | @ -6,7 +6,6 @@ | ||||||
| #include "../mwbase/soundmanager.hpp" | #include "../mwbase/soundmanager.hpp" | ||||||
| #include "../mwbase/windowmanager.hpp" | #include "../mwbase/windowmanager.hpp" | ||||||
| 
 | 
 | ||||||
| #include "../mwworld/player.hpp" |  | ||||||
| #include "../mwworld/class.hpp" | #include "../mwworld/class.hpp" | ||||||
| 
 | 
 | ||||||
| #include "../mwmechanics/creaturestats.hpp" | #include "../mwmechanics/creaturestats.hpp" | ||||||
|  | @ -242,7 +241,7 @@ namespace MWGui | ||||||
|             if (world->canPlaceObject(mouseX, mouseY)) |             if (world->canPlaceObject(mouseX, mouseY)) | ||||||
|                 world->placeObject(object, mouseX, mouseY, mDragAndDrop->mDraggedCount); |                 world->placeObject(object, mouseX, mouseY, mDragAndDrop->mDraggedCount); | ||||||
|             else |             else | ||||||
|                 world->dropObjectOnGround(world->getPlayer().getPlayer(), object, mDragAndDrop->mDraggedCount); |                 world->dropObjectOnGround(world->getPlayerPtr(), object, mDragAndDrop->mDraggedCount); | ||||||
| 
 | 
 | ||||||
|             MWBase::Environment::get().getWindowManager()->changePointer("arrow"); |             MWBase::Environment::get().getWindowManager()->changePointer("arrow"); | ||||||
| 
 | 
 | ||||||
|  | @ -320,7 +319,7 @@ namespace MWGui | ||||||
| 
 | 
 | ||||||
|     void HUD::onWeaponClicked(MyGUI::Widget* _sender) |     void HUD::onWeaponClicked(MyGUI::Widget* _sender) | ||||||
|     { |     { | ||||||
|         const MWWorld::Ptr& player = MWBase::Environment::get().getWorld()->getPlayer().getPlayer(); |         const MWWorld::Ptr& player = MWBase::Environment::get().getWorld()->getPlayerPtr(); | ||||||
|         if (MWWorld::Class::get(player).getNpcStats(player).isWerewolf()) |         if (MWWorld::Class::get(player).getNpcStats(player).isWerewolf()) | ||||||
|         { |         { | ||||||
|             MWBase::Environment::get().getWindowManager()->messageBox("#{sWerewolfRefusal}"); |             MWBase::Environment::get().getWindowManager()->messageBox("#{sWerewolfRefusal}"); | ||||||
|  | @ -332,7 +331,7 @@ namespace MWGui | ||||||
| 
 | 
 | ||||||
|     void HUD::onMagicClicked(MyGUI::Widget* _sender) |     void HUD::onMagicClicked(MyGUI::Widget* _sender) | ||||||
|     { |     { | ||||||
|         const MWWorld::Ptr& player = MWBase::Environment::get().getWorld()->getPlayer().getPlayer(); |         const MWWorld::Ptr& player = MWBase::Environment::get().getWorld()->getPlayerPtr(); | ||||||
|         if (MWWorld::Class::get(player).getNpcStats(player).isWerewolf()) |         if (MWWorld::Class::get(player).getNpcStats(player).isWerewolf()) | ||||||
|         { |         { | ||||||
|             MWBase::Environment::get().getWindowManager()->messageBox("#{sWerewolfRefusal}"); |             MWBase::Environment::get().getWindowManager()->messageBox("#{sWerewolfRefusal}"); | ||||||
|  | @ -517,7 +516,7 @@ namespace MWGui | ||||||
|         mWeapStatus->setProgressPosition(0); |         mWeapStatus->setProgressPosition(0); | ||||||
| 
 | 
 | ||||||
|         MWBase::World *world = MWBase::Environment::get().getWorld(); |         MWBase::World *world = MWBase::Environment::get().getWorld(); | ||||||
|         MWWorld::Ptr player = world->getPlayer().getPlayer(); |         MWWorld::Ptr player = world->getPlayerPtr(); | ||||||
|         if (MWWorld::Class::get(player).getNpcStats(player).isWerewolf()) |         if (MWWorld::Class::get(player).getNpcStats(player).isWerewolf()) | ||||||
|             mWeapImage->setImageTexture("icons\\k\\tx_werewolf_hand.dds"); |             mWeapImage->setImageTexture("icons\\k\\tx_werewolf_hand.dds"); | ||||||
|         else |         else | ||||||
|  |  | ||||||
|  | @ -10,7 +10,6 @@ | ||||||
| #include "../mwbase/windowmanager.hpp" | #include "../mwbase/windowmanager.hpp" | ||||||
| #include "../mwbase/mechanicsmanager.hpp" | #include "../mwbase/mechanicsmanager.hpp" | ||||||
| 
 | 
 | ||||||
| #include "../mwworld/player.hpp" |  | ||||||
| #include "../mwworld/inventorystore.hpp" | #include "../mwworld/inventorystore.hpp" | ||||||
| #include "../mwworld/class.hpp" | #include "../mwworld/class.hpp" | ||||||
| #include "../mwworld/action.hpp" | #include "../mwworld/action.hpp" | ||||||
|  | @ -34,7 +33,7 @@ namespace MWGui | ||||||
|         , mTrading(false) |         , mTrading(false) | ||||||
|         , mLastXSize(0) |         , mLastXSize(0) | ||||||
|         , mLastYSize(0) |         , mLastYSize(0) | ||||||
|         , mPreview(MWBase::Environment::get().getWorld ()->getPlayer ().getPlayer ()) |         , mPreview(MWBase::Environment::get().getWorld ()->getPlayerPtr()) | ||||||
|         , mPreviewDirty(true) |         , mPreviewDirty(true) | ||||||
|         , mDragAndDrop(dragAndDrop) |         , mDragAndDrop(dragAndDrop) | ||||||
|         , mSelectedItem(-1) |         , mSelectedItem(-1) | ||||||
|  | @ -85,7 +84,7 @@ namespace MWGui | ||||||
| 
 | 
 | ||||||
|     void InventoryWindow::updatePlayer() |     void InventoryWindow::updatePlayer() | ||||||
|     { |     { | ||||||
|         mPtr = MWBase::Environment::get().getWorld ()->getPlayer ().getPlayer (); |         mPtr = MWBase::Environment::get().getWorld ()->getPlayerPtr(); | ||||||
|         mTradeModel = new TradeItemModel(new InventoryItemModel(mPtr), MWWorld::Ptr()); |         mTradeModel = new TradeItemModel(new InventoryItemModel(mPtr), MWWorld::Ptr()); | ||||||
|         mSortModel = new SortFilterItemModel(mTradeModel); |         mSortModel = new SortFilterItemModel(mTradeModel); | ||||||
|         mItemView->setModel(mSortModel); |         mItemView->setModel(mSortModel); | ||||||
|  | @ -277,7 +276,7 @@ namespace MWGui | ||||||
| 
 | 
 | ||||||
|     void InventoryWindow::open() |     void InventoryWindow::open() | ||||||
|     { |     { | ||||||
|         mPtr = MWBase::Environment::get().getWorld()->getPlayer().getPlayer(); |         mPtr = MWBase::Environment::get().getWorld()->getPlayerPtr(); | ||||||
| 
 | 
 | ||||||
|         updateEncumbranceBar(); |         updateEncumbranceBar(); | ||||||
| 
 | 
 | ||||||
|  | @ -373,7 +372,7 @@ namespace MWGui | ||||||
| 
 | 
 | ||||||
|             boost::shared_ptr<MWWorld::Action> action = MWWorld::Class::get(ptr).use(ptr); |             boost::shared_ptr<MWWorld::Action> action = MWWorld::Class::get(ptr).use(ptr); | ||||||
| 
 | 
 | ||||||
|             action->execute (MWBase::Environment::get().getWorld()->getPlayer().getPlayer()); |             action->execute (MWBase::Environment::get().getWorld()->getPlayerPtr()); | ||||||
| 
 | 
 | ||||||
|             // this is necessary for books/scrolls: if they are already in the player's inventory,
 |             // this is necessary for books/scrolls: if they are already in the player's inventory,
 | ||||||
|             // the "Take" button should not be visible.
 |             // the "Take" button should not be visible.
 | ||||||
|  | @ -433,7 +432,7 @@ namespace MWGui | ||||||
| 
 | 
 | ||||||
|     void InventoryWindow::updateEncumbranceBar() |     void InventoryWindow::updateEncumbranceBar() | ||||||
|     { |     { | ||||||
|         MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayer().getPlayer(); |         MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr(); | ||||||
| 
 | 
 | ||||||
|         float capacity = MWWorld::Class::get(player).getCapacity(player); |         float capacity = MWWorld::Class::get(player).getCapacity(player); | ||||||
|         float encumbrance = MWWorld::Class::get(player).getEncumbrance(player); |         float encumbrance = MWWorld::Class::get(player).getEncumbrance(player); | ||||||
|  | @ -448,19 +447,6 @@ namespace MWGui | ||||||
|         updateEncumbranceBar(); |         updateEncumbranceBar(); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     int InventoryWindow::getPlayerGold() |  | ||||||
|     { |  | ||||||
|         MWWorld::InventoryStore& invStore = MWWorld::Class::get(mPtr).getInventoryStore(mPtr); |  | ||||||
| 
 |  | ||||||
|         for (MWWorld::ContainerStoreIterator it = invStore.begin(); |  | ||||||
|                 it != invStore.end(); ++it) |  | ||||||
|         { |  | ||||||
|             if (Misc::StringUtils::ciEqual(it->getCellRef().mRefID, "gold_001")) |  | ||||||
|                 return it->getRefData().getCount(); |  | ||||||
|         } |  | ||||||
|         return 0; |  | ||||||
|     } |  | ||||||
| 
 |  | ||||||
|     void InventoryWindow::setTrading(bool trading) |     void InventoryWindow::setTrading(bool trading) | ||||||
|     { |     { | ||||||
|         mTrading = trading; |         mTrading = trading; | ||||||
|  | @ -513,12 +499,10 @@ namespace MWGui | ||||||
|             return; |             return; | ||||||
| 
 | 
 | ||||||
|         int count = object.getRefData().getCount(); |         int count = object.getRefData().getCount(); | ||||||
|         if (object.getCellRef().mGoldValue > 1) |  | ||||||
|             count = object.getCellRef().mGoldValue; |  | ||||||
| 
 | 
 | ||||||
|         // add to player inventory
 |         // add to player inventory
 | ||||||
|         // can't use ActionTake here because we need an MWWorld::Ptr to the newly inserted object
 |         // can't use ActionTake here because we need an MWWorld::Ptr to the newly inserted object
 | ||||||
|         MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayer().getPlayer(); |         MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr(); | ||||||
|         MWWorld::Ptr newObject = *player.getClass().getContainerStore (player).add (object, object.getRefData().getCount(), player); |         MWWorld::Ptr newObject = *player.getClass().getContainerStore (player).add (object, object.getRefData().getCount(), player); | ||||||
|         // remove from world
 |         // remove from world
 | ||||||
|         MWBase::Environment::get().getWorld()->deleteObject (object); |         MWBase::Environment::get().getWorld()->deleteObject (object); | ||||||
|  |  | ||||||
|  | @ -31,8 +31,6 @@ namespace MWGui | ||||||
| 
 | 
 | ||||||
|             void pickUpObject (MWWorld::Ptr object); |             void pickUpObject (MWWorld::Ptr object); | ||||||
| 
 | 
 | ||||||
|             int getPlayerGold(); |  | ||||||
| 
 |  | ||||||
|             MyGUI::IntCoord getAvatarScreenCoord(); |             MyGUI::IntCoord getAvatarScreenCoord(); | ||||||
| 
 | 
 | ||||||
|             MWWorld::Ptr getAvatarSelectedItem(int x, int y); |             MWWorld::Ptr getAvatarSelectedItem(int x, int y); | ||||||
|  |  | ||||||
|  | @ -6,7 +6,6 @@ | ||||||
| #include "../mwbase/environment.hpp" | #include "../mwbase/environment.hpp" | ||||||
| #include "../mwbase/world.hpp" | #include "../mwbase/world.hpp" | ||||||
| 
 | 
 | ||||||
| #include "../mwworld/player.hpp" |  | ||||||
| #include "../mwworld/class.hpp" | #include "../mwworld/class.hpp" | ||||||
| #include "../mwworld/fallback.hpp" | #include "../mwworld/fallback.hpp" | ||||||
| 
 | 
 | ||||||
|  | @ -59,7 +58,7 @@ namespace MWGui | ||||||
| 
 | 
 | ||||||
|     void LevelupDialog::setAttributeValues() |     void LevelupDialog::setAttributeValues() | ||||||
|     { |     { | ||||||
|         MWWorld::Ptr player = MWBase::Environment::get().getWorld ()->getPlayer().getPlayer(); |         MWWorld::Ptr player = MWBase::Environment::get().getWorld ()->getPlayerPtr(); | ||||||
|         MWMechanics::CreatureStats& creatureStats = MWWorld::Class::get(player).getCreatureStats (player); |         MWMechanics::CreatureStats& creatureStats = MWWorld::Class::get(player).getCreatureStats (player); | ||||||
|         MWMechanics::NpcStats& pcStats = MWWorld::Class::get(player).getNpcStats (player); |         MWMechanics::NpcStats& pcStats = MWWorld::Class::get(player).getNpcStats (player); | ||||||
| 
 | 
 | ||||||
|  | @ -115,7 +114,7 @@ namespace MWGui | ||||||
|     void LevelupDialog::open() |     void LevelupDialog::open() | ||||||
|     { |     { | ||||||
|         MWBase::World *world = MWBase::Environment::get().getWorld(); |         MWBase::World *world = MWBase::Environment::get().getWorld(); | ||||||
|         MWWorld::Ptr player = world->getPlayer().getPlayer(); |         MWWorld::Ptr player = world->getPlayerPtr(); | ||||||
|         MWMechanics::CreatureStats& creatureStats = MWWorld::Class::get(player).getCreatureStats (player); |         MWMechanics::CreatureStats& creatureStats = MWWorld::Class::get(player).getCreatureStats (player); | ||||||
|         MWMechanics::NpcStats& pcStats = MWWorld::Class::get(player).getNpcStats (player); |         MWMechanics::NpcStats& pcStats = MWWorld::Class::get(player).getNpcStats (player); | ||||||
| 
 | 
 | ||||||
|  | @ -155,7 +154,7 @@ namespace MWGui | ||||||
| 
 | 
 | ||||||
|     void LevelupDialog::onOkButtonClicked (MyGUI::Widget* sender) |     void LevelupDialog::onOkButtonClicked (MyGUI::Widget* sender) | ||||||
|     { |     { | ||||||
|         MWWorld::Ptr player = MWBase::Environment::get().getWorld ()->getPlayer().getPlayer(); |         MWWorld::Ptr player = MWBase::Environment::get().getWorld ()->getPlayerPtr(); | ||||||
|         MWMechanics::CreatureStats& creatureStats = MWWorld::Class::get(player).getCreatureStats (player); |         MWMechanics::CreatureStats& creatureStats = MWWorld::Class::get(player).getCreatureStats (player); | ||||||
|         MWMechanics::NpcStats& pcStats = MWWorld::Class::get(player).getNpcStats (player); |         MWMechanics::NpcStats& pcStats = MWWorld::Class::get(player).getNpcStats (player); | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -294,7 +294,7 @@ namespace MWGui | ||||||
|         std::vector<MWWorld::Ptr> markers; |         std::vector<MWWorld::Ptr> markers; | ||||||
|         MWBase::World* world = MWBase::Environment::get().getWorld(); |         MWBase::World* world = MWBase::Environment::get().getWorld(); | ||||||
|         world->listDetectedReferences( |         world->listDetectedReferences( | ||||||
|                     world->getPlayer().getPlayer(), |                     world->getPlayerPtr(), | ||||||
|                     markers, MWBase::World::DetectionType(type)); |                     markers, MWBase::World::DetectionType(type)); | ||||||
|         if (markers.empty()) |         if (markers.empty()) | ||||||
|             return; |             return; | ||||||
|  | @ -515,8 +515,8 @@ namespace MWGui | ||||||
|         // For interiors, position is set by WindowManager via setGlobalMapPlayerPosition
 |         // For interiors, position is set by WindowManager via setGlobalMapPlayerPosition
 | ||||||
|         if (MWBase::Environment::get().getWorld ()->isCellExterior ()) |         if (MWBase::Environment::get().getWorld ()->isCellExterior ()) | ||||||
|         { |         { | ||||||
|             Ogre::Vector3 pos = MWBase::Environment::get().getWorld ()->getPlayer ().getPlayer().getRefData ().getBaseNode ()->_getDerivedPosition (); |             Ogre::Vector3 pos = MWBase::Environment::get().getWorld ()->getPlayerPtr().getRefData ().getBaseNode ()->_getDerivedPosition (); | ||||||
|             Ogre::Quaternion orient = MWBase::Environment::get().getWorld ()->getPlayer ().getPlayer().getRefData ().getBaseNode ()->_getDerivedOrientation (); |             Ogre::Quaternion orient = MWBase::Environment::get().getWorld ()->getPlayerPtr().getRefData ().getBaseNode ()->_getDerivedOrientation (); | ||||||
|             Ogre::Vector2 dir (orient.yAxis ().x, orient.yAxis().y); |             Ogre::Vector2 dir (orient.yAxis ().x, orient.yAxis().y); | ||||||
| 
 | 
 | ||||||
|             float worldX, worldY; |             float worldX, worldY; | ||||||
|  |  | ||||||
|  | @ -8,12 +8,9 @@ | ||||||
| #include "../mwbase/windowmanager.hpp" | #include "../mwbase/windowmanager.hpp" | ||||||
| #include "../mwbase/soundmanager.hpp" | #include "../mwbase/soundmanager.hpp" | ||||||
| 
 | 
 | ||||||
| #include "../mwworld/player.hpp" |  | ||||||
| #include "../mwworld/class.hpp" | #include "../mwworld/class.hpp" | ||||||
| #include "../mwworld/containerstore.hpp" | #include "../mwworld/containerstore.hpp" | ||||||
| 
 | 
 | ||||||
| #include "inventorywindow.hpp" |  | ||||||
| 
 |  | ||||||
| namespace MWGui | namespace MWGui | ||||||
| { | { | ||||||
| 
 | 
 | ||||||
|  | @ -36,7 +33,9 @@ void MerchantRepair::startRepair(const MWWorld::Ptr &actor) | ||||||
| 
 | 
 | ||||||
|     int currentY = 0; |     int currentY = 0; | ||||||
| 
 | 
 | ||||||
|     MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayer().getPlayer(); |     MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr(); | ||||||
|  |     int playerGold = player.getClass().getContainerStore(player).count(MWWorld::ContainerStore::sGoldId); | ||||||
|  | 
 | ||||||
|     MWWorld::ContainerStore& store = MWWorld::Class::get(player).getContainerStore(player); |     MWWorld::ContainerStore& store = MWWorld::Class::get(player).getContainerStore(player); | ||||||
|     int categories = MWWorld::ContainerStore::Type_Weapon | MWWorld::ContainerStore::Type_Armor; |     int categories = MWWorld::ContainerStore::Type_Weapon | MWWorld::ContainerStore::Type_Armor; | ||||||
|     for (MWWorld::ContainerStoreIterator iter (store.begin(categories)); |     for (MWWorld::ContainerStoreIterator iter (store.begin(categories)); | ||||||
|  | @ -69,8 +68,7 @@ void MerchantRepair::startRepair(const MWWorld::Ptr &actor) | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|             MyGUI::Button* button = |             MyGUI::Button* button = | ||||||
|                 mList->createWidget<MyGUI::Button>( |                 mList->createWidget<MyGUI::Button>("SandTextButton", | ||||||
|                     (price>MWBase::Environment::get().getWindowManager()->getInventoryWindow()->getPlayerGold()) ? "SandTextGreyedOut" : "SandTextButton", |  | ||||||
|                     0, |                     0, | ||||||
|                     currentY, |                     currentY, | ||||||
|                     0, |                     0, | ||||||
|  | @ -80,7 +78,7 @@ void MerchantRepair::startRepair(const MWWorld::Ptr &actor) | ||||||
| 
 | 
 | ||||||
|             currentY += 18; |             currentY += 18; | ||||||
| 
 | 
 | ||||||
|             button->setEnabled(price<=MWBase::Environment::get().getWindowManager()->getInventoryWindow()->getPlayerGold()); |             button->setEnabled(price<=playerGold); | ||||||
|             button->setUserString("Price", boost::lexical_cast<std::string>(price)); |             button->setUserString("Price", boost::lexical_cast<std::string>(price)); | ||||||
|             button->setUserData(*iter); |             button->setUserData(*iter); | ||||||
|             button->setCaptionWithReplacing(name); |             button->setCaptionWithReplacing(name); | ||||||
|  | @ -93,7 +91,7 @@ void MerchantRepair::startRepair(const MWWorld::Ptr &actor) | ||||||
|     mList->setCanvasSize (MyGUI::IntSize(mList->getWidth(), std::max(mList->getHeight(), currentY))); |     mList->setCanvasSize (MyGUI::IntSize(mList->getWidth(), std::max(mList->getHeight(), currentY))); | ||||||
| 
 | 
 | ||||||
|     mGoldLabel->setCaptionWithReplacing("#{sGold}: " |     mGoldLabel->setCaptionWithReplacing("#{sGold}: " | ||||||
|         + boost::lexical_cast<std::string>(MWBase::Environment::get().getWindowManager()->getInventoryWindow()->getPlayerGold())); |         + boost::lexical_cast<std::string>(playerGold)); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| void MerchantRepair::onMouseWheel(MyGUI::Widget* _sender, int _rel) | void MerchantRepair::onMouseWheel(MyGUI::Widget* _sender, int _rel) | ||||||
|  | @ -119,8 +117,8 @@ void MerchantRepair::onRepairButtonClick(MyGUI::Widget *sender) | ||||||
| 
 | 
 | ||||||
|     int price = boost::lexical_cast<int>(sender->getUserString("Price")); |     int price = boost::lexical_cast<int>(sender->getUserString("Price")); | ||||||
| 
 | 
 | ||||||
|     MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayer().getPlayer(); |     MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr(); | ||||||
|     player.getClass().getContainerStore(player).remove("gold_001", price, player); |     player.getClass().getContainerStore(player).remove(MWWorld::ContainerStore::sGoldId, price, player); | ||||||
| 
 | 
 | ||||||
|     startRepair(mActor); |     startRepair(mActor); | ||||||
| } | } | ||||||
|  |  | ||||||
|  | @ -10,6 +10,7 @@ namespace MWGui | ||||||
| 
 | 
 | ||||||
|     MessageBoxManager::MessageBoxManager () |     MessageBoxManager::MessageBoxManager () | ||||||
|     { |     { | ||||||
|  |         // TODO: fMessageTimePerChar
 | ||||||
|         mMessageBoxSpeed = 0.1; |         mMessageBoxSpeed = 0.1; | ||||||
|         mInterMessageBoxe = NULL; |         mInterMessageBoxe = NULL; | ||||||
|         mStaticMessageBox = NULL; |         mStaticMessageBox = NULL; | ||||||
|  |  | ||||||
|  | @ -2,7 +2,6 @@ | ||||||
| 
 | 
 | ||||||
| #include <boost/lexical_cast.hpp> | #include <boost/lexical_cast.hpp> | ||||||
| 
 | 
 | ||||||
| #include "../mwworld/player.hpp" |  | ||||||
| #include "../mwworld/inventorystore.hpp" | #include "../mwworld/inventorystore.hpp" | ||||||
| #include "../mwworld/actionequip.hpp" | #include "../mwworld/actionequip.hpp" | ||||||
| #include "../mwmechanics/spellcasting.hpp" | #include "../mwmechanics/spellcasting.hpp" | ||||||
|  | @ -126,7 +125,7 @@ namespace MWGui | ||||||
|             mItemSelectionDialog->eventDialogCanceled += MyGUI::newDelegate(this, &QuickKeysMenu::onAssignItemCancel); |             mItemSelectionDialog->eventDialogCanceled += MyGUI::newDelegate(this, &QuickKeysMenu::onAssignItemCancel); | ||||||
|         } |         } | ||||||
|         mItemSelectionDialog->setVisible(true); |         mItemSelectionDialog->setVisible(true); | ||||||
|         mItemSelectionDialog->openContainer(MWBase::Environment::get().getWorld()->getPlayer().getPlayer()); |         mItemSelectionDialog->openContainer(MWBase::Environment::get().getWorld()->getPlayerPtr()); | ||||||
| 
 | 
 | ||||||
|         mAssignDialog->setVisible (false); |         mAssignDialog->setVisible (false); | ||||||
|     } |     } | ||||||
|  | @ -267,7 +266,7 @@ namespace MWGui | ||||||
| 
 | 
 | ||||||
|         QuickKeyType type = *button->getUserData<QuickKeyType>(); |         QuickKeyType type = *button->getUserData<QuickKeyType>(); | ||||||
| 
 | 
 | ||||||
|         MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayer().getPlayer(); |         MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr(); | ||||||
|         MWWorld::InventoryStore& store = MWWorld::Class::get(player).getInventoryStore(player); |         MWWorld::InventoryStore& store = MWWorld::Class::get(player).getInventoryStore(player); | ||||||
| 
 | 
 | ||||||
|         if (type == Type_Item || type == Type_MagicItem) |         if (type == Type_Item || type == Type_MagicItem) | ||||||
|  | @ -311,7 +310,7 @@ namespace MWGui | ||||||
| 
 | 
 | ||||||
|             boost::shared_ptr<MWWorld::Action> action = MWWorld::Class::get(item).use(item); |             boost::shared_ptr<MWWorld::Action> action = MWWorld::Class::get(item).use(item); | ||||||
| 
 | 
 | ||||||
|             action->execute (MWBase::Environment::get().getWorld()->getPlayer().getPlayer()); |             action->execute (MWBase::Environment::get().getWorld()->getPlayerPtr()); | ||||||
| 
 | 
 | ||||||
|             // this is necessary for books/scrolls: if they are already in the player's inventory,
 |             // this is necessary for books/scrolls: if they are already in the player's inventory,
 | ||||||
|             // the "Take" button should not be visible.
 |             // the "Take" button should not be visible.
 | ||||||
|  | @ -344,7 +343,7 @@ namespace MWGui | ||||||
|                 // Note: can't use Class::use here because enchanted scrolls for example would then open the scroll window instead of equipping
 |                 // Note: can't use Class::use here because enchanted scrolls for example would then open the scroll window instead of equipping
 | ||||||
| 
 | 
 | ||||||
|                 MWWorld::ActionEquip action(item); |                 MWWorld::ActionEquip action(item); | ||||||
|                 action.execute (MWBase::Environment::get().getWorld ()->getPlayer ().getPlayer ()); |                 action.execute (MWBase::Environment::get().getWorld ()->getPlayerPtr()); | ||||||
|             } |             } | ||||||
| 
 | 
 | ||||||
|             store.setSelectedEnchantItem(it); |             store.setSelectedEnchantItem(it); | ||||||
|  | @ -430,7 +429,7 @@ namespace MWGui | ||||||
| 
 | 
 | ||||||
|         const int spellHeight = 18; |         const int spellHeight = 18; | ||||||
| 
 | 
 | ||||||
|         MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayer().getPlayer(); |         MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr(); | ||||||
|         MWWorld::InventoryStore& store = MWWorld::Class::get(player).getInventoryStore(player); |         MWWorld::InventoryStore& store = MWWorld::Class::get(player).getInventoryStore(player); | ||||||
|         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(); | ||||||
|  |  | ||||||
|  | @ -7,7 +7,6 @@ | ||||||
| #include "../mwbase/environment.hpp" | #include "../mwbase/environment.hpp" | ||||||
| #include "../mwbase/windowmanager.hpp" | #include "../mwbase/windowmanager.hpp" | ||||||
| 
 | 
 | ||||||
| #include "../mwworld/player.hpp" |  | ||||||
| #include "../mwworld/containerstore.hpp" | #include "../mwworld/containerstore.hpp" | ||||||
| #include "../mwworld/class.hpp" | #include "../mwworld/class.hpp" | ||||||
| 
 | 
 | ||||||
|  | @ -85,7 +84,7 @@ void Recharge::updateView() | ||||||
| 
 | 
 | ||||||
|     int currentY = 0; |     int currentY = 0; | ||||||
| 
 | 
 | ||||||
|     MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayer().getPlayer(); |     MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr(); | ||||||
|     MWWorld::ContainerStore& store = MWWorld::Class::get(player).getContainerStore(player); |     MWWorld::ContainerStore& store = MWWorld::Class::get(player).getContainerStore(player); | ||||||
|     for (MWWorld::ContainerStoreIterator iter (store.begin()); |     for (MWWorld::ContainerStoreIterator iter (store.begin()); | ||||||
|          iter!=store.end(); ++iter) |          iter!=store.end(); ++iter) | ||||||
|  | @ -141,7 +140,7 @@ void Recharge::onItemClicked(MyGUI::Widget *sender) | ||||||
| 
 | 
 | ||||||
|     MWWorld::Ptr item = *sender->getUserData<MWWorld::Ptr>(); |     MWWorld::Ptr item = *sender->getUserData<MWWorld::Ptr>(); | ||||||
| 
 | 
 | ||||||
|     MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayer().getPlayer(); |     MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr(); | ||||||
|     MWMechanics::CreatureStats& stats = player.getClass().getCreatureStats(player); |     MWMechanics::CreatureStats& stats = player.getClass().getCreatureStats(player); | ||||||
|     MWMechanics::NpcStats& npcStats = player.getClass().getNpcStats(player); |     MWMechanics::NpcStats& npcStats = player.getClass().getNpcStats(player); | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -3,8 +3,6 @@ | ||||||
| #include "../mwbase/world.hpp" | #include "../mwbase/world.hpp" | ||||||
| #include "../mwbase/environment.hpp" | #include "../mwbase/environment.hpp" | ||||||
| 
 | 
 | ||||||
| #include "../mwworld/player.hpp" |  | ||||||
| 
 |  | ||||||
| namespace MWGui | namespace MWGui | ||||||
| { | { | ||||||
|     ReferenceInterface::ReferenceInterface() |     ReferenceInterface::ReferenceInterface() | ||||||
|  | @ -18,7 +16,7 @@ namespace MWGui | ||||||
| 
 | 
 | ||||||
|     void ReferenceInterface::checkReferenceAvailable() |     void ReferenceInterface::checkReferenceAvailable() | ||||||
|     { |     { | ||||||
|         MWWorld::Ptr::CellStore* playerCell = MWBase::Environment::get().getWorld()->getPlayer().getPlayer().getCell(); |         MWWorld::Ptr::CellStore* playerCell = MWBase::Environment::get().getWorld()->getPlayerPtr().getCell(); | ||||||
| 
 | 
 | ||||||
|         // check if player has changed cell, or count of the reference has become 0
 |         // check if player has changed cell, or count of the reference has become 0
 | ||||||
|         if ((playerCell != mCurrentPlayerCell && mCurrentPlayerCell != NULL) |         if ((playerCell != mCurrentPlayerCell && mCurrentPlayerCell != NULL) | ||||||
|  |  | ||||||
|  | @ -6,7 +6,6 @@ | ||||||
| #include "../mwbase/environment.hpp" | #include "../mwbase/environment.hpp" | ||||||
| #include "../mwbase/windowmanager.hpp" | #include "../mwbase/windowmanager.hpp" | ||||||
| 
 | 
 | ||||||
| #include "../mwworld/player.hpp" |  | ||||||
| #include "../mwworld/containerstore.hpp" | #include "../mwworld/containerstore.hpp" | ||||||
| #include "../mwworld/class.hpp" | #include "../mwworld/class.hpp" | ||||||
| 
 | 
 | ||||||
|  | @ -88,7 +87,7 @@ void Repair::updateRepairView() | ||||||
| 
 | 
 | ||||||
|     int currentY = 0; |     int currentY = 0; | ||||||
| 
 | 
 | ||||||
|     MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayer().getPlayer(); |     MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr(); | ||||||
|     MWWorld::ContainerStore& store = MWWorld::Class::get(player).getContainerStore(player); |     MWWorld::ContainerStore& store = MWWorld::Class::get(player).getContainerStore(player); | ||||||
|     int categories = MWWorld::ContainerStore::Type_Weapon | MWWorld::ContainerStore::Type_Armor; |     int categories = MWWorld::ContainerStore::Type_Weapon | MWWorld::ContainerStore::Type_Armor; | ||||||
|     for (MWWorld::ContainerStoreIterator iter (store.begin(categories)); |     for (MWWorld::ContainerStoreIterator iter (store.begin(categories)); | ||||||
|  |  | ||||||
|  | @ -6,7 +6,6 @@ | ||||||
| #include "../mwbase/windowmanager.hpp" | #include "../mwbase/windowmanager.hpp" | ||||||
| 
 | 
 | ||||||
| #include "../mwworld/actiontake.hpp" | #include "../mwworld/actiontake.hpp" | ||||||
| #include "../mwworld/player.hpp" |  | ||||||
| 
 | 
 | ||||||
| #include "formatting.hpp" | #include "formatting.hpp" | ||||||
| 
 | 
 | ||||||
|  | @ -90,7 +89,7 @@ namespace MWGui | ||||||
|         MWBase::Environment::get().getSoundManager()->playSound("Item Book Up", 1.0, 1.0); |         MWBase::Environment::get().getSoundManager()->playSound("Item Book Up", 1.0, 1.0); | ||||||
| 
 | 
 | ||||||
|         MWWorld::ActionTake take(mScroll); |         MWWorld::ActionTake take(mScroll); | ||||||
|         take.execute (MWBase::Environment::get().getWorld()->getPlayer().getPlayer()); |         take.execute (MWBase::Environment::get().getWorld()->getPlayerPtr()); | ||||||
| 
 | 
 | ||||||
|         MWBase::Environment::get().getWindowManager()->removeGuiMode(GM_Scroll); |         MWBase::Environment::get().getWindowManager()->removeGuiMode(GM_Scroll); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|  | @ -8,14 +8,11 @@ | ||||||
| #include "../mwbase/windowmanager.hpp" | #include "../mwbase/windowmanager.hpp" | ||||||
| #include "../mwbase/mechanicsmanager.hpp" | #include "../mwbase/mechanicsmanager.hpp" | ||||||
| 
 | 
 | ||||||
| #include "../mwworld/player.hpp" |  | ||||||
| #include "../mwworld/class.hpp" | #include "../mwworld/class.hpp" | ||||||
| #include "../mwworld/containerstore.hpp" | #include "../mwworld/containerstore.hpp" | ||||||
| 
 | 
 | ||||||
| #include "../mwmechanics/creaturestats.hpp" | #include "../mwmechanics/creaturestats.hpp" | ||||||
| 
 | 
 | ||||||
| #include "inventorywindow.hpp" |  | ||||||
| 
 |  | ||||||
| namespace MWGui | namespace MWGui | ||||||
| { | { | ||||||
|     const int SpellBuyingWindow::sLineHeight = 18; |     const int SpellBuyingWindow::sLineHeight = 18; | ||||||
|  | @ -43,15 +40,19 @@ namespace MWGui | ||||||
|         int price = spell->mData.mCost*store.get<ESM::GameSetting>().find("fSpellValueMult")->getFloat(); |         int price = spell->mData.mCost*store.get<ESM::GameSetting>().find("fSpellValueMult")->getFloat(); | ||||||
|         price = MWBase::Environment::get().getMechanicsManager()->getBarterOffer(mPtr,price,true); |         price = MWBase::Environment::get().getMechanicsManager()->getBarterOffer(mPtr,price,true); | ||||||
| 
 | 
 | ||||||
|  |         MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr(); | ||||||
|  |         int playerGold = player.getClass().getContainerStore(player).count(MWWorld::ContainerStore::sGoldId); | ||||||
|  | 
 | ||||||
|         MyGUI::Button* toAdd = |         MyGUI::Button* toAdd = | ||||||
|             mSpellsView->createWidget<MyGUI::Button>( |             mSpellsView->createWidget<MyGUI::Button>( | ||||||
|                 (price>MWBase::Environment::get().getWindowManager()->getInventoryWindow()->getPlayerGold()) ? "SandTextGreyedOut" : "SandTextButton", |                 "SandTextButton", | ||||||
|                 0, |                 0, | ||||||
|                 mCurrentY, |                 mCurrentY, | ||||||
|                 200, |                 200, | ||||||
|                 sLineHeight, |                 sLineHeight, | ||||||
|                 MyGUI::Align::Default |                 MyGUI::Align::Default | ||||||
|             ); |             ); | ||||||
|  |         toAdd->setEnabled(price<=playerGold); | ||||||
| 
 | 
 | ||||||
|         mCurrentY += sLineHeight; |         mCurrentY += sLineHeight; | ||||||
| 
 | 
 | ||||||
|  | @ -103,7 +104,7 @@ namespace MWGui | ||||||
| 
 | 
 | ||||||
|     bool SpellBuyingWindow::playerHasSpell(const std::string &id) |     bool SpellBuyingWindow::playerHasSpell(const std::string &id) | ||||||
|     { |     { | ||||||
|         MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayer().getPlayer(); |         MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr(); | ||||||
|         MWMechanics::Spells& playerSpells = MWWorld::Class::get (player).getCreatureStats (player).getSpells(); |         MWMechanics::Spells& playerSpells = MWWorld::Class::get (player).getCreatureStats (player).getSpells(); | ||||||
|         for (MWMechanics::Spells::TIterator it = playerSpells.begin(); it != playerSpells.end(); ++it) |         for (MWMechanics::Spells::TIterator it = playerSpells.begin(); it != playerSpells.end(); ++it) | ||||||
|         { |         { | ||||||
|  | @ -117,17 +118,14 @@ namespace MWGui | ||||||
|     { |     { | ||||||
|         int price = *_sender->getUserData<int>(); |         int price = *_sender->getUserData<int>(); | ||||||
| 
 | 
 | ||||||
|         if (MWBase::Environment::get().getWindowManager()->getInventoryWindow()->getPlayerGold()>=price) |         MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr(); | ||||||
|         { |         MWMechanics::CreatureStats& stats = MWWorld::Class::get(player).getCreatureStats(player); | ||||||
|             MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayer().getPlayer(); |         MWMechanics::Spells& spells = stats.getSpells(); | ||||||
|             MWMechanics::CreatureStats& stats = MWWorld::Class::get(player).getCreatureStats(player); |         spells.add (mSpellsWidgetMap.find(_sender)->second); | ||||||
|             MWMechanics::Spells& spells = stats.getSpells(); |         player.getClass().getContainerStore(player).remove(MWWorld::ContainerStore::sGoldId, price, player); | ||||||
|             spells.add (mSpellsWidgetMap.find(_sender)->second); |         startSpellBuying(mPtr); | ||||||
|             player.getClass().getContainerStore(player).remove("gold_001", price, player); |  | ||||||
|             startSpellBuying(mPtr); |  | ||||||
| 
 | 
 | ||||||
|             MWBase::Environment::get().getSoundManager()->playSound ("Item Gold Up", 1.0, 1.0); |         MWBase::Environment::get().getSoundManager()->playSound ("Item Gold Up", 1.0, 1.0); | ||||||
|         } |  | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     void SpellBuyingWindow::onCancelButtonClicked(MyGUI::Widget* _sender) |     void SpellBuyingWindow::onCancelButtonClicked(MyGUI::Widget* _sender) | ||||||
|  | @ -137,7 +135,10 @@ namespace MWGui | ||||||
| 
 | 
 | ||||||
|     void SpellBuyingWindow::updateLabels() |     void SpellBuyingWindow::updateLabels() | ||||||
|     { |     { | ||||||
|         mPlayerGold->setCaptionWithReplacing("#{sGold}: " + boost::lexical_cast<std::string>(MWBase::Environment::get().getWindowManager()->getInventoryWindow()->getPlayerGold())); |         MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr(); | ||||||
|  |         int playerGold = player.getClass().getContainerStore(player).count(MWWorld::ContainerStore::sGoldId); | ||||||
|  | 
 | ||||||
|  |         mPlayerGold->setCaptionWithReplacing("#{sGold}: " + boost::lexical_cast<std::string>(playerGold)); | ||||||
|         mPlayerGold->setCoord(8, |         mPlayerGold->setCoord(8, | ||||||
|                               mPlayerGold->getTop(), |                               mPlayerGold->getTop(), | ||||||
|                               mPlayerGold->getTextSize().width, |                               mPlayerGold->getTextSize().width, | ||||||
|  |  | ||||||
|  | @ -7,14 +7,12 @@ | ||||||
| #include "../mwbase/soundmanager.hpp" | #include "../mwbase/soundmanager.hpp" | ||||||
| #include "../mwbase/mechanicsmanager.hpp" | #include "../mwbase/mechanicsmanager.hpp" | ||||||
| 
 | 
 | ||||||
| #include "../mwworld/player.hpp" |  | ||||||
| #include "../mwworld/containerstore.hpp" | #include "../mwworld/containerstore.hpp" | ||||||
| 
 | 
 | ||||||
| #include "../mwmechanics/spellcasting.hpp" | #include "../mwmechanics/spellcasting.hpp" | ||||||
| 
 | 
 | ||||||
| #include "tooltips.hpp" | #include "tooltips.hpp" | ||||||
| #include "class.hpp" | #include "class.hpp" | ||||||
| #include "inventorywindow.hpp" |  | ||||||
| 
 | 
 | ||||||
| namespace | namespace | ||||||
| { | { | ||||||
|  | @ -334,7 +332,10 @@ namespace MWGui | ||||||
|             return; |             return; | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|         if (boost::lexical_cast<int>(mPriceLabel->getCaption()) > MWBase::Environment::get().getWindowManager()->getInventoryWindow()->getPlayerGold()) |         MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr(); | ||||||
|  |         int playerGold = player.getClass().getContainerStore(player).count(MWWorld::ContainerStore::sGoldId); | ||||||
|  | 
 | ||||||
|  |         if (boost::lexical_cast<int>(mPriceLabel->getCaption()) > playerGold) | ||||||
|         { |         { | ||||||
|             MWBase::Environment::get().getWindowManager()->messageBox ("#{sNotifyMessage18}"); |             MWBase::Environment::get().getWindowManager()->messageBox ("#{sNotifyMessage18}"); | ||||||
|             return; |             return; | ||||||
|  | @ -342,9 +343,7 @@ namespace MWGui | ||||||
| 
 | 
 | ||||||
|         mSpell.mName = mNameEdit->getCaption(); |         mSpell.mName = mNameEdit->getCaption(); | ||||||
| 
 | 
 | ||||||
|         MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayer().getPlayer(); |         player.getClass().getContainerStore(player).remove(MWWorld::ContainerStore::sGoldId, boost::lexical_cast<int>(mPriceLabel->getCaption()), player); | ||||||
| 
 |  | ||||||
|         player.getClass().getContainerStore(player).remove("gold_001", boost::lexical_cast<int>(mPriceLabel->getCaption()), player); |  | ||||||
| 
 | 
 | ||||||
|         MWBase::Environment::get().getSoundManager()->playSound ("Item Gold Up", 1.0, 1.0); |         MWBase::Environment::get().getSoundManager()->playSound ("Item Gold Up", 1.0, 1.0); | ||||||
| 
 | 
 | ||||||
|  | @ -414,7 +413,7 @@ namespace MWGui | ||||||
| 
 | 
 | ||||||
|         mPriceLabel->setCaption(boost::lexical_cast<std::string>(int(price))); |         mPriceLabel->setCaption(boost::lexical_cast<std::string>(int(price))); | ||||||
| 
 | 
 | ||||||
|         float chance = MWMechanics::getSpellSuccessChance(&mSpell, MWBase::Environment::get().getWorld()->getPlayer().getPlayer()); |         float chance = MWMechanics::getSpellSuccessChance(&mSpell, MWBase::Environment::get().getWorld()->getPlayerPtr()); | ||||||
|         mSuccessChance->setCaption(boost::lexical_cast<std::string>(int(chance))); |         mSuccessChance->setCaption(boost::lexical_cast<std::string>(int(chance))); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  | @ -441,7 +440,7 @@ namespace MWGui | ||||||
|     { |     { | ||||||
|         // get the list of magic effects that are known to the player
 |         // get the list of magic effects that are known to the player
 | ||||||
| 
 | 
 | ||||||
|         MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayer().getPlayer(); |         MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr(); | ||||||
|         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(); | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -9,7 +9,6 @@ | ||||||
| #include "../mwbase/environment.hpp" | #include "../mwbase/environment.hpp" | ||||||
| #include "../mwbase/windowmanager.hpp" | #include "../mwbase/windowmanager.hpp" | ||||||
| 
 | 
 | ||||||
| #include "../mwworld/player.hpp" |  | ||||||
| #include "../mwworld/class.hpp" | #include "../mwworld/class.hpp" | ||||||
| #include "../mwworld/inventorystore.hpp" | #include "../mwworld/inventorystore.hpp" | ||||||
| 
 | 
 | ||||||
|  | @ -40,7 +39,7 @@ namespace MWGui | ||||||
|     { |     { | ||||||
|         // TODO: Tracking add/remove/expire would be better than force updating every frame
 |         // TODO: Tracking add/remove/expire would be better than force updating every frame
 | ||||||
| 
 | 
 | ||||||
|         MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayer().getPlayer(); |         MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr(); | ||||||
|         const MWMechanics::CreatureStats& stats = MWWorld::Class::get(player).getCreatureStats(player); |         const MWMechanics::CreatureStats& stats = MWWorld::Class::get(player).getCreatureStats(player); | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -5,7 +5,6 @@ | ||||||
| 
 | 
 | ||||||
| #include "../mwbase/windowmanager.hpp" | #include "../mwbase/windowmanager.hpp" | ||||||
| 
 | 
 | ||||||
| #include "../mwworld/player.hpp" |  | ||||||
| #include "../mwworld/inventorystore.hpp" | #include "../mwworld/inventorystore.hpp" | ||||||
| #include "../mwworld/actionequip.hpp" | #include "../mwworld/actionequip.hpp" | ||||||
| 
 | 
 | ||||||
|  | @ -81,7 +80,7 @@ namespace MWGui | ||||||
| 
 | 
 | ||||||
|         // retrieve all player spells, divide them into Powers and Spells and sort them
 |         // retrieve all player spells, divide them into Powers and Spells and sort them
 | ||||||
|         std::vector<std::string> spellList; |         std::vector<std::string> spellList; | ||||||
|         MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayer().getPlayer(); |         MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr(); | ||||||
|         MWWorld::InventoryStore& store = MWWorld::Class::get(player).getInventoryStore(player); |         MWWorld::InventoryStore& store = MWWorld::Class::get(player).getInventoryStore(player); | ||||||
|         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(); | ||||||
|  | @ -298,7 +297,7 @@ namespace MWGui | ||||||
| 
 | 
 | ||||||
|     void SpellWindow::onEnchantedItemSelected(MyGUI::Widget* _sender) |     void SpellWindow::onEnchantedItemSelected(MyGUI::Widget* _sender) | ||||||
|     { |     { | ||||||
|         MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayer().getPlayer(); |         MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr(); | ||||||
|         MWWorld::InventoryStore& store = MWWorld::Class::get(player).getInventoryStore(player); |         MWWorld::InventoryStore& store = MWWorld::Class::get(player).getInventoryStore(player); | ||||||
|         MWWorld::Ptr item = *_sender->getUserData<MWWorld::Ptr>(); |         MWWorld::Ptr item = *_sender->getUserData<MWWorld::Ptr>(); | ||||||
| 
 | 
 | ||||||
|  | @ -320,7 +319,7 @@ namespace MWGui | ||||||
|             // Note: can't use Class::use here because enchanted scrolls for example would then open the scroll window instead of equipping
 |             // Note: can't use Class::use here because enchanted scrolls for example would then open the scroll window instead of equipping
 | ||||||
| 
 | 
 | ||||||
|             MWWorld::ActionEquip action(item); |             MWWorld::ActionEquip action(item); | ||||||
|             action.execute (MWBase::Environment::get().getWorld ()->getPlayer ().getPlayer ()); |             action.execute (MWBase::Environment::get().getWorld ()->getPlayerPtr()); | ||||||
| 
 | 
 | ||||||
|             // since we changed equipping status, update the inventory window
 |             // since we changed equipping status, update the inventory window
 | ||||||
|             MWBase::Environment::get().getWindowManager()->getInventoryWindow()->updateItemView(); |             MWBase::Environment::get().getWindowManager()->getInventoryWindow()->updateItemView(); | ||||||
|  | @ -335,7 +334,7 @@ namespace MWGui | ||||||
|     void SpellWindow::onSpellSelected(MyGUI::Widget* _sender) |     void SpellWindow::onSpellSelected(MyGUI::Widget* _sender) | ||||||
|     { |     { | ||||||
|         std::string spellId = _sender->getUserString("Spell"); |         std::string spellId = _sender->getUserString("Spell"); | ||||||
|         MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayer().getPlayer(); |         MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr(); | ||||||
|         MWWorld::InventoryStore& store = MWWorld::Class::get(player).getInventoryStore(player); |         MWWorld::InventoryStore& store = MWWorld::Class::get(player).getInventoryStore(player); | ||||||
| 
 | 
 | ||||||
|         if (MyGUI::InputManager::getInstance().isShiftPressed()) |         if (MyGUI::InputManager::getInstance().isShiftPressed()) | ||||||
|  | @ -389,7 +388,7 @@ namespace MWGui | ||||||
| 
 | 
 | ||||||
|     void SpellWindow::onDeleteSpellAccept() |     void SpellWindow::onDeleteSpellAccept() | ||||||
|     { |     { | ||||||
|         MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayer().getPlayer(); |         MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr(); | ||||||
|         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(); | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -6,8 +6,8 @@ | ||||||
| #include "../mwbase/world.hpp" | #include "../mwbase/world.hpp" | ||||||
| #include "../mwbase/windowmanager.hpp" | #include "../mwbase/windowmanager.hpp" | ||||||
| 
 | 
 | ||||||
| #include "../mwworld/player.hpp" |  | ||||||
| #include "../mwworld/class.hpp" | #include "../mwworld/class.hpp" | ||||||
|  | #include "../mwworld/player.hpp" | ||||||
| 
 | 
 | ||||||
| #include "../mwmechanics/npcstats.hpp" | #include "../mwmechanics/npcstats.hpp" | ||||||
| 
 | 
 | ||||||
|  | @ -224,7 +224,7 @@ namespace MWGui | ||||||
|         if (!mMainWidget->getVisible()) |         if (!mMainWidget->getVisible()) | ||||||
|             return; |             return; | ||||||
| 
 | 
 | ||||||
|         MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayer().getPlayer(); |         MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr(); | ||||||
|         const MWMechanics::NpcStats &PCstats = MWWorld::Class::get(player).getNpcStats(player); |         const MWMechanics::NpcStats &PCstats = MWWorld::Class::get(player).getNpcStats(player); | ||||||
| 
 | 
 | ||||||
|         // level progress
 |         // level progress
 | ||||||
|  | @ -424,7 +424,7 @@ namespace MWGui | ||||||
|         MWBase::World *world = MWBase::Environment::get().getWorld(); |         MWBase::World *world = MWBase::Environment::get().getWorld(); | ||||||
|         const MWWorld::ESMStore &store = world->getStore(); |         const MWWorld::ESMStore &store = world->getStore(); | ||||||
|         const ESM::NPC *player = |         const ESM::NPC *player = | ||||||
|             world->getPlayer().getPlayer().get<ESM::NPC>()->mBase; |             world->getPlayerPtr().get<ESM::NPC>()->mBase; | ||||||
| 
 | 
 | ||||||
|         // race tooltip
 |         // race tooltip
 | ||||||
|         const ESM::Race* playerRace = store.get<ESM::Race>().find(player->mRace); |         const ESM::Race* playerRace = store.get<ESM::Race>().find(player->mRace); | ||||||
|  | @ -452,7 +452,7 @@ namespace MWGui | ||||||
|             if (!mSkillWidgets.empty()) |             if (!mSkillWidgets.empty()) | ||||||
|                 addSeparator(coord1, coord2); |                 addSeparator(coord1, coord2); | ||||||
| 
 | 
 | ||||||
|             MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayer().getPlayer(); |             MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr(); | ||||||
|             const MWMechanics::NpcStats &PCstats = MWWorld::Class::get(player).getNpcStats(player); |             const MWMechanics::NpcStats &PCstats = MWWorld::Class::get(player).getNpcStats(player); | ||||||
|             const std::set<std::string> &expelled = PCstats.getExpelled(); |             const std::set<std::string> &expelled = PCstats.getExpelled(); | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -149,7 +149,7 @@ namespace MWGui | ||||||
|             if(!mMerchant.isEmpty()) |             if(!mMerchant.isEmpty()) | ||||||
|             { |             { | ||||||
|                 MWWorld::Ptr base = item.mBase; |                 MWWorld::Ptr base = item.mBase; | ||||||
|                 if(Misc::StringUtils::ciEqual(base.getCellRef().mRefID, "gold_001")) |                 if(Misc::StringUtils::ciEqual(base.getCellRef().mRefID, MWWorld::ContainerStore::sGoldId)) | ||||||
|                     continue; |                     continue; | ||||||
|                 if(!MWWorld::Class::get(base).canSell(base, services)) |                 if(!MWWorld::Class::get(base).canSell(base, services)) | ||||||
|                     continue; |                     continue; | ||||||
|  |  | ||||||
|  | @ -16,8 +16,6 @@ | ||||||
| #include "../mwmechanics/creaturestats.hpp" | #include "../mwmechanics/creaturestats.hpp" | ||||||
| #include "../mwmechanics/npcstats.hpp" | #include "../mwmechanics/npcstats.hpp" | ||||||
| 
 | 
 | ||||||
| #include "../mwworld/player.hpp" |  | ||||||
| 
 |  | ||||||
| #include "inventorywindow.hpp" | #include "inventorywindow.hpp" | ||||||
| #include "itemview.hpp" | #include "itemview.hpp" | ||||||
| #include "sortfilteritemmodel.hpp" | #include "sortfilteritemmodel.hpp" | ||||||
|  | @ -212,11 +210,11 @@ namespace MWGui | ||||||
| 
 | 
 | ||||||
|         if (amount > 0) |         if (amount > 0) | ||||||
|         { |         { | ||||||
|             store.add("gold_001", amount, actor); |             store.add(MWWorld::ContainerStore::sGoldId, amount, actor); | ||||||
|         } |         } | ||||||
|         else |         else | ||||||
|         { |         { | ||||||
|             store.remove("gold_001", - amount, actor); |             store.remove(MWWorld::ContainerStore::sGoldId, - amount, actor); | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  | @ -253,8 +251,11 @@ namespace MWGui | ||||||
|             return; |             return; | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|  |         MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr(); | ||||||
|  |         int playerGold = player.getClass().getContainerStore(player).count(MWWorld::ContainerStore::sGoldId); | ||||||
|  | 
 | ||||||
|         // check if the player can afford this
 |         // check if the player can afford this
 | ||||||
|         if (mCurrentBalance < 0 && MWBase::Environment::get().getWindowManager()->getInventoryWindow()->getPlayerGold() < std::abs(mCurrentBalance)) |         if (mCurrentBalance < 0 && playerGold < std::abs(mCurrentBalance)) | ||||||
|         { |         { | ||||||
|             // user notification
 |             // user notification
 | ||||||
|             MWBase::Environment::get().getWindowManager()-> |             MWBase::Environment::get().getWindowManager()-> | ||||||
|  | @ -271,8 +272,6 @@ namespace MWGui | ||||||
|             return; |             return; | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|         MWWorld::Ptr playerPtr = MWBase::Environment::get().getWorld()->getPlayer().getPlayer(); |  | ||||||
| 
 |  | ||||||
|         if(mCurrentBalance > mCurrentMerchantOffer) |         if(mCurrentBalance > mCurrentMerchantOffer) | ||||||
|         { |         { | ||||||
|             //if npc is a creature: reject (no haggle)
 |             //if npc is a creature: reject (no haggle)
 | ||||||
|  | @ -294,8 +293,8 @@ namespace MWGui | ||||||
|             float clampedDisposition = std::max<int>(0,std::min<int>(int(MWBase::Environment::get().getMechanicsManager()->getDerivedDisposition(mPtr) |             float clampedDisposition = std::max<int>(0,std::min<int>(int(MWBase::Environment::get().getMechanicsManager()->getDerivedDisposition(mPtr) | ||||||
|                 + MWBase::Environment::get().getDialogueManager()->getTemporaryDispositionChange()),100)); |                 + MWBase::Environment::get().getDialogueManager()->getTemporaryDispositionChange()),100)); | ||||||
| 
 | 
 | ||||||
|             const MWMechanics::NpcStats &sellerStats = MWWorld::Class::get(mPtr).getNpcStats(mPtr); |             const MWMechanics::NpcStats &sellerStats = mPtr.getClass().getNpcStats(mPtr); | ||||||
|             const MWMechanics::NpcStats &playerStats = MWWorld::Class::get(playerPtr).getNpcStats(playerPtr); |             const MWMechanics::NpcStats &playerStats = player.getClass().getNpcStats(player); | ||||||
| 
 | 
 | ||||||
|             float a1 = std::min(playerStats.getSkill(ESM::Skill::Mercantile).getModified(), 100); |             float a1 = std::min(playerStats.getSkill(ESM::Skill::Mercantile).getModified(), 100); | ||||||
|             float b1 = std::min(0.1f * playerStats.getAttribute(ESM::Attribute::Luck).getModified(), 10.f); |             float b1 = std::min(0.1f * playerStats.getAttribute(ESM::Attribute::Luck).getModified(), 10.f); | ||||||
|  | @ -324,7 +323,7 @@ namespace MWGui | ||||||
|             } |             } | ||||||
| 
 | 
 | ||||||
|             //skill use!
 |             //skill use!
 | ||||||
|             MWWorld::Class::get(playerPtr).skillUsageSucceeded(playerPtr, ESM::Skill::Mercantile, 0); |             player.getClass().skillUsageSucceeded(player, ESM::Skill::Mercantile, 0); | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|         int iBarterSuccessDisposition = gmst.find("iBarterSuccessDisposition")->getInt(); |         int iBarterSuccessDisposition = gmst.find("iBarterSuccessDisposition")->getInt(); | ||||||
|  | @ -337,7 +336,7 @@ namespace MWGui | ||||||
|         // transfer the gold
 |         // transfer the gold
 | ||||||
|         if (mCurrentBalance != 0) |         if (mCurrentBalance != 0) | ||||||
|         { |         { | ||||||
|             addOrRemoveGold(mCurrentBalance, playerPtr); |             addOrRemoveGold(mCurrentBalance, player); | ||||||
|             addOrRemoveGold(-mCurrentBalance, mPtr); |             addOrRemoveGold(-mCurrentBalance, mPtr); | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|  | @ -398,7 +397,10 @@ namespace MWGui | ||||||
| 
 | 
 | ||||||
|     void TradeWindow::updateLabels() |     void TradeWindow::updateLabels() | ||||||
|     { |     { | ||||||
|         mPlayerGold->setCaptionWithReplacing("#{sYourGold} " + boost::lexical_cast<std::string>(MWBase::Environment::get().getWindowManager()->getInventoryWindow()->getPlayerGold())); |         MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr(); | ||||||
|  |         int playerGold = player.getClass().getContainerStore(player).count(MWWorld::ContainerStore::sGoldId); | ||||||
|  | 
 | ||||||
|  |         mPlayerGold->setCaptionWithReplacing("#{sYourGold} " + boost::lexical_cast<std::string>(playerGold)); | ||||||
| 
 | 
 | ||||||
|         if (mCurrentBalance > 0) |         if (mCurrentBalance > 0) | ||||||
|         { |         { | ||||||
|  | @ -447,7 +449,7 @@ namespace MWGui | ||||||
|         MWWorld::ContainerStore store = mPtr.getClass().getContainerStore(mPtr); |         MWWorld::ContainerStore store = mPtr.getClass().getContainerStore(mPtr); | ||||||
|         for (MWWorld::ContainerStoreIterator it = store.begin(); it != store.end(); ++it) |         for (MWWorld::ContainerStoreIterator it = store.begin(); it != store.end(); ++it) | ||||||
|         { |         { | ||||||
|             if (Misc::StringUtils::ciEqual(it->getCellRef().mRefID, "gold_001")) |             if (Misc::StringUtils::ciEqual(it->getCellRef().mRefID, MWWorld::ContainerStore::sGoldId)) | ||||||
|                 merchantGold += it->getRefData().getCount(); |                 merchantGold += it->getRefData().getCount(); | ||||||
|         } |         } | ||||||
|         return merchantGold; |         return merchantGold; | ||||||
|  |  | ||||||
|  | @ -28,8 +28,6 @@ namespace MWGui | ||||||
| 
 | 
 | ||||||
|             void startTrade(const MWWorld::Ptr& actor); |             void startTrade(const MWWorld::Ptr& actor); | ||||||
| 
 | 
 | ||||||
|             void addOrRemoveGold(int gold, const MWWorld::Ptr& actor); |  | ||||||
| 
 |  | ||||||
|             void onFrame(float frameDuration); |             void onFrame(float frameDuration); | ||||||
| 
 | 
 | ||||||
|             void borrowItem (int index, size_t count); |             void borrowItem (int index, size_t count); | ||||||
|  | @ -95,6 +93,8 @@ namespace MWGui | ||||||
|             void onIncreaseButtonTriggered(); |             void onIncreaseButtonTriggered(); | ||||||
|             void onDecreaseButtonTriggered(); |             void onDecreaseButtonTriggered(); | ||||||
| 
 | 
 | ||||||
|  |             void addOrRemoveGold(int gold, const MWWorld::Ptr& actor); | ||||||
|  | 
 | ||||||
|             void updateLabels(); |             void updateLabels(); | ||||||
| 
 | 
 | ||||||
|             virtual void onReferenceUnavailable(); |             virtual void onReferenceUnavailable(); | ||||||
|  |  | ||||||
|  | @ -9,13 +9,11 @@ | ||||||
| #include "../mwbase/world.hpp" | #include "../mwbase/world.hpp" | ||||||
| #include "../mwbase/mechanicsmanager.hpp" | #include "../mwbase/mechanicsmanager.hpp" | ||||||
| 
 | 
 | ||||||
| #include "../mwworld/player.hpp" |  | ||||||
| #include "../mwworld/class.hpp" | #include "../mwworld/class.hpp" | ||||||
| #include "../mwworld/containerstore.hpp" | #include "../mwworld/containerstore.hpp" | ||||||
| 
 | 
 | ||||||
| #include "../mwmechanics/npcstats.hpp" | #include "../mwmechanics/npcstats.hpp" | ||||||
| 
 | 
 | ||||||
| #include "inventorywindow.hpp" |  | ||||||
| #include "tooltips.hpp" | #include "tooltips.hpp" | ||||||
| 
 | 
 | ||||||
| namespace MWGui | namespace MWGui | ||||||
|  | @ -41,7 +39,10 @@ namespace MWGui | ||||||
|     { |     { | ||||||
|         mPtr = actor; |         mPtr = actor; | ||||||
| 
 | 
 | ||||||
|         mPlayerGold->setCaptionWithReplacing("#{sGold}: " + boost::lexical_cast<std::string>(MWBase::Environment::get().getWindowManager()->getInventoryWindow()->getPlayerGold())); |         MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr(); | ||||||
|  |         int playerGold = player.getClass().getContainerStore(player).count(MWWorld::ContainerStore::sGoldId); | ||||||
|  | 
 | ||||||
|  |         mPlayerGold->setCaptionWithReplacing("#{sGold}: " + boost::lexical_cast<std::string>(playerGold)); | ||||||
| 
 | 
 | ||||||
|         MWMechanics::NpcStats& npcStats = MWWorld::Class::get(actor).getNpcStats (actor); |         MWMechanics::NpcStats& npcStats = MWWorld::Class::get(actor).getNpcStats (actor); | ||||||
| 
 | 
 | ||||||
|  | @ -72,7 +73,6 @@ namespace MWGui | ||||||
|         MyGUI::EnumeratorWidgetPtr widgets = mTrainingOptions->getEnumerator (); |         MyGUI::EnumeratorWidgetPtr widgets = mTrainingOptions->getEnumerator (); | ||||||
|         MyGUI::Gui::getInstance ().destroyWidgets (widgets); |         MyGUI::Gui::getInstance ().destroyWidgets (widgets); | ||||||
| 
 | 
 | ||||||
|         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 = |         const MWWorld::Store<ESM::GameSetting> &gmst = | ||||||
|  | @ -83,11 +83,10 @@ namespace MWGui | ||||||
|             int price = MWBase::Environment::get().getMechanicsManager()->getBarterOffer |             int price = MWBase::Environment::get().getMechanicsManager()->getBarterOffer | ||||||
|                     (mPtr,pcStats.getSkill (bestSkills[i].first).getBase() * gmst.find("iTrainingMod")->getInt (),true); |                     (mPtr,pcStats.getSkill (bestSkills[i].first).getBase() * gmst.find("iTrainingMod")->getInt (),true); | ||||||
| 
 | 
 | ||||||
|             std::string skin = (price > MWBase::Environment::get().getWindowManager()->getInventoryWindow ()->getPlayerGold ()) ? "SandTextGreyedOut" : "SandTextButton"; |             MyGUI::Button* button = mTrainingOptions->createWidget<MyGUI::Button>("SandTextButton", | ||||||
| 
 |  | ||||||
|             MyGUI::Button* button = mTrainingOptions->createWidget<MyGUI::Button>(skin, |  | ||||||
|                 MyGUI::IntCoord(5, 5+i*18, mTrainingOptions->getWidth()-10, 18), MyGUI::Align::Default); |                 MyGUI::IntCoord(5, 5+i*18, mTrainingOptions->getWidth()-10, 18), MyGUI::Align::Default); | ||||||
| 
 | 
 | ||||||
|  |             button->setEnabled(price <= playerGold); | ||||||
|             button->setUserData(bestSkills[i].first); |             button->setUserData(bestSkills[i].first); | ||||||
|             button->eventMouseButtonClick += MyGUI::newDelegate(this, &TrainingWindow::onTrainingSelected); |             button->eventMouseButtonClick += MyGUI::newDelegate(this, &TrainingWindow::onTrainingSelected); | ||||||
| 
 | 
 | ||||||
|  | @ -115,7 +114,7 @@ namespace MWGui | ||||||
|     { |     { | ||||||
|         int skillId = *sender->getUserData<int>(); |         int skillId = *sender->getUserData<int>(); | ||||||
| 
 | 
 | ||||||
|         MWWorld::Ptr player = MWBase::Environment::get().getWorld ()->getPlayer ().getPlayer (); |         MWWorld::Ptr player = MWBase::Environment::get().getWorld ()->getPlayerPtr(); | ||||||
|         MWMechanics::NpcStats& pcStats = MWWorld::Class::get(player).getNpcStats (player); |         MWMechanics::NpcStats& pcStats = MWWorld::Class::get(player).getNpcStats (player); | ||||||
| 
 | 
 | ||||||
|         const MWWorld::ESMStore &store = |         const MWWorld::ESMStore &store = | ||||||
|  | @ -124,9 +123,6 @@ namespace MWGui | ||||||
|         int price = pcStats.getSkill (skillId).getBase() * store.get<ESM::GameSetting>().find("iTrainingMod")->getInt (); |         int price = pcStats.getSkill (skillId).getBase() * store.get<ESM::GameSetting>().find("iTrainingMod")->getInt (); | ||||||
|         price = MWBase::Environment::get().getMechanicsManager()->getBarterOffer(mPtr,price,true); |         price = MWBase::Environment::get().getMechanicsManager()->getBarterOffer(mPtr,price,true); | ||||||
| 
 | 
 | ||||||
|         if (MWBase::Environment::get().getWindowManager()->getInventoryWindow()->getPlayerGold()<price) |  | ||||||
|             return; |  | ||||||
| 
 |  | ||||||
|         MWMechanics::NpcStats& npcStats = MWWorld::Class::get(mPtr).getNpcStats (mPtr); |         MWMechanics::NpcStats& npcStats = MWWorld::Class::get(mPtr).getNpcStats (mPtr); | ||||||
|         if (npcStats.getSkill (skillId).getBase () <= pcStats.getSkill (skillId).getBase ()) |         if (npcStats.getSkill (skillId).getBase () <= pcStats.getSkill (skillId).getBase ()) | ||||||
|         { |         { | ||||||
|  | @ -142,7 +138,7 @@ namespace MWGui | ||||||
|         pcStats.increaseSkill (skillId, *class_, true); |         pcStats.increaseSkill (skillId, *class_, true); | ||||||
| 
 | 
 | ||||||
|         // remove gold
 |         // remove gold
 | ||||||
|         player.getClass().getContainerStore(player).remove("gold_001", price, player); |         player.getClass().getContainerStore(player).remove(MWWorld::ContainerStore::sGoldId, price, player); | ||||||
| 
 | 
 | ||||||
|         // go back to game mode
 |         // go back to game mode
 | ||||||
|         MWBase::Environment::get().getWindowManager()->removeGuiMode (GM_Training); |         MWBase::Environment::get().getWindowManager()->removeGuiMode (GM_Training); | ||||||
|  |  | ||||||
|  | @ -2,6 +2,8 @@ | ||||||
| 
 | 
 | ||||||
| #include <boost/lexical_cast.hpp> | #include <boost/lexical_cast.hpp> | ||||||
| 
 | 
 | ||||||
|  | #include <OgreVector3.h> | ||||||
|  | 
 | ||||||
| #include <libs/openengine/ogre/fader.hpp> | #include <libs/openengine/ogre/fader.hpp> | ||||||
| 
 | 
 | ||||||
| #include "../mwbase/environment.hpp" | #include "../mwbase/environment.hpp" | ||||||
|  | @ -9,12 +11,9 @@ | ||||||
| #include "../mwbase/windowmanager.hpp" | #include "../mwbase/windowmanager.hpp" | ||||||
| #include "../mwbase/mechanicsmanager.hpp" | #include "../mwbase/mechanicsmanager.hpp" | ||||||
| 
 | 
 | ||||||
| #include "../mwworld/player.hpp" |  | ||||||
| #include "../mwworld/class.hpp" | #include "../mwworld/class.hpp" | ||||||
| #include "../mwworld/containerstore.hpp" | #include "../mwworld/containerstore.hpp" | ||||||
| 
 | 
 | ||||||
| #include "inventorywindow.hpp" |  | ||||||
| 
 |  | ||||||
| namespace MWGui | namespace MWGui | ||||||
| { | { | ||||||
|     const int TravelWindow::sLineHeight = 18; |     const int TravelWindow::sLineHeight = 18; | ||||||
|  | @ -51,13 +50,15 @@ namespace MWGui | ||||||
|         const MWWorld::Store<ESM::GameSetting> &gmst = |         const MWWorld::Store<ESM::GameSetting> &gmst = | ||||||
|             MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>(); |             MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>(); | ||||||
| 
 | 
 | ||||||
|  |         MWWorld::Ptr player = MWBase::Environment::get().getWorld ()->getPlayerPtr(); | ||||||
|  |         int playerGold = player.getClass().getContainerStore(player).count(MWWorld::ContainerStore::sGoldId); | ||||||
|  | 
 | ||||||
|         if(interior) |         if(interior) | ||||||
|         { |         { | ||||||
|             price = gmst.find("fMagesGuildTravel")->getFloat(); |             price = gmst.find("fMagesGuildTravel")->getFloat(); | ||||||
|         } |         } | ||||||
|         else |         else | ||||||
|         { |         { | ||||||
|             MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayer().getPlayer(); |  | ||||||
|             ESM::Position PlayerPos = player.getRefData().getPosition(); |             ESM::Position PlayerPos = player.getRefData().getPosition(); | ||||||
|             float d = sqrt( pow(pos.pos[0] - PlayerPos.pos[0],2) + pow(pos.pos[1] - PlayerPos.pos[1],2) + pow(pos.pos[2] - PlayerPos.pos[2],2)   ); |             float d = sqrt( pow(pos.pos[0] - PlayerPos.pos[0],2) + pow(pos.pos[1] - PlayerPos.pos[1],2) + pow(pos.pos[2] - PlayerPos.pos[2],2)   ); | ||||||
|             price = d/gmst.find("fTravelMult")->getFloat(); |             price = d/gmst.find("fTravelMult")->getFloat(); | ||||||
|  | @ -65,7 +66,8 @@ namespace MWGui | ||||||
| 
 | 
 | ||||||
|         price = MWBase::Environment::get().getMechanicsManager()->getBarterOffer(mPtr,price,true); |         price = MWBase::Environment::get().getMechanicsManager()->getBarterOffer(mPtr,price,true); | ||||||
| 
 | 
 | ||||||
|         MyGUI::Button* toAdd = mDestinationsView->createWidget<MyGUI::Button>((price>MWBase::Environment::get().getWindowManager()->getInventoryWindow()->getPlayerGold()) ? "SandTextGreyedOut" : "SandTextButton", 0, mCurrentY, 200, sLineHeight, MyGUI::Align::Default); |         MyGUI::Button* toAdd = mDestinationsView->createWidget<MyGUI::Button>("SandTextButton", 0, mCurrentY, 200, sLineHeight, MyGUI::Align::Default); | ||||||
|  |         toAdd->setEnabled(price<=playerGold); | ||||||
|         mCurrentY += sLineHeight; |         mCurrentY += sLineHeight; | ||||||
|         if(interior) |         if(interior) | ||||||
|             toAdd->setUserString("interior","y"); |             toAdd->setUserString("interior","y"); | ||||||
|  | @ -121,13 +123,14 @@ namespace MWGui | ||||||
|         int price; |         int price; | ||||||
|         iss >> price; |         iss >> price; | ||||||
| 
 | 
 | ||||||
|         MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayer().getPlayer(); |         MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr(); | ||||||
|  |         int playerGold = player.getClass().getContainerStore(player).count(MWWorld::ContainerStore::sGoldId); | ||||||
| 
 | 
 | ||||||
|         if (MWBase::Environment::get().getWindowManager()->getInventoryWindow()->getPlayerGold()<price) |         if (playerGold<price) | ||||||
|             return; |             return; | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|         player.getClass().getContainerStore(player).remove("gold_001", price, player); |         player.getClass().getContainerStore(player).remove(MWWorld::ContainerStore::sGoldId, price, player); | ||||||
| 
 | 
 | ||||||
|         MWBase::Environment::get().getWorld ()->getFader ()->fadeOut(1); |         MWBase::Environment::get().getWorld ()->getFader ()->fadeOut(1); | ||||||
|         ESM::Position pos = *_sender->getUserData<ESM::Position>(); |         ESM::Position pos = *_sender->getUserData<ESM::Position>(); | ||||||
|  | @ -166,7 +169,10 @@ namespace MWGui | ||||||
| 
 | 
 | ||||||
|     void TravelWindow::updateLabels() |     void TravelWindow::updateLabels() | ||||||
|     { |     { | ||||||
|         mPlayerGold->setCaptionWithReplacing("#{sGold}: " + boost::lexical_cast<std::string>(MWBase::Environment::get().getWindowManager()->getInventoryWindow()->getPlayerGold())); |         MWWorld::Ptr player = MWBase::Environment::get().getWorld ()->getPlayerPtr(); | ||||||
|  |         int playerGold = player.getClass().getContainerStore(player).count(MWWorld::ContainerStore::sGoldId); | ||||||
|  | 
 | ||||||
|  |         mPlayerGold->setCaptionWithReplacing("#{sGold}: " + boost::lexical_cast<std::string>(playerGold)); | ||||||
|         mPlayerGold->setCoord(8, |         mPlayerGold->setCoord(8, | ||||||
|                               mPlayerGold->getTop(), |                               mPlayerGold->getTop(), | ||||||
|                               mPlayerGold->getTextSize().width, |                               mPlayerGold->getTextSize().width, | ||||||
|  |  | ||||||
|  | @ -9,7 +9,6 @@ | ||||||
| #include "../mwbase/environment.hpp" | #include "../mwbase/environment.hpp" | ||||||
| #include "../mwbase/mechanicsmanager.hpp" | #include "../mwbase/mechanicsmanager.hpp" | ||||||
| 
 | 
 | ||||||
| #include "../mwworld/player.hpp" |  | ||||||
| #include "../mwworld/class.hpp" | #include "../mwworld/class.hpp" | ||||||
| 
 | 
 | ||||||
| #include "../mwmechanics/creaturestats.hpp" | #include "../mwmechanics/creaturestats.hpp" | ||||||
|  | @ -148,7 +147,7 @@ namespace MWGui | ||||||
|         // we need to sleep for a specific time, and since that isn't calculated yet, we'll do it here
 |         // we need to sleep for a specific time, and since that isn't calculated yet, we'll do it here
 | ||||||
|         // I'm making the assumption here that the # of hours rested is calculated when rest is started
 |         // I'm making the assumption here that the # of hours rested is calculated when rest is started
 | ||||||
|         // TODO: the rougher logic here (calculating the hourly deltas) should really go into helper funcs elsewhere
 |         // TODO: the rougher logic here (calculating the hourly deltas) should really go into helper funcs elsewhere
 | ||||||
|         MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayer().getPlayer(); |         MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr(); | ||||||
|         const MWMechanics::CreatureStats& stats = MWWorld::Class::get(player).getCreatureStats(player); |         const MWMechanics::CreatureStats& stats = MWWorld::Class::get(player).getCreatureStats(player); | ||||||
|         const MWWorld::ESMStore& store = MWBase::Environment::get().getWorld()->getStore(); |         const MWWorld::ESMStore& store = MWBase::Environment::get().getWorld()->getStore(); | ||||||
| 
 | 
 | ||||||
|  | @ -218,7 +217,7 @@ namespace MWGui | ||||||
| 
 | 
 | ||||||
|     void WaitDialog::setCanRest (bool canRest) |     void WaitDialog::setCanRest (bool canRest) | ||||||
|     { |     { | ||||||
|         MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayer().getPlayer(); |         MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr(); | ||||||
|         MWMechanics::CreatureStats& stats = MWWorld::Class::get(player).getCreatureStats(player); |         MWMechanics::CreatureStats& stats = MWWorld::Class::get(player).getCreatureStats(player); | ||||||
|         bool full = (stats.getFatigue().getCurrent() >= stats.getFatigue().getModified()) |         bool full = (stats.getFatigue().getCurrent() >= stats.getFatigue().getModified()) | ||||||
|                 && (stats.getHealth().getCurrent() >= stats.getHealth().getModified()) |                 && (stats.getHealth().getCurrent() >= stats.getHealth().getModified()) | ||||||
|  | @ -272,7 +271,7 @@ namespace MWGui | ||||||
|         MWBase::Environment::get().getWindowManager()->removeGuiMode (GM_RestBed); |         MWBase::Environment::get().getWindowManager()->removeGuiMode (GM_RestBed); | ||||||
|         mWaiting = false; |         mWaiting = false; | ||||||
| 
 | 
 | ||||||
|         MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayer().getPlayer(); |         MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr(); | ||||||
|         const MWMechanics::NpcStats &pcstats = MWWorld::Class::get(player).getNpcStats(player); |         const MWMechanics::NpcStats &pcstats = MWWorld::Class::get(player).getNpcStats(player); | ||||||
| 
 | 
 | ||||||
|         // trigger levelup if possible
 |         // trigger levelup if possible
 | ||||||
|  |  | ||||||
|  | @ -355,7 +355,7 @@ namespace MWInput | ||||||
|             // if player tried to start moving, but can't (due to being overencumbered), display a notification.
 |             // if player tried to start moving, but can't (due to being overencumbered), display a notification.
 | ||||||
|             if (triedToMove) |             if (triedToMove) | ||||||
|             { |             { | ||||||
|                 MWWorld::Ptr player = MWBase::Environment::get().getWorld ()->getPlayer ().getPlayer (); |                 MWWorld::Ptr player = MWBase::Environment::get().getWorld ()->getPlayerPtr(); | ||||||
|                 mOverencumberedMessageDelay -= dt; |                 mOverencumberedMessageDelay -= dt; | ||||||
|                 if (MWWorld::Class::get(player).getEncumbrance(player) >= MWWorld::Class::get(player).getCapacity(player)) |                 if (MWWorld::Class::get(player).getEncumbrance(player) >= MWWorld::Class::get(player).getCapacity(player)) | ||||||
|                 { |                 { | ||||||
|  | @ -555,7 +555,7 @@ namespace MWInput | ||||||
|         if (MyGUI::InputManager::getInstance ().getMouseFocusWidget () != 0) |         if (MyGUI::InputManager::getInstance ().getMouseFocusWidget () != 0) | ||||||
|         { |         { | ||||||
|             MyGUI::Button* b = MyGUI::InputManager::getInstance ().getMouseFocusWidget ()->castType<MyGUI::Button>(false); |             MyGUI::Button* b = MyGUI::InputManager::getInstance ().getMouseFocusWidget ()->castType<MyGUI::Button>(false); | ||||||
|             if (b) |             if (b && b->getEnabled()) | ||||||
|             { |             { | ||||||
|                 MWBase::Environment::get().getSoundManager ()->playSound ("Menu Click", 1.f, 1.f); |                 MWBase::Environment::get().getSoundManager ()->playSound ("Menu Click", 1.f, 1.f); | ||||||
|             } |             } | ||||||
|  |  | ||||||
|  | @ -11,7 +11,6 @@ | ||||||
| 
 | 
 | ||||||
| #include "../mwworld/class.hpp" | #include "../mwworld/class.hpp" | ||||||
| #include "../mwworld/inventorystore.hpp" | #include "../mwworld/inventorystore.hpp" | ||||||
| #include "../mwworld/player.hpp" |  | ||||||
| #include "../mwworld/manualref.hpp" | #include "../mwworld/manualref.hpp" | ||||||
| #include "../mwworld/actionequip.hpp" | #include "../mwworld/actionequip.hpp" | ||||||
| 
 | 
 | ||||||
|  | @ -163,7 +162,7 @@ namespace MWMechanics | ||||||
|         { |         { | ||||||
|             CreatureStats& creatureStats =  MWWorld::Class::get (ptr).getCreatureStats (ptr); |             CreatureStats& creatureStats =  MWWorld::Class::get (ptr).getCreatureStats (ptr); | ||||||
|             //engage combat or not?
 |             //engage combat or not?
 | ||||||
|             MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayer().getPlayer(); |             MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr(); | ||||||
|             if(ptr != player && !creatureStats.isHostile()) |             if(ptr != player && !creatureStats.isHostile()) | ||||||
|             { |             { | ||||||
|                 ESM::Position playerpos = player.getRefData().getPosition(); |                 ESM::Position playerpos = player.getRefData().getPosition(); | ||||||
|  | @ -585,7 +584,7 @@ namespace MWMechanics | ||||||
|                 ptr.getClass().setActorHealth(ptr, stats.getHealth().getCurrent() - 3.0f*duration); |                 ptr.getClass().setActorHealth(ptr, stats.getHealth().getCurrent() - 3.0f*duration); | ||||||
| 
 | 
 | ||||||
|                 // Play a drowning sound as necessary for the player
 |                 // Play a drowning sound as necessary for the player
 | ||||||
|                 if(ptr == world->getPlayer().getPlayer()) |                 if(ptr == world->getPlayerPtr()) | ||||||
|                 { |                 { | ||||||
|                     MWBase::SoundManager *sndmgr = MWBase::Environment::get().getSoundManager(); |                     MWBase::SoundManager *sndmgr = MWBase::Environment::get().getSoundManager(); | ||||||
|                     if(!sndmgr->getSoundPlaying(MWWorld::Ptr(), "drown")) |                     if(!sndmgr->getSoundPlaying(MWWorld::Ptr(), "drown")) | ||||||
|  |  | ||||||
|  | @ -3,7 +3,6 @@ | ||||||
| #include "movement.hpp" | #include "movement.hpp" | ||||||
| 
 | 
 | ||||||
| #include "../mwworld/class.hpp" | #include "../mwworld/class.hpp" | ||||||
| #include "../mwworld/player.hpp" |  | ||||||
| #include "../mwworld/timestamp.hpp" | #include "../mwworld/timestamp.hpp" | ||||||
| #include "../mwbase/world.hpp" | #include "../mwbase/world.hpp" | ||||||
| #include "../mwbase/environment.hpp" | #include "../mwbase/environment.hpp" | ||||||
|  |  | ||||||
|  | @ -3,7 +3,6 @@ | ||||||
| #include "movement.hpp" | #include "movement.hpp" | ||||||
| 
 | 
 | ||||||
| #include "../mwworld/class.hpp" | #include "../mwworld/class.hpp" | ||||||
| #include "../mwworld/player.hpp" |  | ||||||
| #include "../mwworld/timestamp.hpp" | #include "../mwworld/timestamp.hpp" | ||||||
| #include "../mwbase/world.hpp" | #include "../mwbase/world.hpp" | ||||||
| #include "../mwbase/environment.hpp" | #include "../mwbase/environment.hpp" | ||||||
|  | @ -83,7 +82,7 @@ namespace MWMechanics | ||||||
|                 return true; |                 return true; | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|         MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayer().getPlayer(); |         MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr(); | ||||||
|         ESM::Position pos = actor.getRefData().getPosition(); |         ESM::Position pos = actor.getRefData().getPosition(); | ||||||
|         bool cellChange = actor.getCell()->mCell->mData.mX != cellX || actor.getCell()->mCell->mData.mY != cellY; |         bool cellChange = actor.getCell()->mCell->mData.mX != cellX || actor.getCell()->mCell->mData.mY != cellY; | ||||||
|         const ESM::Pathgrid *pathgrid = |         const ESM::Pathgrid *pathgrid = | ||||||
|  |  | ||||||
|  | @ -15,7 +15,6 @@ | ||||||
| #include "npcstats.hpp" | #include "npcstats.hpp" | ||||||
| #include "../mwbase/environment.hpp" | #include "../mwbase/environment.hpp" | ||||||
| #include "../mwbase/world.hpp" | #include "../mwbase/world.hpp" | ||||||
| #include "../mwworld/player.hpp" |  | ||||||
| 
 | 
 | ||||||
| void MWMechanics::AiSequence::copy (const AiSequence& sequence) | void MWMechanics::AiSequence::copy (const AiSequence& sequence) | ||||||
| { | { | ||||||
|  | @ -63,7 +62,7 @@ bool MWMechanics::AiSequence::isPackageDone() const | ||||||
| 
 | 
 | ||||||
| void MWMechanics::AiSequence::execute (const MWWorld::Ptr& actor,float duration) | void MWMechanics::AiSequence::execute (const MWWorld::Ptr& actor,float duration) | ||||||
| { | { | ||||||
|     if(actor != MWBase::Environment::get().getWorld()->getPlayer().getPlayer()) |     if(actor != MWBase::Environment::get().getWorld()->getPlayerPtr()) | ||||||
|     { |     { | ||||||
|         if (!mPackages.empty()) |         if (!mPackages.empty()) | ||||||
|         { |         { | ||||||
|  |  | ||||||
|  | @ -5,7 +5,6 @@ | ||||||
| #include "../mwbase/world.hpp" | #include "../mwbase/world.hpp" | ||||||
| #include "../mwbase/environment.hpp" | #include "../mwbase/environment.hpp" | ||||||
| #include "../mwworld/class.hpp" | #include "../mwworld/class.hpp" | ||||||
| #include "../mwworld/player.hpp" |  | ||||||
| 
 | 
 | ||||||
| namespace | namespace | ||||||
| { | { | ||||||
|  | @ -38,7 +37,7 @@ namespace MWMechanics | ||||||
|         Movement &movement = actor.getClass().getMovementSettings(actor); |         Movement &movement = actor.getClass().getMovementSettings(actor); | ||||||
|         const ESM::Cell *cell = actor.getCell()->mCell; |         const ESM::Cell *cell = actor.getCell()->mCell; | ||||||
| 
 | 
 | ||||||
|         MWWorld::Ptr player = world->getPlayer().getPlayer(); |         MWWorld::Ptr player = world->getPlayerPtr(); | ||||||
|         if(cell->mData.mX != player.getCell()->mCell->mData.mX) |         if(cell->mData.mX != player.getCell()->mCell->mData.mX) | ||||||
|         { |         { | ||||||
|             int sideX = sgn(cell->mData.mX - player.getCell()->mCell->mData.mX); |             int sideX = sgn(cell->mData.mX - player.getCell()->mCell->mData.mX); | ||||||
|  |  | ||||||
|  | @ -3,7 +3,6 @@ | ||||||
| #include "movement.hpp" | #include "movement.hpp" | ||||||
| 
 | 
 | ||||||
| #include "../mwworld/class.hpp" | #include "../mwworld/class.hpp" | ||||||
| #include "../mwworld/player.hpp" |  | ||||||
| #include "../mwbase/world.hpp" | #include "../mwbase/world.hpp" | ||||||
| #include "../mwbase/environment.hpp" | #include "../mwbase/environment.hpp" | ||||||
| #include "../mwbase/mechanicsmanager.hpp" | #include "../mwbase/mechanicsmanager.hpp" | ||||||
|  |  | ||||||
|  | @ -33,7 +33,6 @@ | ||||||
| #include "../mwbase/soundmanager.hpp" | #include "../mwbase/soundmanager.hpp" | ||||||
| #include "../mwbase/windowmanager.hpp" | #include "../mwbase/windowmanager.hpp" | ||||||
| 
 | 
 | ||||||
| #include "../mwworld/player.hpp" |  | ||||||
| #include "../mwworld/class.hpp" | #include "../mwworld/class.hpp" | ||||||
| #include "../mwworld/inventorystore.hpp" | #include "../mwworld/inventorystore.hpp" | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -1,5 +1,4 @@ | ||||||
| #include "enchanting.hpp" | #include "enchanting.hpp" | ||||||
| #include "../mwworld/player.hpp" |  | ||||||
| #include "../mwworld/manualref.hpp" | #include "../mwworld/manualref.hpp" | ||||||
| #include "../mwworld/class.hpp" | #include "../mwworld/class.hpp" | ||||||
| #include "../mwworld/containerstore.hpp" | #include "../mwworld/containerstore.hpp" | ||||||
|  | @ -53,7 +52,7 @@ namespace MWMechanics | ||||||
| 
 | 
 | ||||||
|     bool Enchanting::create() |     bool Enchanting::create() | ||||||
|     { |     { | ||||||
|         const MWWorld::Ptr& player = MWBase::Environment::get().getWorld()->getPlayer().getPlayer(); |         const MWWorld::Ptr& player = MWBase::Environment::get().getWorld()->getPlayerPtr(); | ||||||
|         MWWorld::ContainerStore& store = MWWorld::Class::get(player).getContainerStore(player); |         MWWorld::ContainerStore& store = MWWorld::Class::get(player).getContainerStore(player); | ||||||
|         ESM::Enchantment enchantment; |         ESM::Enchantment enchantment; | ||||||
|         enchantment.mData.mCharge = getGemCharge(); |         enchantment.mData.mCharge = getGemCharge(); | ||||||
|  | @ -213,7 +212,7 @@ namespace MWMechanics | ||||||
|             return 0; |             return 0; | ||||||
| 
 | 
 | ||||||
|         const float enchantCost = getEnchantPoints(); |         const float enchantCost = getEnchantPoints(); | ||||||
|         MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayer().getPlayer(); |         MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr(); | ||||||
|         MWMechanics::NpcStats &stats = MWWorld::Class::get(player).getNpcStats(player); |         MWMechanics::NpcStats &stats = MWWorld::Class::get(player).getNpcStats(player); | ||||||
|         int eSkill = stats.getSkill(ESM::Skill::Enchant).getModified(); |         int eSkill = stats.getSkill(ESM::Skill::Enchant).getModified(); | ||||||
| 
 | 
 | ||||||
|  | @ -297,9 +296,9 @@ namespace MWMechanics | ||||||
| 
 | 
 | ||||||
|     void Enchanting::payForEnchantment() const |     void Enchanting::payForEnchantment() const | ||||||
|     { |     { | ||||||
|         const MWWorld::Ptr& player = MWBase::Environment::get().getWorld()->getPlayer().getPlayer(); |         const MWWorld::Ptr& player = MWBase::Environment::get().getWorld()->getPlayerPtr(); | ||||||
|         MWWorld::ContainerStore& store = MWWorld::Class::get(player).getContainerStore(player); |         MWWorld::ContainerStore& store = MWWorld::Class::get(player).getContainerStore(player); | ||||||
| 
 | 
 | ||||||
|         store.remove("gold_001", getEnchantPrice(), player); |         store.remove(MWWorld::ContainerStore::sGoldId, getEnchantPrice(), player); | ||||||
|     } |     } | ||||||
| } | } | ||||||
|  |  | ||||||
|  | @ -16,11 +16,32 @@ | ||||||
| 
 | 
 | ||||||
| #include "spellcasting.hpp" | #include "spellcasting.hpp" | ||||||
| 
 | 
 | ||||||
|  | namespace | ||||||
|  | { | ||||||
|  |     /// @return is \a ptr allowed to take/use \a item or is it a crime?
 | ||||||
|  |     bool isAllowedToUse (const MWWorld::Ptr& ptr, const MWWorld::Ptr& item) | ||||||
|  |     { | ||||||
|  |         const std::string& owner = item.getCellRef().mOwner; | ||||||
|  |         bool isOwned = !owner.empty(); | ||||||
|  | 
 | ||||||
|  |         const std::string& faction = item.getCellRef().mFaction; | ||||||
|  |         bool isFactionOwned = false; | ||||||
|  |         if (!faction.empty()) | ||||||
|  |         { | ||||||
|  |             const std::map<std::string, int>& factions = ptr.getClass().getNpcStats(ptr).getFactionRanks(); | ||||||
|  |             if (factions.find(Misc::StringUtils::lowerCase(faction)) == factions.end()) | ||||||
|  |                 isFactionOwned = true; | ||||||
|  |         } | ||||||
|  | 
 | ||||||
|  |         return (!isOwned && !isFactionOwned); | ||||||
|  |     } | ||||||
|  | } | ||||||
|  | 
 | ||||||
| namespace MWMechanics | namespace MWMechanics | ||||||
| { | { | ||||||
|     void MechanicsManager::buildPlayer() |     void MechanicsManager::buildPlayer() | ||||||
|     { |     { | ||||||
|         MWWorld::Ptr ptr = MWBase::Environment::get().getWorld()->getPlayer().getPlayer(); |         MWWorld::Ptr ptr = MWBase::Environment::get().getWorld()->getPlayerPtr(); | ||||||
| 
 | 
 | ||||||
|         MWMechanics::CreatureStats& creatureStats = MWWorld::Class::get (ptr).getCreatureStats (ptr); |         MWMechanics::CreatureStats& creatureStats = MWWorld::Class::get (ptr).getCreatureStats (ptr); | ||||||
|         MWMechanics::NpcStats& npcStats = MWWorld::Class::get (ptr).getNpcStats (ptr); |         MWMechanics::NpcStats& npcStats = MWWorld::Class::get (ptr).getNpcStats (ptr); | ||||||
|  | @ -230,7 +251,7 @@ namespace MWMechanics | ||||||
|     { |     { | ||||||
|         // Uses ingame time, but scaled to real time
 |         // Uses ingame time, but scaled to real time
 | ||||||
|         duration /= MWBase::Environment::get().getWorld()->getTimeScaleFactor(); |         duration /= MWBase::Environment::get().getWorld()->getTimeScaleFactor(); | ||||||
|         MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayer().getPlayer(); |         MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr(); | ||||||
|         player.getClass().getInventoryStore(player).rechargeItems(duration); |         player.getClass().getInventoryStore(player).rechargeItems(duration); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  | @ -311,7 +332,7 @@ namespace MWMechanics | ||||||
|                 MWBase::Environment::get().getWindowManager(); |                 MWBase::Environment::get().getWindowManager(); | ||||||
| 
 | 
 | ||||||
|             const ESM::NPC *player = |             const ESM::NPC *player = | ||||||
|                 world->getPlayer().getPlayer().get<ESM::NPC>()->mBase; |                 world->getPlayerPtr().get<ESM::NPC>()->mBase; | ||||||
| 
 | 
 | ||||||
|             const ESM::Race *race = |             const ESM::Race *race = | ||||||
|                 world->getStore().get<ESM::Race>().find(player->mRace); |                 world->getStore().get<ESM::Race>().find(player->mRace); | ||||||
|  | @ -337,7 +358,7 @@ namespace MWMechanics | ||||||
| 
 | 
 | ||||||
|             // HACK? The player has been changed, so a new Animation object may
 |             // HACK? The player has been changed, so a new Animation object may
 | ||||||
|             // have been made for them. Make sure they're properly updated.
 |             // have been made for them. Make sure they're properly updated.
 | ||||||
|             MWWorld::Ptr ptr = MWBase::Environment::get().getWorld()->getPlayer().getPlayer(); |             MWWorld::Ptr ptr = MWBase::Environment::get().getWorld()->getPlayerPtr(); | ||||||
|             mActors.removeActor(ptr); |             mActors.removeActor(ptr); | ||||||
|             mActors.addActor(ptr); |             mActors.addActor(ptr); | ||||||
|         } |         } | ||||||
|  | @ -356,7 +377,7 @@ namespace MWMechanics | ||||||
|         MWBase::World *world = MWBase::Environment::get().getWorld(); |         MWBase::World *world = MWBase::Environment::get().getWorld(); | ||||||
| 
 | 
 | ||||||
|         ESM::NPC player = |         ESM::NPC player = | ||||||
|             *world->getPlayer().getPlayer().get<ESM::NPC>()->mBase; |             *world->getPlayerPtr().get<ESM::NPC>()->mBase; | ||||||
|         player.mName = name; |         player.mName = name; | ||||||
| 
 | 
 | ||||||
|         world->createRecord(player); |         world->createRecord(player); | ||||||
|  | @ -369,7 +390,7 @@ namespace MWMechanics | ||||||
|         MWBase::World *world = MWBase::Environment::get().getWorld(); |         MWBase::World *world = MWBase::Environment::get().getWorld(); | ||||||
| 
 | 
 | ||||||
|         ESM::NPC player = |         ESM::NPC player = | ||||||
|             *world->getPlayer().getPlayer().get<ESM::NPC>()->mBase; |             *world->getPlayerPtr().get<ESM::NPC>()->mBase; | ||||||
| 
 | 
 | ||||||
|         player.mRace = race; |         player.mRace = race; | ||||||
|         player.mHead = head; |         player.mHead = head; | ||||||
|  | @ -395,7 +416,7 @@ namespace MWMechanics | ||||||
|         MWBase::World *world = MWBase::Environment::get().getWorld(); |         MWBase::World *world = MWBase::Environment::get().getWorld(); | ||||||
| 
 | 
 | ||||||
|         ESM::NPC player = |         ESM::NPC player = | ||||||
|             *world->getPlayer().getPlayer().get<ESM::NPC>()->mBase; |             *world->getPlayerPtr().get<ESM::NPC>()->mBase; | ||||||
|         player.mClass = id; |         player.mClass = id; | ||||||
| 
 | 
 | ||||||
|         world->createRecord(player); |         world->createRecord(player); | ||||||
|  | @ -412,7 +433,7 @@ namespace MWMechanics | ||||||
|         const ESM::Class *ptr = world->createRecord(cls); |         const ESM::Class *ptr = world->createRecord(cls); | ||||||
| 
 | 
 | ||||||
|         ESM::NPC player = |         ESM::NPC player = | ||||||
|             *world->getPlayer().getPlayer().get<ESM::NPC>()->mBase; |             *world->getPlayerPtr().get<ESM::NPC>()->mBase; | ||||||
|         player.mClass = ptr->mId; |         player.mClass = ptr->mId; | ||||||
| 
 | 
 | ||||||
|         world->createRecord(player); |         world->createRecord(player); | ||||||
|  | @ -428,7 +449,7 @@ namespace MWMechanics | ||||||
|         float x = npcSkill.getBaseDisposition(); |         float x = npcSkill.getBaseDisposition(); | ||||||
| 
 | 
 | ||||||
|         MWWorld::LiveCellRef<ESM::NPC>* npc = ptr.get<ESM::NPC>(); |         MWWorld::LiveCellRef<ESM::NPC>* npc = ptr.get<ESM::NPC>(); | ||||||
|         MWWorld::Ptr playerPtr = MWBase::Environment::get().getWorld()->getPlayer().getPlayer(); |         MWWorld::Ptr playerPtr = MWBase::Environment::get().getWorld()->getPlayerPtr(); | ||||||
|         MWWorld::LiveCellRef<ESM::NPC>* player = playerPtr.get<ESM::NPC>(); |         MWWorld::LiveCellRef<ESM::NPC>* player = playerPtr.get<ESM::NPC>(); | ||||||
|         const MWMechanics::NpcStats &playerStats = MWWorld::Class::get(playerPtr).getNpcStats(playerPtr); |         const MWMechanics::NpcStats &playerStats = MWWorld::Class::get(playerPtr).getNpcStats(playerPtr); | ||||||
| 
 | 
 | ||||||
|  | @ -449,7 +470,7 @@ namespace MWMechanics | ||||||
|                 it != MWBase::Environment::get().getWorld()->getStore().get<ESM::Faction>().find(Misc::StringUtils::lowerCase(npcFaction))->mReactions.end(); ++it) |                 it != MWBase::Environment::get().getWorld()->getStore().get<ESM::Faction>().find(Misc::StringUtils::lowerCase(npcFaction))->mReactions.end(); ++it) | ||||||
|             { |             { | ||||||
|                 if(Misc::StringUtils::lowerCase(it->mFaction) == Misc::StringUtils::lowerCase(npcFaction) |                 if(Misc::StringUtils::lowerCase(it->mFaction) == Misc::StringUtils::lowerCase(npcFaction) | ||||||
|                         && playerStats.getExpelled().find(Misc::StringUtils::lowerCase(it->mFaction)) == playerStats.getExpelled().end()) |                         && !playerStats.getExpelled(it->mFaction)) | ||||||
|                     reaction = it->mReaction; |                     reaction = it->mReaction; | ||||||
|             } |             } | ||||||
|             rank = playerStats.getFactionRanks().find(Misc::StringUtils::lowerCase(npcFaction))->second; |             rank = playerStats.getFactionRanks().find(Misc::StringUtils::lowerCase(npcFaction))->second; | ||||||
|  | @ -496,7 +517,7 @@ namespace MWMechanics | ||||||
| 
 | 
 | ||||||
|         const MWMechanics::NpcStats &sellerStats = MWWorld::Class::get(ptr).getNpcStats(ptr); |         const MWMechanics::NpcStats &sellerStats = MWWorld::Class::get(ptr).getNpcStats(ptr); | ||||||
| 
 | 
 | ||||||
|         MWWorld::Ptr playerPtr = MWBase::Environment::get().getWorld()->getPlayer().getPlayer(); |         MWWorld::Ptr playerPtr = MWBase::Environment::get().getWorld()->getPlayerPtr(); | ||||||
|         const MWMechanics::NpcStats &playerStats = MWWorld::Class::get(playerPtr).getNpcStats(playerPtr); |         const MWMechanics::NpcStats &playerStats = MWWorld::Class::get(playerPtr).getNpcStats(playerPtr); | ||||||
| 
 | 
 | ||||||
|         // I suppose the temporary disposition change _has_ to be considered here,
 |         // I suppose the temporary disposition change _has_ to be considered here,
 | ||||||
|  | @ -541,7 +562,7 @@ namespace MWMechanics | ||||||
| 
 | 
 | ||||||
|         MWMechanics::NpcStats& npcStats = MWWorld::Class::get(npc).getNpcStats(npc); |         MWMechanics::NpcStats& npcStats = MWWorld::Class::get(npc).getNpcStats(npc); | ||||||
| 
 | 
 | ||||||
|         MWWorld::Ptr playerPtr = MWBase::Environment::get().getWorld()->getPlayer().getPlayer(); |         MWWorld::Ptr playerPtr = MWBase::Environment::get().getWorld()->getPlayerPtr(); | ||||||
|         const MWMechanics::NpcStats &playerStats = MWWorld::Class::get(playerPtr).getNpcStats(playerPtr); |         const MWMechanics::NpcStats &playerStats = MWWorld::Class::get(playerPtr).getNpcStats(playerPtr); | ||||||
| 
 | 
 | ||||||
|         float persTerm = playerStats.getAttribute(ESM::Attribute::Personality).getModified() |         float persTerm = playerStats.getAttribute(ESM::Attribute::Personality).getModified() | ||||||
|  | @ -729,40 +750,44 @@ namespace MWMechanics | ||||||
|         return mAI; |         return mAI; | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  |     bool MechanicsManager::sleepInBed(const MWWorld::Ptr &ptr, const MWWorld::Ptr &bed) | ||||||
|  |     { | ||||||
|  |         if (isAllowedToUse(ptr, bed)) | ||||||
|  |             return false; | ||||||
|  |         MWWorld::Ptr victim; | ||||||
|  |         if (!bed.getCellRef().mOwner.empty()) | ||||||
|  |             victim = MWBase::Environment::get().getWorld()->getPtr(bed.getCellRef().mOwner, true); | ||||||
|  | 
 | ||||||
|  |         if(commitCrime(ptr, victim, OT_SleepingInOwnedBed)) | ||||||
|  |         { | ||||||
|  |             MWBase::Environment::get().getWindowManager()->messageBox("#{sNotifyMessage64}"); | ||||||
|  |             return true; | ||||||
|  |         } | ||||||
|  |         else | ||||||
|  |             return false; | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|     void MechanicsManager::itemTaken(const MWWorld::Ptr &ptr, const MWWorld::Ptr &item, int count) |     void MechanicsManager::itemTaken(const MWWorld::Ptr &ptr, const MWWorld::Ptr &item, int count) | ||||||
|     { |     { | ||||||
|         const std::string& owner = item.getCellRef().mOwner; |         if (isAllowedToUse(ptr, item)) | ||||||
|         bool isOwned = !owner.empty(); |  | ||||||
| 
 |  | ||||||
|         const std::string& faction = item.getCellRef().mFaction; |  | ||||||
|         bool isFactionOwned = false; |  | ||||||
|         if (!faction.empty()) |  | ||||||
|         { |  | ||||||
|             const std::map<std::string, int>& factions = ptr.getClass().getNpcStats(ptr).getFactionRanks(); |  | ||||||
|             if (factions.find(Misc::StringUtils::lowerCase(faction)) == factions.end()) |  | ||||||
|                 isFactionOwned = true; |  | ||||||
|         } |  | ||||||
| 
 |  | ||||||
|         if (!isOwned && !isFactionOwned) |  | ||||||
|             return; |             return; | ||||||
| 
 |  | ||||||
|         MWWorld::Ptr victim; |         MWWorld::Ptr victim; | ||||||
|         if (!owner.empty()) |         if (!item.getCellRef().mOwner.empty()) | ||||||
|             victim = MWBase::Environment::get().getWorld()->getPtr(owner, true); |             victim = MWBase::Environment::get().getWorld()->getPtr(item.getCellRef().mOwner, true); | ||||||
| 
 |  | ||||||
|         // TODO: expell from faction
 |  | ||||||
| 
 | 
 | ||||||
|         commitCrime(ptr, victim, OT_Theft, item.getClass().getValue(item) * count); |         commitCrime(ptr, victim, OT_Theft, item.getClass().getValue(item) * count); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     void MechanicsManager::commitCrime(const MWWorld::Ptr &ptr, const MWWorld::Ptr &victim, OffenseType type, int arg) |     bool MechanicsManager::commitCrime(const MWWorld::Ptr &ptr, const MWWorld::Ptr &victim, OffenseType type, int arg) | ||||||
|     { |     { | ||||||
|         // TODO: expell from faction
 |         // TODO: expell from faction
 | ||||||
| 
 | 
 | ||||||
|         bool reported=false; |         bool reported=false; | ||||||
|         for (Actors::PtrControllerMap::const_iterator it = mActors.begin(); it != mActors.end(); ++it) |         for (Actors::PtrControllerMap::const_iterator it = mActors.begin(); it != mActors.end(); ++it) | ||||||
|         { |         { | ||||||
|             if (it->first != ptr && awarenessCheck(ptr, it->first)) |             if (it->first != ptr && | ||||||
|  |                     MWBase::Environment::get().getWorld()->getLOS(ptr, it->first) && | ||||||
|  |                     awarenessCheck(ptr, it->first)) | ||||||
|             { |             { | ||||||
|                 // NPCs will always curse you when they notice you steal their items, even if they don't report the crime
 |                 // NPCs will always curse you when they notice you steal their items, even if they don't report the crime
 | ||||||
|                 if (it->first == victim && type == OT_Theft) |                 if (it->first == victim && type == OT_Theft) | ||||||
|  | @ -777,6 +802,8 @@ namespace MWMechanics | ||||||
|                         && (type != OT_Assault || it->first != victim) |                         && (type != OT_Assault || it->first != victim) | ||||||
|                 ) |                 ) | ||||||
|                 { |                 { | ||||||
|  |                     // TODO: stats.setAlarmed(true) on NPCs within earshot
 | ||||||
|  |                     // fAlarmRadius ?
 | ||||||
|                     reported=true; |                     reported=true; | ||||||
|                     break; |                     break; | ||||||
|                 } |                 } | ||||||
|  | @ -785,24 +812,40 @@ namespace MWMechanics | ||||||
| 
 | 
 | ||||||
|         if (reported) |         if (reported) | ||||||
|             reportCrime(ptr, victim, type, arg); |             reportCrime(ptr, victim, type, arg); | ||||||
|  |         return reported; | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     void MechanicsManager::reportCrime(const MWWorld::Ptr &ptr, const MWWorld::Ptr &victim, OffenseType type, int arg) |     void MechanicsManager::reportCrime(const MWWorld::Ptr &ptr, const MWWorld::Ptr &victim, OffenseType type, int arg) | ||||||
|     { |     { | ||||||
|  |         const MWWorld::Store<ESM::GameSetting>& store = MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>(); | ||||||
|         // Bounty for each type of crime
 |         // Bounty for each type of crime
 | ||||||
|         if (type == OT_Trespassing || type == OT_SleepingInOwnedBed) |         if (type == OT_Trespassing || type == OT_SleepingInOwnedBed) | ||||||
|             arg = 5; |             arg = store.find("iCrimeTresspass")->getInt(); | ||||||
|         else if (type == OT_Pickpocket) |         else if (type == OT_Pickpocket) | ||||||
|             arg = 25; |             arg = store.find("iCrimePickPocket")->getInt(); | ||||||
|         else if (type == OT_Assault) |         else if (type == OT_Assault) | ||||||
|             arg = 40; |             arg = store.find("iCrimeAttack")->getInt(); | ||||||
|         else if (type == OT_Murder) |         else if (type == OT_Murder) | ||||||
|             arg = 1000; |             arg = store.find("iCrimeKilling")->getInt(); | ||||||
|  |         else if (type == OT_Theft) | ||||||
|  |             arg *= store.find("fCrimeStealing")->getFloat(); | ||||||
| 
 | 
 | ||||||
|         MWBase::Environment::get().getWindowManager()->messageBox("#{sCrimeMessage}"); |         MWBase::Environment::get().getWindowManager()->messageBox("#{sCrimeMessage}"); | ||||||
|         ptr.getClass().getNpcStats(ptr).setBounty(ptr.getClass().getNpcStats(ptr).getBounty() |         ptr.getClass().getNpcStats(ptr).setBounty(ptr.getClass().getNpcStats(ptr).getBounty() | ||||||
|                                                   + arg); |                                                   + arg); | ||||||
| 
 | 
 | ||||||
|  |         // If committing a crime against a faction member, expell from the faction
 | ||||||
|  |         if (!victim.isEmpty() && victim.getClass().isNpc()) | ||||||
|  |         { | ||||||
|  |             std::string factionID; | ||||||
|  |             if(!victim.getClass().getNpcStats(victim).getFactionRanks().empty()) | ||||||
|  |                 factionID = victim.getClass().getNpcStats(victim).getFactionRanks().begin()->first; | ||||||
|  |             if (ptr.getClass().getNpcStats(ptr).isSameFaction(victim.getClass().getNpcStats(victim))) | ||||||
|  |             { | ||||||
|  |                 ptr.getClass().getNpcStats(ptr).expell(factionID); | ||||||
|  |             } | ||||||
|  |         } | ||||||
|  | 
 | ||||||
|         // TODO: make any guards in the area try to arrest the player
 |         // TODO: make any guards in the area try to arrest the player
 | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -105,13 +105,17 @@ namespace MWMechanics | ||||||
|              * @brief Commit a crime. If any actors witness the crime and report it, |              * @brief Commit a crime. If any actors witness the crime and report it, | ||||||
|              *        reportCrime will be called automatically. |              *        reportCrime will be called automatically. | ||||||
|              * @param arg Depends on \a type, e.g. for Theft, the value of the item that was stolen. |              * @param arg Depends on \a type, e.g. for Theft, the value of the item that was stolen. | ||||||
|  |              * @return was the crime reported? | ||||||
|              */ |              */ | ||||||
|             virtual void commitCrime (const MWWorld::Ptr& ptr, const MWWorld::Ptr& victim, |             virtual bool commitCrime (const MWWorld::Ptr& ptr, const MWWorld::Ptr& victim, | ||||||
|                                       OffenseType type, int arg=0); |                                       OffenseType type, int arg=0); | ||||||
|             virtual void reportCrime (const MWWorld::Ptr& ptr, const MWWorld::Ptr& victim, |             virtual void reportCrime (const MWWorld::Ptr& ptr, const MWWorld::Ptr& victim, | ||||||
|                                       OffenseType type, int arg=0); |                                       OffenseType type, int arg=0); | ||||||
|             /// Utility to check if taking this item is illegal and calling commitCrime if so
 |             /// Utility to check if taking this item is illegal and calling commitCrime if so
 | ||||||
|             virtual void itemTaken (const MWWorld::Ptr& ptr, const MWWorld::Ptr& item, int count); |             virtual void itemTaken (const MWWorld::Ptr& ptr, const MWWorld::Ptr& item, int count); | ||||||
|  |             /// Attempt sleeping in a bed. If this is illegal, call commitCrime.
 | ||||||
|  |             /// @return was it illegal, and someone saw you doing it?
 | ||||||
|  |             virtual bool sleepInBed (const MWWorld::Ptr& ptr, const MWWorld::Ptr& bed); | ||||||
| 
 | 
 | ||||||
|         virtual void forceStateUpdate(const MWWorld::Ptr &ptr); |         virtual void forceStateUpdate(const MWWorld::Ptr &ptr); | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -15,7 +15,6 @@ | ||||||
| 
 | 
 | ||||||
| #include "../mwworld/class.hpp" | #include "../mwworld/class.hpp" | ||||||
| #include "../mwworld/esmstore.hpp" | #include "../mwworld/esmstore.hpp" | ||||||
| #include "../mwworld/player.hpp" |  | ||||||
| 
 | 
 | ||||||
| #include "../mwbase/environment.hpp" | #include "../mwbase/environment.hpp" | ||||||
| #include "../mwbase/world.hpp" | #include "../mwbase/world.hpp" | ||||||
|  | @ -109,14 +108,26 @@ std::map<std::string, int>& MWMechanics::NpcStats::getFactionRanks() | ||||||
|     return mFactionRank; |     return mFactionRank; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| const std::set<std::string>& MWMechanics::NpcStats::getExpelled() const | bool MWMechanics::NpcStats::getExpelled(const std::string& factionID) const | ||||||
| { | { | ||||||
|     return mExpelled; |     return mExpelled.find(Misc::StringUtils::lowerCase(factionID)) != mExpelled.end(); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| std::set<std::string>& MWMechanics::NpcStats::getExpelled() | void MWMechanics::NpcStats::expell(const std::string& factionID) | ||||||
| { | { | ||||||
|     return mExpelled; |     std::string lower = Misc::StringUtils::lowerCase(factionID); | ||||||
|  |     if (mExpelled.find(lower) == mExpelled.end()) | ||||||
|  |     { | ||||||
|  |         std::string message = "#{sExpelledMessage}"; | ||||||
|  |         message += MWBase::Environment::get().getWorld()->getStore().get<ESM::Faction>().find(factionID)->mName; | ||||||
|  |         MWBase::Environment::get().getWindowManager()->messageBox(message); | ||||||
|  |         mExpelled.insert(lower); | ||||||
|  |     } | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | void MWMechanics::NpcStats::clearExpelled(const std::string& factionID) | ||||||
|  | { | ||||||
|  |     mExpelled.erase(Misc::StringUtils::lowerCase(factionID)); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| bool MWMechanics::NpcStats::isSameFaction (const NpcStats& npcStats) const | bool MWMechanics::NpcStats::isSameFaction (const NpcStats& npcStats) const | ||||||
|  |  | ||||||
|  | @ -99,8 +99,10 @@ namespace MWMechanics | ||||||
|             const std::map<std::string, int>& getFactionRanks() const; |             const std::map<std::string, int>& getFactionRanks() const; | ||||||
|             std::map<std::string, int>& getFactionRanks(); |             std::map<std::string, int>& getFactionRanks(); | ||||||
| 
 | 
 | ||||||
|             const std::set<std::string>& getExpelled() const; |             const std::set<std::string>& getExpelled() const { return mExpelled; } | ||||||
|             std::set<std::string>& getExpelled(); |             bool getExpelled(const std::string& factionID) const; | ||||||
|  |             void expell(const std::string& factionID); | ||||||
|  |             void clearExpelled(const std::string& factionID); | ||||||
| 
 | 
 | ||||||
|             bool isSameFaction (const NpcStats& npcStats) const; |             bool isSameFaction (const NpcStats& npcStats) const; | ||||||
|             ///< Do *this and \a npcStats share a faction?
 |             ///< Do *this and \a npcStats share a faction?
 | ||||||
|  |  | ||||||
|  | @ -8,7 +8,6 @@ | ||||||
| #include "../mwbase/windowmanager.hpp" | #include "../mwbase/windowmanager.hpp" | ||||||
| #include "../mwbase/soundmanager.hpp" | #include "../mwbase/soundmanager.hpp" | ||||||
| 
 | 
 | ||||||
| #include "../mwworld/player.hpp" |  | ||||||
| #include "../mwworld/containerstore.hpp" | #include "../mwworld/containerstore.hpp" | ||||||
| #include "../mwworld/class.hpp" | #include "../mwworld/class.hpp" | ||||||
| 
 | 
 | ||||||
|  | @ -20,7 +19,7 @@ namespace MWMechanics | ||||||
| 
 | 
 | ||||||
| void Repair::repair(const MWWorld::Ptr &itemToRepair) | void Repair::repair(const MWWorld::Ptr &itemToRepair) | ||||||
| { | { | ||||||
|     MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayer().getPlayer(); |     MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr(); | ||||||
|     MWWorld::LiveCellRef<ESM::Repair> *ref = |     MWWorld::LiveCellRef<ESM::Repair> *ref = | ||||||
|         mTool.get<ESM::Repair>(); |         mTool.get<ESM::Repair>(); | ||||||
| 
 | 
 | ||||||
|  | @ -77,7 +76,7 @@ void Repair::repair(const MWWorld::Ptr &itemToRepair) | ||||||
|     // tool used up?
 |     // tool used up?
 | ||||||
|     if (mTool.getCellRef().mCharge == 0) |     if (mTool.getCellRef().mCharge == 0) | ||||||
|     { |     { | ||||||
|         MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayer().getPlayer(); |         MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr(); | ||||||
|         MWWorld::ContainerStore& store = MWWorld::Class::get(player).getContainerStore(player); |         MWWorld::ContainerStore& store = MWWorld::Class::get(player).getContainerStore(player); | ||||||
| 
 | 
 | ||||||
|         store.remove(mTool, 1, player); |         store.remove(mTool, 1, player); | ||||||
|  |  | ||||||
|  | @ -1,7 +1,6 @@ | ||||||
| #include "security.hpp" | #include "security.hpp" | ||||||
| 
 | 
 | ||||||
| #include "../mwworld/class.hpp" | #include "../mwworld/class.hpp" | ||||||
| #include "../mwworld/player.hpp" |  | ||||||
| #include "../mwworld/containerstore.hpp" | #include "../mwworld/containerstore.hpp" | ||||||
| 
 | 
 | ||||||
| #include "../mwbase/world.hpp" | #include "../mwbase/world.hpp" | ||||||
|  |  | ||||||
|  | @ -7,8 +7,8 @@ | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| #include "../mwworld/containerstore.hpp" | #include "../mwworld/containerstore.hpp" | ||||||
| #include "../mwworld/player.hpp" |  | ||||||
| #include "../mwworld/actionteleport.hpp" | #include "../mwworld/actionteleport.hpp" | ||||||
|  | #include "../mwworld/player.hpp" | ||||||
| 
 | 
 | ||||||
| #include "../mwrender/animation.hpp" | #include "../mwrender/animation.hpp" | ||||||
| 
 | 
 | ||||||
|  | @ -287,17 +287,13 @@ namespace MWMechanics | ||||||
|             if (!MWBase::Environment::get().getWorld()->isTeleportingEnabled()) |             if (!MWBase::Environment::get().getWorld()->isTeleportingEnabled()) | ||||||
|                 return; |                 return; | ||||||
| 
 | 
 | ||||||
|             Ogre::Vector3 worldPos; |  | ||||||
|             if (!MWBase::Environment::get().getWorld()->findInteriorPositionInWorldSpace(target.getCell(), worldPos)) |  | ||||||
|                 worldPos = MWBase::Environment::get().getWorld()->getPlayer().getLastKnownExteriorPosition(); |  | ||||||
| 
 |  | ||||||
|             if (effectId == ESM::MagicEffect::DivineIntervention) |             if (effectId == ESM::MagicEffect::DivineIntervention) | ||||||
|             { |             { | ||||||
|                 MWBase::Environment::get().getWorld()->teleportToClosestMarker(target, "divinemarker", worldPos); |                 MWBase::Environment::get().getWorld()->teleportToClosestMarker(target, "divinemarker"); | ||||||
|             } |             } | ||||||
|             else if (effectId == ESM::MagicEffect::AlmsiviIntervention) |             else if (effectId == ESM::MagicEffect::AlmsiviIntervention) | ||||||
|             { |             { | ||||||
|                 MWBase::Environment::get().getWorld()->teleportToClosestMarker(target, "templemarker", worldPos); |                 MWBase::Environment::get().getWorld()->teleportToClosestMarker(target, "templemarker"); | ||||||
|             } |             } | ||||||
| 
 | 
 | ||||||
|             else if (effectId == ESM::MagicEffect::Mark) |             else if (effectId == ESM::MagicEffect::Mark) | ||||||
|  |  | ||||||
|  | @ -228,6 +228,7 @@ namespace MWRender | ||||||
| 
 | 
 | ||||||
|     void Camera::setSneakOffset() |     void Camera::setSneakOffset() | ||||||
|     { |     { | ||||||
|  |         // TODO: iFirstPersonSneakDelta
 | ||||||
|         if(mAnimation) |         if(mAnimation) | ||||||
|             mAnimation->addFirstPersonOffset(Ogre::Vector3(0.f, 0.f, -9.8f)); |             mAnimation->addFirstPersonOffset(Ogre::Vector3(0.f, 0.f, -9.8f)); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|  | @ -10,7 +10,6 @@ | ||||||
| 
 | 
 | ||||||
| #include "../mwbase/environment.hpp" | #include "../mwbase/environment.hpp" | ||||||
| #include "../mwbase/world.hpp" | #include "../mwbase/world.hpp" | ||||||
| #include "../mwworld/player.hpp" |  | ||||||
| #include "../mwworld/class.hpp" | #include "../mwworld/class.hpp" | ||||||
| #include "../mwworld/inventorystore.hpp" | #include "../mwworld/inventorystore.hpp" | ||||||
| 
 | 
 | ||||||
|  | @ -219,7 +218,7 @@ namespace MWRender | ||||||
|     // --------------------------------------------------------------------------------------------------
 |     // --------------------------------------------------------------------------------------------------
 | ||||||
| 
 | 
 | ||||||
|     RaceSelectionPreview::RaceSelectionPreview() |     RaceSelectionPreview::RaceSelectionPreview() | ||||||
|         : CharacterPreview(MWBase::Environment::get().getWorld()->getPlayer().getPlayer(), |         : CharacterPreview(MWBase::Environment::get().getWorld()->getPlayerPtr(), | ||||||
|             512, 512, "CharacterHeadPreview", Ogre::Vector3(0, 6, -35), Ogre::Vector3(0,125,0)) |             512, 512, "CharacterHeadPreview", Ogre::Vector3(0, 6, -35), Ogre::Vector3(0,125,0)) | ||||||
|         , mRef(&mBase) |         , mRef(&mBase) | ||||||
|     { |     { | ||||||
|  |  | ||||||
|  | @ -33,7 +33,6 @@ | ||||||
| #include "../mwmechanics/creaturestats.hpp" | #include "../mwmechanics/creaturestats.hpp" | ||||||
| 
 | 
 | ||||||
| #include "../mwworld/ptr.hpp" | #include "../mwworld/ptr.hpp" | ||||||
| #include "../mwworld/player.hpp" |  | ||||||
| 
 | 
 | ||||||
| #include "shadows.hpp" | #include "shadows.hpp" | ||||||
| #include "localmap.hpp" | #include "localmap.hpp" | ||||||
|  | @ -324,7 +323,7 @@ void RenderingManager::update (float duration, bool paused) | ||||||
| { | { | ||||||
|     MWBase::World *world = MWBase::Environment::get().getWorld(); |     MWBase::World *world = MWBase::Environment::get().getWorld(); | ||||||
| 
 | 
 | ||||||
|     MWWorld::Ptr player = world->getPlayer().getPlayer(); |     MWWorld::Ptr player = world->getPlayerPtr(); | ||||||
| 
 | 
 | ||||||
|     int blind = MWWorld::Class::get(player).getCreatureStats(player).getMagicEffects().get(ESM::MagicEffect::Blind).mMagnitude; |     int blind = MWWorld::Class::get(player).getCreatureStats(player).getMagicEffects().get(ESM::MagicEffect::Blind).mMagnitude; | ||||||
|     mRendering.getFader()->setFactor(std::max(0.f, 1.f-(blind / 100.f))); |     mRendering.getFader()->setFactor(std::max(0.f, 1.f-(blind / 100.f))); | ||||||
|  | @ -585,7 +584,7 @@ void RenderingManager::setAmbientColour(const Ogre::ColourValue& colour) | ||||||
| { | { | ||||||
|     mAmbientColor = colour; |     mAmbientColor = colour; | ||||||
| 
 | 
 | ||||||
|     MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayer().getPlayer(); |     MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr(); | ||||||
|     int nightEye = MWWorld::Class::get(player).getCreatureStats(player).getMagicEffects().get(ESM::MagicEffect::NightEye).mMagnitude; |     int nightEye = MWWorld::Class::get(player).getCreatureStats(player).getMagicEffects().get(ESM::MagicEffect::NightEye).mMagnitude; | ||||||
|     Ogre::ColourValue final = colour; |     Ogre::ColourValue final = colour; | ||||||
|     final += Ogre::ColourValue(0.7,0.7,0.7,0) * std::min(1.f, (nightEye/100.f)); |     final += Ogre::ColourValue(0.7,0.7,0.7,0) * std::min(1.f, (nightEye/100.f)); | ||||||
|  | @ -737,7 +736,7 @@ void RenderingManager::processChangedSettings(const Settings::CategorySettingVec | ||||||
|         else if (it->second == "max viewing distance" && it->first == "Viewing distance") |         else if (it->second == "max viewing distance" && it->first == "Viewing distance") | ||||||
|         { |         { | ||||||
|             if (!MWBase::Environment::get().getWorld()->isCellExterior() && !MWBase::Environment::get().getWorld()->isCellQuasiExterior()) |             if (!MWBase::Environment::get().getWorld()->isCellExterior() && !MWBase::Environment::get().getWorld()->isCellQuasiExterior()) | ||||||
|                 configureFog(*MWBase::Environment::get().getWorld()->getPlayer().getPlayer().getCell()); |                 configureFog(*MWBase::Environment::get().getWorld()->getPlayerPtr().getCell()); | ||||||
|         } |         } | ||||||
|         else if (it->first == "Video" && ( |         else if (it->first == "Video" && ( | ||||||
|                 it->second == "resolution x" |                 it->second == "resolution x" | ||||||
|  |  | ||||||
|  | @ -10,8 +10,6 @@ | ||||||
| #include "../mwbase/environment.hpp" | #include "../mwbase/environment.hpp" | ||||||
| #include "../mwbase/world.hpp" | #include "../mwbase/world.hpp" | ||||||
| 
 | 
 | ||||||
| #include "../mwworld/player.hpp" |  | ||||||
| 
 |  | ||||||
| namespace MWRender | namespace MWRender | ||||||
| { | { | ||||||
| 
 | 
 | ||||||
|  | @ -154,11 +152,11 @@ void RippleSimulation::addImpulses() | ||||||
|     /// \todo it should be more efficient to render all emitters at once
 |     /// \todo it should be more efficient to render all emitters at once
 | ||||||
|     for (std::vector<Emitter>::iterator it=mEmitters.begin(); it !=mEmitters.end(); ++it) |     for (std::vector<Emitter>::iterator it=mEmitters.begin(); it !=mEmitters.end(); ++it) | ||||||
|     { |     { | ||||||
|         if (it->mPtr == MWBase::Environment::get().getWorld ()->getPlayer ().getPlayer ()) |         if (it->mPtr == MWBase::Environment::get().getWorld ()->getPlayerPtr()) | ||||||
|         { |         { | ||||||
|             // fetch a new ptr (to handle cell change etc)
 |             // fetch a new ptr (to handle cell change etc)
 | ||||||
|             // for non-player actors this is done in updateObjectCell
 |             // for non-player actors this is done in updateObjectCell
 | ||||||
|             it->mPtr = MWBase::Environment::get().getWorld ()->getPlayer ().getPlayer (); |             it->mPtr = MWBase::Environment::get().getWorld ()->getPlayerPtr(); | ||||||
|         } |         } | ||||||
|         float* _currentPos = it->mPtr.getRefData().getPosition().pos; |         float* _currentPos = it->mPtr.getRefData().getPosition().pos; | ||||||
|         Ogre::Vector3 currentPos (_currentPos[0], _currentPos[1], _currentPos[2]); |         Ogre::Vector3 currentPos (_currentPos[0], _currentPos[1], _currentPos[2]); | ||||||
|  |  | ||||||
|  | @ -12,7 +12,6 @@ | ||||||
| 
 | 
 | ||||||
| #include "../mwbase/environment.hpp" | #include "../mwbase/environment.hpp" | ||||||
| #include "../mwbase/world.hpp" | #include "../mwbase/world.hpp" | ||||||
| 
 |  | ||||||
| #include "../mwworld/player.hpp" | #include "../mwworld/player.hpp" | ||||||
| 
 | 
 | ||||||
| #include "interpretercontext.hpp" | #include "interpretercontext.hpp" | ||||||
|  | @ -89,7 +88,7 @@ namespace MWScript | ||||||
|                 virtual void execute (Interpreter::Runtime& runtime) |                 virtual void execute (Interpreter::Runtime& runtime) | ||||||
|                 { |                 { | ||||||
|                     bool interior = |                     bool interior = | ||||||
|                         !MWBase::Environment::get().getWorld()->getPlayer().getPlayer().getCell()->mCell->isExterior(); |                         !MWBase::Environment::get().getWorld()->getPlayerPtr().getCell()->mCell->isExterior(); | ||||||
| 
 | 
 | ||||||
|                     runtime.push (interior ? 1 : 0); |                     runtime.push (interior ? 1 : 0); | ||||||
|                 } |                 } | ||||||
|  | @ -104,11 +103,12 @@ namespace MWScript | ||||||
|                     std::string name = runtime.getStringLiteral (runtime[0].mInteger); |                     std::string name = runtime.getStringLiteral (runtime[0].mInteger); | ||||||
|                     runtime.pop(); |                     runtime.pop(); | ||||||
| 
 | 
 | ||||||
|                     const ESM::Cell *cell = MWBase::Environment::get().getWorld()->getPlayer().getPlayer().getCell()->mCell; |                     const ESM::Cell *cell = MWBase::Environment::get().getWorld()->getPlayerPtr().getCell()->mCell; | ||||||
| 
 | 
 | ||||||
|                     std::string current = cell->mName; |                     std::string current = cell->mName; | ||||||
| 
 | 
 | ||||||
|                     if (!(cell->mData.mFlags & ESM::Cell::Interior) && current.empty()) |                     if (!(cell->mData.mFlags & ESM::Cell::Interior) && current.empty() | ||||||
|  |                             && !cell->mRegion.empty()) | ||||||
|                     { |                     { | ||||||
|                         const ESM::Region *region = |                         const ESM::Region *region = | ||||||
|                             MWBase::Environment::get().getWorld()->getStore().get<ESM::Region>().find (cell->mRegion); |                             MWBase::Environment::get().getWorld()->getStore().get<ESM::Region>().find (cell->mRegion); | ||||||
|  | @ -129,8 +129,11 @@ namespace MWScript | ||||||
| 
 | 
 | ||||||
|                 virtual void execute (Interpreter::Runtime& runtime) |                 virtual void execute (Interpreter::Runtime& runtime) | ||||||
|                 { |                 { | ||||||
|                     MWWorld::Ptr::CellStore *cell = MWBase::Environment::get().getWorld()->getPlayer().getPlayer().getCell(); |                     MWWorld::Ptr::CellStore *cell = MWBase::Environment::get().getWorld()->getPlayerPtr().getCell(); | ||||||
|                     runtime.push (cell->mWaterLevel); |                     if (cell->mCell->hasWater()) | ||||||
|  |                         runtime.push (cell->mWaterLevel); | ||||||
|  |                     else | ||||||
|  |                         runtime.push (-std::numeric_limits<float>().max()); | ||||||
|                 } |                 } | ||||||
|         }; |         }; | ||||||
| 
 | 
 | ||||||
|  | @ -142,7 +145,7 @@ namespace MWScript | ||||||
|                 { |                 { | ||||||
|                     Interpreter::Type_Float level = runtime[0].mFloat; |                     Interpreter::Type_Float level = runtime[0].mFloat; | ||||||
| 
 | 
 | ||||||
|                     MWWorld::Ptr::CellStore *cell = MWBase::Environment::get().getWorld()->getPlayer().getPlayer().getCell(); |                     MWWorld::Ptr::CellStore *cell = MWBase::Environment::get().getWorld()->getPlayerPtr().getCell(); | ||||||
| 
 | 
 | ||||||
|                     if (cell->mCell->isExterior()) |                     if (cell->mCell->isExterior()) | ||||||
|                         throw std::runtime_error("Can't set water level in exterior cell"); |                         throw std::runtime_error("Can't set water level in exterior cell"); | ||||||
|  | @ -160,7 +163,7 @@ namespace MWScript | ||||||
|                 { |                 { | ||||||
|                     Interpreter::Type_Float level = runtime[0].mFloat; |                     Interpreter::Type_Float level = runtime[0].mFloat; | ||||||
| 
 | 
 | ||||||
|                     MWWorld::Ptr::CellStore *cell = MWBase::Environment::get().getWorld()->getPlayer().getPlayer().getCell(); |                     MWWorld::Ptr::CellStore *cell = MWBase::Environment::get().getWorld()->getPlayerPtr().getCell(); | ||||||
| 
 | 
 | ||||||
|                     if (cell->mCell->isExterior()) |                     if (cell->mCell->isExterior()) | ||||||
|                         throw std::runtime_error("Can't set water level in exterior cell"); |                         throw std::runtime_error("Can't set water level in exterior cell"); | ||||||
|  |  | ||||||
|  | @ -21,7 +21,6 @@ | ||||||
| #include "../mwworld/containerstore.hpp" | #include "../mwworld/containerstore.hpp" | ||||||
| #include "../mwworld/actionequip.hpp" | #include "../mwworld/actionequip.hpp" | ||||||
| #include "../mwworld/inventorystore.hpp" | #include "../mwworld/inventorystore.hpp" | ||||||
| #include "../mwworld/player.hpp" |  | ||||||
| 
 | 
 | ||||||
| #include "interpretercontext.hpp" | #include "interpretercontext.hpp" | ||||||
| #include "ref.hpp" | #include "ref.hpp" | ||||||
|  | @ -55,7 +54,7 @@ namespace MWScript | ||||||
|                     MWWorld::Ptr itemPtr = *ptr.getClass().getContainerStore (ptr).add (item, count, ptr); |                     MWWorld::Ptr itemPtr = *ptr.getClass().getContainerStore (ptr).add (item, count, ptr); | ||||||
| 
 | 
 | ||||||
|                     // Spawn a messagebox (only for items added to player's inventory and if player is talking to someone)
 |                     // Spawn a messagebox (only for items added to player's inventory and if player is talking to someone)
 | ||||||
|                     if (ptr == MWBase::Environment::get().getWorld ()->getPlayer ().getPlayer() ) |                     if (ptr == MWBase::Environment::get().getWorld ()->getPlayerPtr() ) | ||||||
|                     { |                     { | ||||||
|                         // The two GMST entries below expand to strings informing the player of what, and how many of it has been added to their inventory
 |                         // The two GMST entries below expand to strings informing the player of what, and how many of it has been added to their inventory
 | ||||||
|                         std::string msgBox; |                         std::string msgBox; | ||||||
|  | @ -88,15 +87,9 @@ namespace MWScript | ||||||
|                     std::string item = runtime.getStringLiteral (runtime[0].mInteger); |                     std::string item = runtime.getStringLiteral (runtime[0].mInteger); | ||||||
|                     runtime.pop(); |                     runtime.pop(); | ||||||
| 
 | 
 | ||||||
|                     MWWorld::ContainerStore& store = MWWorld::Class::get (ptr).getContainerStore (ptr); |                     MWWorld::ContainerStore& store = ptr.getClass().getContainerStore (ptr); | ||||||
| 
 | 
 | ||||||
|                     Interpreter::Type_Integer sum = 0; |                     runtime.push (store.count(item)); | ||||||
| 
 |  | ||||||
|                     for (MWWorld::ContainerStoreIterator iter (store.begin()); iter!=store.end(); ++iter) |  | ||||||
|                         if (Misc::StringUtils::ciEqual(iter->getCellRef().mRefID, item)) |  | ||||||
|                             sum += iter->getRefData().getCount(); |  | ||||||
| 
 |  | ||||||
|                     runtime.push (sum); |  | ||||||
|                 } |                 } | ||||||
|         }; |         }; | ||||||
| 
 | 
 | ||||||
|  | @ -133,7 +126,7 @@ namespace MWScript | ||||||
| 
 | 
 | ||||||
|                     // Spawn a messagebox (only for items removed from player's inventory)
 |                     // Spawn a messagebox (only for items removed from player's inventory)
 | ||||||
|                     if ((numRemoved > 0) |                     if ((numRemoved > 0) | ||||||
|                         && (ptr == MWBase::Environment::get().getWorld()->getPlayer().getPlayer())) |                         && (ptr == MWBase::Environment::get().getWorld()->getPlayerPtr())) | ||||||
|                     { |                     { | ||||||
|                         // The two GMST entries below expand to strings informing the player of what, and how many of it has been removed from their inventory
 |                         // The two GMST entries below expand to strings informing the player of what, and how many of it has been removed from their inventory
 | ||||||
|                         std::string msgBox; |                         std::string msgBox; | ||||||
|  |  | ||||||
|  | @ -11,7 +11,6 @@ | ||||||
| #include "../mwbase/environment.hpp" | #include "../mwbase/environment.hpp" | ||||||
| #include "../mwbase/inputmanager.hpp" | #include "../mwbase/inputmanager.hpp" | ||||||
| 
 | 
 | ||||||
| #include "../mwworld/player.hpp" |  | ||||||
| #include "../mwworld/class.hpp" | #include "../mwworld/class.hpp" | ||||||
| #include "../mwworld/ptr.hpp" | #include "../mwworld/ptr.hpp" | ||||||
| 
 | 
 | ||||||
|  | @ -144,7 +143,7 @@ namespace MWScript | ||||||
| 
 | 
 | ||||||
|                 virtual void execute (Interpreter::Runtime& runtime) |                 virtual void execute (Interpreter::Runtime& runtime) | ||||||
|                 { |                 { | ||||||
|                     MWWorld::Ptr ptr = MWBase::Environment::get().getWorld ()->getPlayer ().getPlayer(); |                     MWWorld::Ptr ptr = MWBase::Environment::get().getWorld ()->getPlayerPtr(); | ||||||
|                     runtime.push (MWWorld::Class::get(ptr).getStance (ptr, MWWorld::Class::Run)); |                     runtime.push (MWWorld::Class::get(ptr).getStance (ptr, MWWorld::Class::Run)); | ||||||
|                 } |                 } | ||||||
|         }; |         }; | ||||||
|  | @ -155,7 +154,7 @@ namespace MWScript | ||||||
| 
 | 
 | ||||||
|                 virtual void execute (Interpreter::Runtime& runtime) |                 virtual void execute (Interpreter::Runtime& runtime) | ||||||
|                 { |                 { | ||||||
|                     MWWorld::Ptr ptr = MWBase::Environment::get().getWorld ()->getPlayer ().getPlayer(); |                     MWWorld::Ptr ptr = MWBase::Environment::get().getWorld ()->getPlayerPtr(); | ||||||
|                     runtime.push (MWWorld::Class::get(ptr).getStance (ptr, MWWorld::Class::Sneak)); |                     runtime.push (MWWorld::Class::get(ptr).getStance (ptr, MWWorld::Class::Sneak)); | ||||||
|                 } |                 } | ||||||
|         }; |         }; | ||||||
|  |  | ||||||
|  | @ -13,7 +13,6 @@ | ||||||
| #include "../mwbase/journal.hpp" | #include "../mwbase/journal.hpp" | ||||||
| 
 | 
 | ||||||
| #include "../mwworld/class.hpp" | #include "../mwworld/class.hpp" | ||||||
| #include "../mwworld/player.hpp" |  | ||||||
| #include "../mwmechanics/npcstats.hpp" | #include "../mwmechanics/npcstats.hpp" | ||||||
| 
 | 
 | ||||||
| #include "interpretercontext.hpp" | #include "interpretercontext.hpp" | ||||||
|  | @ -183,7 +182,7 @@ namespace MWScript | ||||||
|                 { |                 { | ||||||
|                     MWWorld::Ptr ptr = R()(runtime); |                     MWWorld::Ptr ptr = R()(runtime); | ||||||
| 
 | 
 | ||||||
|                     MWWorld::Ptr player = MWBase::Environment::get().getWorld ()->getPlayer ().getPlayer(); |                     MWWorld::Ptr player = MWBase::Environment::get().getWorld ()->getPlayerPtr(); | ||||||
| 
 | 
 | ||||||
|                     runtime.push (MWWorld::Class::get(ptr).getNpcStats (ptr).isSameFaction (MWWorld::Class::get(player).getNpcStats (player))); |                     runtime.push (MWWorld::Class::get(ptr).getNpcStats (ptr).isSameFaction (MWWorld::Class::get(player).getNpcStats (player))); | ||||||
|                 } |                 } | ||||||
|  |  | ||||||
|  | @ -371,4 +371,9 @@ op 0x2000230: Resurrect, explicit | ||||||
| op 0x2000231: GetSpellReadied | op 0x2000231: GetSpellReadied | ||||||
| op 0x2000232: GetSpellReadied, explicit | op 0x2000232: GetSpellReadied, explicit | ||||||
| op 0x2000233: GetPcJumping | op 0x2000233: GetPcJumping | ||||||
| opcodes 0x2000234-0x3ffffff unused | op 0x2000234: ShowRestMenu, explicit | ||||||
|  | op 0x2000235: GoToJail | ||||||
|  | op 0x2000236: PayFine | ||||||
|  | op 0x2000237: PayFineThief  | ||||||
|  | opcodes 0x2000238-0x3ffffff unused | ||||||
|  | 
 | ||||||
|  |  | ||||||
|  | @ -15,7 +15,10 @@ | ||||||
| #include "../mwbase/environment.hpp" | #include "../mwbase/environment.hpp" | ||||||
| #include "../mwbase/windowmanager.hpp" | #include "../mwbase/windowmanager.hpp" | ||||||
| 
 | 
 | ||||||
|  | #include "../mwbase/mechanicsmanager.hpp" | ||||||
|  | 
 | ||||||
| #include "interpretercontext.hpp" | #include "interpretercontext.hpp" | ||||||
|  | #include "ref.hpp" | ||||||
| 
 | 
 | ||||||
| namespace MWScript | namespace MWScript | ||||||
| { | { | ||||||
|  | @ -45,6 +48,20 @@ namespace MWScript | ||||||
|                 } |                 } | ||||||
|         }; |         }; | ||||||
| 
 | 
 | ||||||
|  |         template <class R> | ||||||
|  |         class OpShowRestMenu : public Interpreter::Opcode0 | ||||||
|  |         { | ||||||
|  |         public: | ||||||
|  |             virtual void execute (Interpreter::Runtime& runtime) | ||||||
|  |             { | ||||||
|  |                 MWWorld::Ptr bed = R()(runtime, false); | ||||||
|  | 
 | ||||||
|  |                 if (bed.isEmpty() || !MWBase::Environment::get().getMechanicsManager()->sleepInBed(MWBase::Environment::get().getWorld()->getPlayerPtr(), | ||||||
|  |                                                                              bed)) | ||||||
|  |                     MWBase::Environment::get().getWindowManager()->pushGuiMode(MWGui::GM_RestBed); | ||||||
|  |             } | ||||||
|  |         }; | ||||||
|  | 
 | ||||||
|         class OpShowDialogue : public Interpreter::Opcode0 |         class OpShowDialogue : public Interpreter::Opcode0 | ||||||
|         { |         { | ||||||
|                 MWGui::GuiMode mDialogue; |                 MWGui::GuiMode mDialogue; | ||||||
|  | @ -172,7 +189,8 @@ namespace MWScript | ||||||
|                 new OpEnableRest ()); |                 new OpEnableRest ()); | ||||||
| 
 | 
 | ||||||
|             interpreter.installSegment5 (Compiler::Gui::opcodeShowRestMenu, |             interpreter.installSegment5 (Compiler::Gui::opcodeShowRestMenu, | ||||||
|                 new OpShowDialogue (MWGui::GM_RestBed)); |                 new OpShowRestMenu<ImplicitRef>); | ||||||
|  |             interpreter.installSegment5 (Compiler::Gui::opcodeShowRestMenuExplicit, new OpShowRestMenu<ExplicitRef>); | ||||||
| 
 | 
 | ||||||
|             interpreter.installSegment5 (Compiler::Gui::opcodeGetButtonPressed, new OpGetButtonPressed); |             interpreter.installSegment5 (Compiler::Gui::opcodeGetButtonPressed, new OpGetButtonPressed); | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -14,7 +14,6 @@ | ||||||
| #include "../mwbase/inputmanager.hpp" | #include "../mwbase/inputmanager.hpp" | ||||||
| 
 | 
 | ||||||
| #include "../mwworld/class.hpp" | #include "../mwworld/class.hpp" | ||||||
| #include "../mwworld/player.hpp" |  | ||||||
| 
 | 
 | ||||||
| #include "../mwmechanics/npcstats.hpp" | #include "../mwmechanics/npcstats.hpp" | ||||||
| 
 | 
 | ||||||
|  | @ -24,7 +23,7 @@ | ||||||
| namespace MWScript | namespace MWScript | ||||||
| { | { | ||||||
|     MWWorld::Ptr InterpreterContext::getReference ( |     MWWorld::Ptr InterpreterContext::getReference ( | ||||||
|         const std::string& id, bool activeOnly) |         const std::string& id, bool activeOnly, bool doThrow) | ||||||
|     { |     { | ||||||
|         if (!id.empty()) |         if (!id.empty()) | ||||||
|         { |         { | ||||||
|  | @ -32,7 +31,7 @@ namespace MWScript | ||||||
|         } |         } | ||||||
|         else |         else | ||||||
|         { |         { | ||||||
|             if (mReference.isEmpty()) |             if (mReference.isEmpty() && doThrow) | ||||||
|                 throw std::runtime_error ("no implicit reference"); |                 throw std::runtime_error ("no implicit reference"); | ||||||
| 
 | 
 | ||||||
|             return mReference; |             return mReference; | ||||||
|  | @ -40,7 +39,7 @@ namespace MWScript | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     const MWWorld::Ptr InterpreterContext::getReference ( |     const MWWorld::Ptr InterpreterContext::getReference ( | ||||||
|         const std::string& id, bool activeOnly) const |         const std::string& id, bool activeOnly, bool doThrow) const | ||||||
|     { |     { | ||||||
|         if (!id.empty()) |         if (!id.empty()) | ||||||
|         { |         { | ||||||
|  | @ -48,7 +47,7 @@ namespace MWScript | ||||||
|         } |         } | ||||||
|         else |         else | ||||||
|         { |         { | ||||||
|             if (mReference.isEmpty()) |             if (mReference.isEmpty() && doThrow) | ||||||
|                 throw std::runtime_error ("no implicit reference"); |                 throw std::runtime_error ("no implicit reference"); | ||||||
| 
 | 
 | ||||||
|             return mReference; |             return mReference; | ||||||
|  | @ -248,28 +247,28 @@ namespace MWScript | ||||||
|     std::string InterpreterContext::getPCName() const |     std::string InterpreterContext::getPCName() const | ||||||
|     { |     { | ||||||
|         MWBase::World *world = MWBase::Environment::get().getWorld(); |         MWBase::World *world = MWBase::Environment::get().getWorld(); | ||||||
|         ESM::NPC player = *world->getPlayer().getPlayer().get<ESM::NPC>()->mBase; |         ESM::NPC player = *world->getPlayerPtr().get<ESM::NPC>()->mBase; | ||||||
|         return player.mName; |         return player.mName; | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     std::string InterpreterContext::getPCRace() const |     std::string InterpreterContext::getPCRace() const | ||||||
|     { |     { | ||||||
|         MWBase::World *world = MWBase::Environment::get().getWorld(); |         MWBase::World *world = MWBase::Environment::get().getWorld(); | ||||||
|         std::string race = world->getPlayer().getPlayer().get<ESM::NPC>()->mBase->mRace; |         std::string race = world->getPlayerPtr().get<ESM::NPC>()->mBase->mRace; | ||||||
|         return world->getStore().get<ESM::Race>().find(race)->mName; |         return world->getStore().get<ESM::Race>().find(race)->mName; | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     std::string InterpreterContext::getPCClass() const |     std::string InterpreterContext::getPCClass() const | ||||||
|     { |     { | ||||||
|         MWBase::World *world = MWBase::Environment::get().getWorld(); |         MWBase::World *world = MWBase::Environment::get().getWorld(); | ||||||
|         std::string class_ = world->getPlayer().getPlayer().get<ESM::NPC>()->mBase->mClass; |         std::string class_ = world->getPlayerPtr().get<ESM::NPC>()->mBase->mClass; | ||||||
|         return world->getStore().get<ESM::Class>().find(class_)->mName; |         return world->getStore().get<ESM::Class>().find(class_)->mName; | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     std::string InterpreterContext::getPCRank() const |     std::string InterpreterContext::getPCRank() const | ||||||
|     { |     { | ||||||
|         MWBase::World *world = MWBase::Environment::get().getWorld(); |         MWBase::World *world = MWBase::Environment::get().getWorld(); | ||||||
|         MWWorld::Ptr player = world->getPlayer().getPlayer(); |         MWWorld::Ptr player = world->getPlayerPtr(); | ||||||
| 
 | 
 | ||||||
|         std::string factionId = MWWorld::Class::get (mReference).getNpcStats (mReference).getFactionRanks().begin()->first; |         std::string factionId = MWWorld::Class::get (mReference).getNpcStats (mReference).getFactionRanks().begin()->first; | ||||||
| 
 | 
 | ||||||
|  | @ -288,7 +287,7 @@ namespace MWScript | ||||||
|     std::string InterpreterContext::getPCNextRank() const |     std::string InterpreterContext::getPCNextRank() const | ||||||
|     { |     { | ||||||
|         MWBase::World *world = MWBase::Environment::get().getWorld(); |         MWBase::World *world = MWBase::Environment::get().getWorld(); | ||||||
|         MWWorld::Ptr player = world->getPlayer().getPlayer(); |         MWWorld::Ptr player = world->getPlayerPtr(); | ||||||
| 
 | 
 | ||||||
|         std::string factionId = MWWorld::Class::get (mReference).getNpcStats (mReference).getFactionRanks().begin()->first; |         std::string factionId = MWWorld::Class::get (mReference).getNpcStats (mReference).getFactionRanks().begin()->first; | ||||||
| 
 | 
 | ||||||
|  | @ -316,7 +315,7 @@ namespace MWScript | ||||||
|     int InterpreterContext::getPCBounty() const |     int InterpreterContext::getPCBounty() const | ||||||
|     { |     { | ||||||
|         MWBase::World *world = MWBase::Environment::get().getWorld(); |         MWBase::World *world = MWBase::Environment::get().getWorld(); | ||||||
|         MWWorld::Ptr player = world->getPlayer().getPlayer(); |         MWWorld::Ptr player = world->getPlayerPtr(); | ||||||
|         return MWWorld::Class::get (player).getNpcStats (player).getBounty(); |         return MWWorld::Class::get (player).getNpcStats (player).getBounty(); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  | @ -387,7 +386,7 @@ namespace MWScript | ||||||
|         if (!mAction.get()) |         if (!mAction.get()) | ||||||
|             throw std::runtime_error ("activation failed, because no action to perform"); |             throw std::runtime_error ("activation failed, because no action to perform"); | ||||||
| 
 | 
 | ||||||
|         mAction->execute (MWBase::Environment::get().getWorld()->getPlayer().getPlayer()); |         mAction->execute (MWBase::Environment::get().getWorld()->getPlayerPtr()); | ||||||
|         mActivationHandled = true; |         mActivationHandled = true; | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  | @ -499,8 +498,8 @@ namespace MWScript | ||||||
|         ptr.getRefData().getLocals().mFloats[index] = value; |         ptr.getRefData().getLocals().mFloats[index] = value; | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     MWWorld::Ptr InterpreterContext::getReference() |     MWWorld::Ptr InterpreterContext::getReference(bool required) | ||||||
|     { |     { | ||||||
|         return getReference ("", true); |         return getReference ("", true, required); | ||||||
|     } |     } | ||||||
| } | } | ||||||
|  |  | ||||||
|  | @ -33,9 +33,9 @@ namespace MWScript | ||||||
|             bool mActivationHandled; |             bool mActivationHandled; | ||||||
|             boost::shared_ptr<MWWorld::Action> mAction; |             boost::shared_ptr<MWWorld::Action> mAction; | ||||||
| 
 | 
 | ||||||
|             MWWorld::Ptr getReference (const std::string& id, bool activeOnly); |             MWWorld::Ptr getReference (const std::string& id, bool activeOnly, bool doThrow=true); | ||||||
| 
 | 
 | ||||||
|             const MWWorld::Ptr getReference (const std::string& id, bool activeOnly) const; |             const MWWorld::Ptr getReference (const std::string& id, bool activeOnly, bool doThrow=true) const; | ||||||
| 
 | 
 | ||||||
|         public: |         public: | ||||||
| 
 | 
 | ||||||
|  | @ -150,7 +150,7 @@ namespace MWScript | ||||||
| 
 | 
 | ||||||
|             virtual void setMemberFloat (const std::string& id, const std::string& name, float value); |             virtual void setMemberFloat (const std::string& id, const std::string& name, float value); | ||||||
| 
 | 
 | ||||||
|             MWWorld::Ptr getReference(); |             MWWorld::Ptr getReference(bool required=true); | ||||||
|             ///< Reference, that the script is running from (can be empty)
 |             ///< Reference, that the script is running from (can be empty)
 | ||||||
|     }; |     }; | ||||||
| } | } | ||||||
|  |  | ||||||
|  | @ -18,7 +18,6 @@ | ||||||
| #include "../mwbase/scriptmanager.hpp" | #include "../mwbase/scriptmanager.hpp" | ||||||
| 
 | 
 | ||||||
| #include "../mwworld/class.hpp" | #include "../mwworld/class.hpp" | ||||||
| #include "../mwworld/player.hpp" |  | ||||||
| #include "../mwworld/containerstore.hpp" | #include "../mwworld/containerstore.hpp" | ||||||
| 
 | 
 | ||||||
| #include "../mwmechanics/npcstats.hpp" | #include "../mwmechanics/npcstats.hpp" | ||||||
|  | @ -65,7 +64,7 @@ namespace MWScript | ||||||
|             virtual void execute (Interpreter::Runtime& runtime) |             virtual void execute (Interpreter::Runtime& runtime) | ||||||
|             { |             { | ||||||
|                 MWBase::World* world = MWBase::Environment::get().getWorld(); |                 MWBase::World* world = MWBase::Environment::get().getWorld(); | ||||||
|                 MWWorld::Ptr player = world->getPlayer().getPlayer(); |                 MWWorld::Ptr player = world->getPlayerPtr(); | ||||||
|                 runtime.push (!world->isOnGround(player) && !world->isFlying(player)); |                 runtime.push (!world->isOnGround(player) && !world->isFlying(player)); | ||||||
|             } |             } | ||||||
|         }; |         }; | ||||||
|  | @ -700,13 +699,11 @@ namespace MWScript | ||||||
|         public: |         public: | ||||||
|             virtual void execute(Interpreter::Runtime& runtime) |             virtual void execute(Interpreter::Runtime& runtime) | ||||||
|             { |             { | ||||||
|                 // No way to tell if we have a reference before trying to get it, and it will
 |                 MWWorld::Ptr ptr = R()(runtime, false); | ||||||
|                 // cause an exception is there isn't one :(
 |                 if (!ptr.isEmpty()) | ||||||
|                 try { |  | ||||||
|                     MWWorld::Ptr ptr = R()(runtime); |  | ||||||
|                     printLocalVars(runtime, ptr); |                     printLocalVars(runtime, ptr); | ||||||
|                 } |                 else | ||||||
|                 catch(std::runtime_error&) { |                 { | ||||||
|                     // No reference, no problem.
 |                     // No reference, no problem.
 | ||||||
|                     printGlobalVars(runtime); |                     printGlobalVars(runtime); | ||||||
|                 } |                 } | ||||||
|  | @ -763,6 +760,43 @@ namespace MWScript | ||||||
|             } |             } | ||||||
|         }; |         }; | ||||||
| 
 | 
 | ||||||
|  |         class OpGoToJail : public Interpreter::Opcode0 | ||||||
|  |         { | ||||||
|  |         public: | ||||||
|  |             virtual void execute (Interpreter::Runtime& runtime) | ||||||
|  |             { | ||||||
|  |                 MWBase::World* world = MWBase::Environment::get().getWorld(); | ||||||
|  |                 MWWorld::Ptr player = world->getPlayerPtr(); | ||||||
|  |                 world->teleportToClosestMarker(player, "prisonmarker"); | ||||||
|  |                 player.getClass().getNpcStats(player).setBounty(0); | ||||||
|  |                 // TODO: pass time, change skills, show messagebox
 | ||||||
|  |                 // TODO: move stolen items to closest evidence chest
 | ||||||
|  |                 // iDaysinPrisonMod
 | ||||||
|  |             } | ||||||
|  |         }; | ||||||
|  | 
 | ||||||
|  |         class OpPayFine : public Interpreter::Opcode0 | ||||||
|  |         { | ||||||
|  |         public: | ||||||
|  |             virtual void execute(Interpreter::Runtime &runtime) | ||||||
|  |             { | ||||||
|  |                 MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr(); | ||||||
|  |                 player.getClass().getNpcStats(player).setBounty(0); | ||||||
|  | 
 | ||||||
|  |                 // TODO: move stolen items to closest evidence chest
 | ||||||
|  |             } | ||||||
|  |         }; | ||||||
|  | 
 | ||||||
|  |         class OpPayFineThief : public Interpreter::Opcode0 | ||||||
|  |         { | ||||||
|  |         public: | ||||||
|  |             virtual void execute(Interpreter::Runtime &runtime) | ||||||
|  |             { | ||||||
|  |                 MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr(); | ||||||
|  |                 player.getClass().getNpcStats(player).setBounty(0); | ||||||
|  |             } | ||||||
|  |         }; | ||||||
|  | 
 | ||||||
|         void installOpcodes (Interpreter::Interpreter& interpreter) |         void installOpcodes (Interpreter::Interpreter& interpreter) | ||||||
|         { |         { | ||||||
|             interpreter.installSegment5 (Compiler::Misc::opcodeXBox, new OpXBox); |             interpreter.installSegment5 (Compiler::Misc::opcodeXBox, new OpXBox); | ||||||
|  | @ -786,6 +820,9 @@ namespace MWScript | ||||||
|             interpreter.installSegment5 (Compiler::Misc::opcodeGetPcJumping, new OpGetPcJumping); |             interpreter.installSegment5 (Compiler::Misc::opcodeGetPcJumping, new OpGetPcJumping); | ||||||
|             interpreter.installSegment5 (Compiler::Misc::opcodeWakeUpPc, new OpWakeUpPc); |             interpreter.installSegment5 (Compiler::Misc::opcodeWakeUpPc, new OpWakeUpPc); | ||||||
|             interpreter.installSegment5 (Compiler::Misc::opcodePlayBink, new OpPlayBink); |             interpreter.installSegment5 (Compiler::Misc::opcodePlayBink, new OpPlayBink); | ||||||
|  |             interpreter.installSegment5 (Compiler::Misc::opcodePayFine, new OpPayFine); | ||||||
|  |             interpreter.installSegment5 (Compiler::Misc::opcodePayFineThief, new OpPayFineThief); | ||||||
|  |             interpreter.installSegment5 (Compiler::Misc::opcodeGoToJail, new OpGoToJail); | ||||||
|             interpreter.installSegment5 (Compiler::Misc::opcodeGetLocked, new OpGetLocked<ImplicitRef>); |             interpreter.installSegment5 (Compiler::Misc::opcodeGetLocked, new OpGetLocked<ImplicitRef>); | ||||||
|             interpreter.installSegment5 (Compiler::Misc::opcodeGetLockedExplicit, new OpGetLocked<ExplicitRef>); |             interpreter.installSegment5 (Compiler::Misc::opcodeGetLockedExplicit, new OpGetLocked<ExplicitRef>); | ||||||
|             interpreter.installSegment5 (Compiler::Misc::opcodeGetEffect, new OpGetEffect<ImplicitRef>); |             interpreter.installSegment5 (Compiler::Misc::opcodeGetEffect, new OpGetEffect<ImplicitRef>); | ||||||
|  |  | ||||||
|  | @ -16,7 +16,7 @@ namespace MWScript | ||||||
| { | { | ||||||
|     struct ExplicitRef |     struct ExplicitRef | ||||||
|     { |     { | ||||||
|         MWWorld::Ptr operator() (Interpreter::Runtime& runtime) const |         MWWorld::Ptr operator() (Interpreter::Runtime& runtime, bool required=true) const | ||||||
|         { |         { | ||||||
|             std::string id = runtime.getStringLiteral (runtime[0].mInteger); |             std::string id = runtime.getStringLiteral (runtime[0].mInteger); | ||||||
|             runtime.pop(); |             runtime.pop(); | ||||||
|  | @ -27,12 +27,12 @@ namespace MWScript | ||||||
| 
 | 
 | ||||||
|     struct ImplicitRef |     struct ImplicitRef | ||||||
|     { |     { | ||||||
|         MWWorld::Ptr operator() (Interpreter::Runtime& runtime) const |         MWWorld::Ptr operator() (Interpreter::Runtime& runtime, bool required=true) const | ||||||
|         { |         { | ||||||
|             MWScript::InterpreterContext& context |             MWScript::InterpreterContext& context | ||||||
|                 = static_cast<MWScript::InterpreterContext&> (runtime.getContext()); |                 = static_cast<MWScript::InterpreterContext&> (runtime.getContext()); | ||||||
| 
 | 
 | ||||||
|             return context.getReference(); |             return context.getReference(required); | ||||||
|         } |         } | ||||||
|     }; |     }; | ||||||
| } | } | ||||||
|  |  | ||||||
|  | @ -114,10 +114,8 @@ namespace MWScript | ||||||
|             } |             } | ||||||
|             catch (const std::exception& e) |             catch (const std::exception& e) | ||||||
|             { |             { | ||||||
|                 std::cerr << "execution of script " << name << " failed." << std::endl; |                 std::cerr << "Execution of script " << name << " failed:" << std::endl; | ||||||
| 
 |                 std::cerr << e.what() << std::endl; | ||||||
|                 if (mVerbose) |  | ||||||
|                     std::cerr << "(" << e.what() << ")" << std::endl; |  | ||||||
| 
 | 
 | ||||||
|                 iter->second.first.clear(); // don't execute again.
 |                 iter->second.first.clear(); // don't execute again.
 | ||||||
|             } |             } | ||||||
|  |  | ||||||
|  | @ -21,7 +21,6 @@ | ||||||
| #include "../mwbase/mechanicsmanager.hpp" | #include "../mwbase/mechanicsmanager.hpp" | ||||||
| 
 | 
 | ||||||
| #include "../mwworld/class.hpp" | #include "../mwworld/class.hpp" | ||||||
| #include "../mwworld/player.hpp" |  | ||||||
| 
 | 
 | ||||||
| #include "../mwmechanics/creaturestats.hpp" | #include "../mwmechanics/creaturestats.hpp" | ||||||
| #include "../mwmechanics/npcstats.hpp" | #include "../mwmechanics/npcstats.hpp" | ||||||
|  | @ -391,7 +390,7 @@ namespace MWScript | ||||||
|                 virtual void execute (Interpreter::Runtime& runtime) |                 virtual void execute (Interpreter::Runtime& runtime) | ||||||
|                 { |                 { | ||||||
|                     MWBase::World *world = MWBase::Environment::get().getWorld(); |                     MWBase::World *world = MWBase::Environment::get().getWorld(); | ||||||
|                     MWWorld::Ptr player = world->getPlayer().getPlayer(); |                     MWWorld::Ptr player = world->getPlayerPtr(); | ||||||
|                     runtime.push (static_cast <Interpreter::Type_Float> (MWWorld::Class::get (player).getNpcStats (player).getBounty())); |                     runtime.push (static_cast <Interpreter::Type_Float> (MWWorld::Class::get (player).getNpcStats (player).getBounty())); | ||||||
|                 } |                 } | ||||||
|         }; |         }; | ||||||
|  | @ -403,7 +402,7 @@ namespace MWScript | ||||||
|                 virtual void execute (Interpreter::Runtime& runtime) |                 virtual void execute (Interpreter::Runtime& runtime) | ||||||
|                 { |                 { | ||||||
|                     MWBase::World *world = MWBase::Environment::get().getWorld(); |                     MWBase::World *world = MWBase::Environment::get().getWorld(); | ||||||
|                     MWWorld::Ptr player = world->getPlayer().getPlayer(); |                     MWWorld::Ptr player = world->getPlayerPtr(); | ||||||
| 
 | 
 | ||||||
|                     MWWorld::Class::get (player).getNpcStats (player).setBounty(runtime[0].mFloat); |                     MWWorld::Class::get (player).getNpcStats (player).setBounty(runtime[0].mFloat); | ||||||
|                     runtime.pop(); |                     runtime.pop(); | ||||||
|  | @ -417,7 +416,7 @@ namespace MWScript | ||||||
|                 virtual void execute (Interpreter::Runtime& runtime) |                 virtual void execute (Interpreter::Runtime& runtime) | ||||||
|                 { |                 { | ||||||
|                     MWBase::World *world = MWBase::Environment::get().getWorld(); |                     MWBase::World *world = MWBase::Environment::get().getWorld(); | ||||||
|                     MWWorld::Ptr player = world->getPlayer().getPlayer(); |                     MWWorld::Ptr player = world->getPlayerPtr(); | ||||||
| 
 | 
 | ||||||
|                     MWWorld::Class::get (player).getNpcStats (player).setBounty(runtime[0].mFloat + MWWorld::Class::get (player).getNpcStats (player).getBounty()); |                     MWWorld::Class::get (player).getNpcStats (player).setBounty(runtime[0].mFloat + MWWorld::Class::get (player).getNpcStats (player).getBounty()); | ||||||
|                     runtime.pop(); |                     runtime.pop(); | ||||||
|  | @ -539,7 +538,7 @@ namespace MWScript | ||||||
|                     Misc::StringUtils::toLower(factionID); |                     Misc::StringUtils::toLower(factionID); | ||||||
|                     if(factionID != "") |                     if(factionID != "") | ||||||
|                     { |                     { | ||||||
|                         MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayer().getPlayer(); |                         MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr(); | ||||||
|                         if(MWWorld::Class::get(player).getNpcStats(player).getFactionRanks().find(factionID) == MWWorld::Class::get(player).getNpcStats(player).getFactionRanks().end()) |                         if(MWWorld::Class::get(player).getNpcStats(player).getFactionRanks().find(factionID) == MWWorld::Class::get(player).getNpcStats(player).getFactionRanks().end()) | ||||||
|                         { |                         { | ||||||
|                             MWWorld::Class::get(player).getNpcStats(player).getFactionRanks()[factionID] = 0; |                             MWWorld::Class::get(player).getNpcStats(player).getFactionRanks()[factionID] = 0; | ||||||
|  | @ -568,7 +567,7 @@ namespace MWScript | ||||||
|                     Misc::StringUtils::toLower(factionID); |                     Misc::StringUtils::toLower(factionID); | ||||||
|                     if(factionID != "") |                     if(factionID != "") | ||||||
|                     { |                     { | ||||||
|                         MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayer().getPlayer(); |                         MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr(); | ||||||
|                         if(MWWorld::Class::get(player).getNpcStats(player).getFactionRanks().find(factionID) == MWWorld::Class::get(player).getNpcStats(player).getFactionRanks().end()) |                         if(MWWorld::Class::get(player).getNpcStats(player).getFactionRanks().find(factionID) == MWWorld::Class::get(player).getNpcStats(player).getFactionRanks().end()) | ||||||
|                         { |                         { | ||||||
|                             MWWorld::Class::get(player).getNpcStats(player).getFactionRanks()[factionID] = 0; |                             MWWorld::Class::get(player).getNpcStats(player).getFactionRanks()[factionID] = 0; | ||||||
|  | @ -601,7 +600,7 @@ namespace MWScript | ||||||
|                     Misc::StringUtils::toLower(factionID); |                     Misc::StringUtils::toLower(factionID); | ||||||
|                     if(factionID != "") |                     if(factionID != "") | ||||||
|                     { |                     { | ||||||
|                         MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayer().getPlayer(); |                         MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr(); | ||||||
|                         if(MWWorld::Class::get(player).getNpcStats(player).getFactionRanks().find(factionID) != MWWorld::Class::get(player).getNpcStats(player).getFactionRanks().end()) |                         if(MWWorld::Class::get(player).getNpcStats(player).getFactionRanks().find(factionID) != MWWorld::Class::get(player).getNpcStats(player).getFactionRanks().end()) | ||||||
|                         { |                         { | ||||||
|                             MWWorld::Class::get(player).getNpcStats(player).getFactionRanks()[factionID] = MWWorld::Class::get(player).getNpcStats(player).getFactionRanks()[factionID] -1; |                             MWWorld::Class::get(player).getNpcStats(player).getFactionRanks()[factionID] = MWWorld::Class::get(player).getNpcStats(player).getFactionRanks()[factionID] -1; | ||||||
|  | @ -637,7 +636,7 @@ namespace MWScript | ||||||
|                         } |                         } | ||||||
|                     } |                     } | ||||||
|                     Misc::StringUtils::toLower(factionID); |                     Misc::StringUtils::toLower(factionID); | ||||||
|                     MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayer().getPlayer(); |                     MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr(); | ||||||
|                     if(factionID!="") |                     if(factionID!="") | ||||||
|                     { |                     { | ||||||
|                         if(MWWorld::Class::get(player).getNpcStats(player).getFactionRanks().find(factionID) != MWWorld::Class::get(player).getNpcStats(player).getFactionRanks().end()) |                         if(MWWorld::Class::get(player).getNpcStats(player).getFactionRanks().find(factionID) != MWWorld::Class::get(player).getNpcStats(player).getFactionRanks().end()) | ||||||
|  | @ -740,7 +739,7 @@ namespace MWScript | ||||||
| 
 | 
 | ||||||
|                     Misc::StringUtils::toLower (factionId); |                     Misc::StringUtils::toLower (factionId); | ||||||
| 
 | 
 | ||||||
|                     MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayer().getPlayer(); |                     MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr(); | ||||||
|                     runtime.push ( |                     runtime.push ( | ||||||
|                         MWWorld::Class::get (player).getNpcStats (player).getFactionReputation (factionId)); |                         MWWorld::Class::get (player).getNpcStats (player).getFactionReputation (factionId)); | ||||||
|                 } |                 } | ||||||
|  | @ -776,7 +775,7 @@ namespace MWScript | ||||||
| 
 | 
 | ||||||
|                     Misc::StringUtils::toLower (factionId); |                     Misc::StringUtils::toLower (factionId); | ||||||
| 
 | 
 | ||||||
|                     MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayer().getPlayer(); |                     MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr(); | ||||||
|                     MWWorld::Class::get (player).getNpcStats (player).setFactionReputation (factionId, value); |                     MWWorld::Class::get (player).getNpcStats (player).setFactionReputation (factionId, value); | ||||||
|                 } |                 } | ||||||
|         }; |         }; | ||||||
|  | @ -811,7 +810,7 @@ namespace MWScript | ||||||
| 
 | 
 | ||||||
|                     Misc::StringUtils::toLower (factionId); |                     Misc::StringUtils::toLower (factionId); | ||||||
| 
 | 
 | ||||||
|                     MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayer().getPlayer(); |                     MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr(); | ||||||
|                     MWWorld::Class::get (player).getNpcStats (player).setFactionReputation (factionId, |                     MWWorld::Class::get (player).getNpcStats (player).setFactionReputation (factionId, | ||||||
|                         MWWorld::Class::get (player).getNpcStats (player).getFactionReputation (factionId)+ |                         MWWorld::Class::get (player).getNpcStats (player).getFactionReputation (factionId)+ | ||||||
|                         value); |                         value); | ||||||
|  | @ -870,7 +869,7 @@ namespace MWScript | ||||||
| 
 | 
 | ||||||
|                 virtual void execute (Interpreter::Runtime& runtime) |                 virtual void execute (Interpreter::Runtime& runtime) | ||||||
|                 { |                 { | ||||||
|                     MWWorld::Ptr ptr = MWBase::Environment::get().getWorld ()->getPlayer ().getPlayer (); |                     MWWorld::Ptr ptr = MWBase::Environment::get().getWorld ()->getPlayerPtr(); | ||||||
| 
 | 
 | ||||||
|                     runtime.push (MWWorld::Class::get(ptr).getNpcStats (ptr).getWerewolfKills ()); |                     runtime.push (MWWorld::Class::get(ptr).getNpcStats (ptr).getWerewolfKills ()); | ||||||
|                 } |                 } | ||||||
|  | @ -903,18 +902,10 @@ namespace MWScript | ||||||
|                         } |                         } | ||||||
|                     } |                     } | ||||||
|                     Misc::StringUtils::toLower(factionID); |                     Misc::StringUtils::toLower(factionID); | ||||||
|                     MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayer().getPlayer(); |                     MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr(); | ||||||
|                     if(factionID!="") |                     if(factionID!="") | ||||||
|                     { |                     { | ||||||
|                         std::set<std::string>& expelled = MWWorld::Class::get(player).getNpcStats(player).getExpelled (); |                         runtime.push(player.getClass().getNpcStats(player).getExpelled(factionID)); | ||||||
|                         if (expelled.find (factionID) != expelled.end()) |  | ||||||
|                         { |  | ||||||
|                             runtime.push(1); |  | ||||||
|                         } |  | ||||||
|                         else |  | ||||||
|                         { |  | ||||||
|                             runtime.push(0); |  | ||||||
|                         } |  | ||||||
|                     } |                     } | ||||||
|                     else |                     else | ||||||
|                     { |                     { | ||||||
|  | @ -930,8 +921,6 @@ namespace MWScript | ||||||
| 
 | 
 | ||||||
|                 virtual void execute (Interpreter::Runtime& runtime, unsigned int arg0) |                 virtual void execute (Interpreter::Runtime& runtime, unsigned int arg0) | ||||||
|                 { |                 { | ||||||
|                     MWWorld::Ptr ptr = R()(runtime); |  | ||||||
| 
 |  | ||||||
|                     std::string factionID = ""; |                     std::string factionID = ""; | ||||||
|                     if(arg0 >0 ) |                     if(arg0 >0 ) | ||||||
|                     { |                     { | ||||||
|  | @ -940,6 +929,7 @@ namespace MWScript | ||||||
|                     } |                     } | ||||||
|                     else |                     else | ||||||
|                     { |                     { | ||||||
|  |                         MWWorld::Ptr ptr = R()(runtime); | ||||||
|                         if(MWWorld::Class::get(ptr).getNpcStats(ptr).getFactionRanks().empty()) |                         if(MWWorld::Class::get(ptr).getNpcStats(ptr).getFactionRanks().empty()) | ||||||
|                         { |                         { | ||||||
|                             factionID = ""; |                             factionID = ""; | ||||||
|  | @ -949,12 +939,10 @@ namespace MWScript | ||||||
|                             factionID = MWWorld::Class::get(ptr).getNpcStats(ptr).getFactionRanks().begin()->first; |                             factionID = MWWorld::Class::get(ptr).getNpcStats(ptr).getFactionRanks().begin()->first; | ||||||
|                         } |                         } | ||||||
|                     } |                     } | ||||||
|                     MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayer().getPlayer(); |                     MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr(); | ||||||
|                     if(factionID!="") |                     if(factionID!="") | ||||||
|                     { |                     { | ||||||
|                         std::set<std::string>& expelled = MWWorld::Class::get(player).getNpcStats(player).getExpelled (); |                         player.getClass().getNpcStats(player).expell(factionID); | ||||||
|                         Misc::StringUtils::toLower(factionID); |  | ||||||
|                         expelled.insert(factionID); |  | ||||||
|                     } |                     } | ||||||
|                 } |                 } | ||||||
|         }; |         }; | ||||||
|  | @ -966,8 +954,6 @@ namespace MWScript | ||||||
| 
 | 
 | ||||||
|                 virtual void execute (Interpreter::Runtime& runtime, unsigned int arg0) |                 virtual void execute (Interpreter::Runtime& runtime, unsigned int arg0) | ||||||
|                 { |                 { | ||||||
|                     MWWorld::Ptr ptr = R()(runtime); |  | ||||||
| 
 |  | ||||||
|                     std::string factionID = ""; |                     std::string factionID = ""; | ||||||
|                     if(arg0 >0 ) |                     if(arg0 >0 ) | ||||||
|                     { |                     { | ||||||
|  | @ -976,6 +962,7 @@ namespace MWScript | ||||||
|                     } |                     } | ||||||
|                     else |                     else | ||||||
|                     { |                     { | ||||||
|  |                         MWWorld::Ptr ptr = R()(runtime); | ||||||
|                         if(MWWorld::Class::get(ptr).getNpcStats(ptr).getFactionRanks().empty()) |                         if(MWWorld::Class::get(ptr).getNpcStats(ptr).getFactionRanks().empty()) | ||||||
|                         { |                         { | ||||||
|                             factionID = ""; |                             factionID = ""; | ||||||
|  | @ -985,13 +972,9 @@ namespace MWScript | ||||||
|                             factionID = MWWorld::Class::get(ptr).getNpcStats(ptr).getFactionRanks().begin()->first; |                             factionID = MWWorld::Class::get(ptr).getNpcStats(ptr).getFactionRanks().begin()->first; | ||||||
|                         } |                         } | ||||||
|                     } |                     } | ||||||
|                     MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayer().getPlayer(); |                     MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr(); | ||||||
|                     if(factionID!="") |                     if(factionID!="") | ||||||
|                     { |                         player.getClass().getNpcStats(player).clearExpelled(factionID); | ||||||
|                         std::set<std::string>& expelled = MWWorld::Class::get(player).getNpcStats(player).getExpelled (); |  | ||||||
|                         Misc::StringUtils::toLower(factionID); |  | ||||||
|                         expelled.erase (factionID); |  | ||||||
|                     } |  | ||||||
|                 } |                 } | ||||||
|         }; |         }; | ||||||
| 
 | 
 | ||||||
|  | @ -1011,7 +994,7 @@ namespace MWScript | ||||||
|                     { |                     { | ||||||
|                         factionID = MWWorld::Class::get(ptr).getNpcStats(ptr).getFactionRanks().begin()->first; |                         factionID = MWWorld::Class::get(ptr).getNpcStats(ptr).getFactionRanks().begin()->first; | ||||||
|                     } |                     } | ||||||
|                     MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayer().getPlayer(); |                     MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr(); | ||||||
| 
 | 
 | ||||||
|                     // no-op when executed on the player
 |                     // no-op when executed on the player
 | ||||||
|                     if (ptr == player) |                     if (ptr == player) | ||||||
|  | @ -1038,7 +1021,7 @@ namespace MWScript | ||||||
|                     { |                     { | ||||||
|                         factionID = MWWorld::Class::get(ptr).getNpcStats(ptr).getFactionRanks().begin()->first; |                         factionID = MWWorld::Class::get(ptr).getNpcStats(ptr).getFactionRanks().begin()->first; | ||||||
|                     } |                     } | ||||||
|                     MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayer().getPlayer(); |                     MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr(); | ||||||
| 
 | 
 | ||||||
|                     // no-op when executed on the player
 |                     // no-op when executed on the player
 | ||||||
|                     if (ptr == player) |                     if (ptr == player) | ||||||
|  |  | ||||||
|  | @ -16,8 +16,8 @@ | ||||||
| #include "../mwbase/environment.hpp" | #include "../mwbase/environment.hpp" | ||||||
| 
 | 
 | ||||||
| #include "../mwworld/class.hpp" | #include "../mwworld/class.hpp" | ||||||
| #include "../mwworld/player.hpp" |  | ||||||
| #include "../mwworld/manualref.hpp" | #include "../mwworld/manualref.hpp" | ||||||
|  | #include "../mwworld/player.hpp" | ||||||
| 
 | 
 | ||||||
| #include "interpretercontext.hpp" | #include "interpretercontext.hpp" | ||||||
| #include "ref.hpp" | #include "ref.hpp" | ||||||
|  | @ -482,7 +482,7 @@ namespace MWScript | ||||||
|                 virtual void execute (Interpreter::Runtime& runtime) |                 virtual void execute (Interpreter::Runtime& runtime) | ||||||
|                 { |                 { | ||||||
|                     MWWorld::Ptr actor = pc |                     MWWorld::Ptr actor = pc | ||||||
|                         ? MWBase::Environment::get().getWorld()->getPlayer().getPlayer() |                         ? MWBase::Environment::get().getWorld()->getPlayerPtr() | ||||||
|                         : R()(runtime); |                         : R()(runtime); | ||||||
| 
 | 
 | ||||||
|                     std::string itemID = runtime.getStringLiteral (runtime[0].mInteger); |                     std::string itemID = runtime.getStringLiteral (runtime[0].mInteger); | ||||||
|  |  | ||||||
|  | @ -8,7 +8,6 @@ | ||||||
| #include "../mwbase/world.hpp" | #include "../mwbase/world.hpp" | ||||||
| 
 | 
 | ||||||
| #include "../mwworld/esmstore.hpp" | #include "../mwworld/esmstore.hpp" | ||||||
| #include "../mwworld/player.hpp" |  | ||||||
| 
 | 
 | ||||||
| #include "sound_output.hpp" | #include "sound_output.hpp" | ||||||
| #include "sound_decoder.hpp" | #include "sound_decoder.hpp" | ||||||
|  | @ -479,7 +478,7 @@ namespace MWSound | ||||||
|         static std::string regionName = ""; |         static std::string regionName = ""; | ||||||
|         static float sTimePassed = 0.0; |         static float sTimePassed = 0.0; | ||||||
|         MWBase::World *world = MWBase::Environment::get().getWorld(); |         MWBase::World *world = MWBase::Environment::get().getWorld(); | ||||||
|         const MWWorld::Ptr player = world->getPlayer().getPlayer(); |         const MWWorld::Ptr player = world->getPlayerPtr(); | ||||||
|         const ESM::Cell *cell = player.getCell()->mCell; |         const ESM::Cell *cell = player.getCell()->mCell; | ||||||
| 
 | 
 | ||||||
|         sTimePassed += duration; |         sTimePassed += duration; | ||||||
|  | @ -547,7 +546,7 @@ namespace MWSound | ||||||
|             startRandomTitle(); |             startRandomTitle(); | ||||||
| 
 | 
 | ||||||
|         MWWorld::Ptr player = |         MWWorld::Ptr player = | ||||||
|             MWBase::Environment::get().getWorld()->getPlayer().getPlayer(); |             MWBase::Environment::get().getWorld()->getPlayerPtr(); | ||||||
|         const ESM::Cell *cell = player.getCell()->mCell; |         const ESM::Cell *cell = player.getCell()->mCell; | ||||||
| 
 | 
 | ||||||
|         Environment env = Env_Normal; |         Environment env = Env_Normal; | ||||||
|  |  | ||||||
|  | @ -24,7 +24,7 @@ namespace MWWorld | ||||||
|         std::pair <int, std::string> result = MWWorld::Class::get (object).canBeEquipped (object, actor); |         std::pair <int, std::string> result = MWWorld::Class::get (object).canBeEquipped (object, actor); | ||||||
| 
 | 
 | ||||||
|         // display error message if the player tried to equip something
 |         // display error message if the player tried to equip something
 | ||||||
|         if (!result.second.empty() && actor == MWBase::Environment::get().getWorld()->getPlayer().getPlayer()) |         if (!result.second.empty() && actor == MWBase::Environment::get().getWorld()->getPlayerPtr()) | ||||||
|             MWBase::Environment::get().getWindowManager()->messageBox(result.second); |             MWBase::Environment::get().getWindowManager()->messageBox(result.second); | ||||||
| 
 | 
 | ||||||
|         switch(result.first) |         switch(result.first) | ||||||
|  | @ -84,7 +84,7 @@ namespace MWWorld | ||||||
|         std::string script = MWWorld::Class::get(object).getScript(object); |         std::string script = MWWorld::Class::get(object).getScript(object); | ||||||
|          |          | ||||||
|         /* Set OnPCEquip Variable on item's script, if the player is equipping it, and it has a script with that variable declared */ |         /* Set OnPCEquip Variable on item's script, if the player is equipping it, and it has a script with that variable declared */ | ||||||
|         if(equipped && actor == MWBase::Environment::get().getWorld()->getPlayer().getPlayer() && script != "") |         if(equipped && actor == MWBase::Environment::get().getWorld()->getPlayerPtr() && script != "") | ||||||
|             object.getRefData().getLocals().setVarByInt(script, "onpcequip", 1); |             object.getRefData().getLocals().setVarByInt(script, "onpcequip", 1); | ||||||
|     } |     } | ||||||
| } | } | ||||||
|  |  | ||||||
|  | @ -34,7 +34,7 @@ namespace MWWorld | ||||||
|             MWBase::Environment::get().getWindowManager()->getBookWindow()->open(getTarget()); |             MWBase::Environment::get().getWindowManager()->getBookWindow()->open(getTarget()); | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|         MWWorld::Ptr player = MWBase::Environment::get().getWorld ()->getPlayer().getPlayer(); |         MWWorld::Ptr player = MWBase::Environment::get().getWorld ()->getPlayerPtr(); | ||||||
|         MWMechanics::NpcStats& npcStats = MWWorld::Class::get(player).getNpcStats (player); |         MWMechanics::NpcStats& npcStats = MWWorld::Class::get(player).getNpcStats (player); | ||||||
| 
 | 
 | ||||||
|         // Skill gain from books
 |         // Skill gain from books
 | ||||||
|  |  | ||||||
|  | @ -63,6 +63,8 @@ namespace | ||||||
|     } |     } | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | const std::string MWWorld::ContainerStore::sGoldId = "gold_001"; | ||||||
|  | 
 | ||||||
| MWWorld::ContainerStore::ContainerStore() : mCachedWeight (0), mWeightUpToDate (false) {} | MWWorld::ContainerStore::ContainerStore() : mCachedWeight (0), mWeightUpToDate (false) {} | ||||||
| 
 | 
 | ||||||
| MWWorld::ContainerStore::~ContainerStore() {} | MWWorld::ContainerStore::~ContainerStore() {} | ||||||
|  | @ -77,6 +79,15 @@ MWWorld::ContainerStoreIterator MWWorld::ContainerStore::end() | ||||||
|     return ContainerStoreIterator (this); |     return ContainerStoreIterator (this); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | int MWWorld::ContainerStore::count(const std::string &id) | ||||||
|  | { | ||||||
|  |     int total=0; | ||||||
|  |     for (MWWorld::ContainerStoreIterator iter (begin()); iter!=end(); ++iter) | ||||||
|  |         if (Misc::StringUtils::ciEqual(iter->getCellRef().mRefID, id)) | ||||||
|  |             total += iter->getRefData().getCount(); | ||||||
|  |     return total; | ||||||
|  | } | ||||||
|  | 
 | ||||||
| void MWWorld::ContainerStore::unstack(const Ptr &ptr, const Ptr& container) | void MWWorld::ContainerStore::unstack(const Ptr &ptr, const Ptr& container) | ||||||
| { | { | ||||||
|     if (ptr.getRefData().getCount() <= 1) |     if (ptr.getRefData().getCount() <= 1) | ||||||
|  | @ -123,7 +134,11 @@ bool MWWorld::ContainerStore::stacks(const Ptr& ptr1, const Ptr& ptr2) | ||||||
| MWWorld::ContainerStoreIterator MWWorld::ContainerStore::add(const std::string &id, int count, const Ptr &actorPtr) | MWWorld::ContainerStoreIterator MWWorld::ContainerStore::add(const std::string &id, int count, const Ptr &actorPtr) | ||||||
| { | { | ||||||
|     MWWorld::ManualRef ref(MWBase::Environment::get().getWorld()->getStore(), id, count); |     MWWorld::ManualRef ref(MWBase::Environment::get().getWorld()->getStore(), id, count); | ||||||
|     return add(ref.getPtr(), count, actorPtr, true); |     // a bit pointless to set owner for the player
 | ||||||
|  |     if (actorPtr.getRefData().getHandle() != "player") | ||||||
|  |         return add(ref.getPtr(), count, actorPtr, true); | ||||||
|  |     else | ||||||
|  |         return add(ref.getPtr(), count, actorPtr, false); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| MWWorld::ContainerStoreIterator MWWorld::ContainerStore::add (const Ptr& itemPtr, int count, const Ptr& actorPtr, bool setOwner) | MWWorld::ContainerStoreIterator MWWorld::ContainerStore::add (const Ptr& itemPtr, int count, const Ptr& actorPtr, bool setOwner) | ||||||
|  | @ -148,7 +163,7 @@ MWWorld::ContainerStoreIterator MWWorld::ContainerStore::add (const Ptr& itemPtr | ||||||
|     { |     { | ||||||
|         CellStore *cell; |         CellStore *cell; | ||||||
| 
 | 
 | ||||||
|         Ptr player = MWBase::Environment::get().getWorld ()->getPlayer().getPlayer(); |         Ptr player = MWBase::Environment::get().getWorld ()->getPlayerPtr(); | ||||||
| 
 | 
 | ||||||
|         if(&(MWWorld::Class::get (player).getContainerStore (player)) == this) |         if(&(MWWorld::Class::get (player).getContainerStore (player)) == this) | ||||||
|         { |         { | ||||||
|  | @ -183,11 +198,13 @@ MWWorld::ContainerStoreIterator MWWorld::ContainerStore::addImp (const Ptr& ptr, | ||||||
|         || Misc::StringUtils::ciEqual(ptr.getCellRef().mRefID, "gold_025") |         || Misc::StringUtils::ciEqual(ptr.getCellRef().mRefID, "gold_025") | ||||||
|         || Misc::StringUtils::ciEqual(ptr.getCellRef().mRefID, "gold_100")) |         || Misc::StringUtils::ciEqual(ptr.getCellRef().mRefID, "gold_100")) | ||||||
|     { |     { | ||||||
|         int realCount = MWWorld::Class::get(ptr).getValue(ptr) * ptr.getRefData().getCount(); |         int realCount = ptr.getRefData().getCount(); | ||||||
|  |         if (ptr.getCellRef().mGoldValue > 1 && realCount == 1) | ||||||
|  |             realCount = ptr.getCellRef().mGoldValue; | ||||||
| 
 | 
 | ||||||
|         for (MWWorld::ContainerStoreIterator iter (begin(type)); iter!=end(); ++iter) |         for (MWWorld::ContainerStoreIterator iter (begin(type)); iter!=end(); ++iter) | ||||||
|         { |         { | ||||||
|             if (Misc::StringUtils::ciEqual((*iter).get<ESM::Miscellaneous>()->mRef.mRefID, "gold_001")) |             if (Misc::StringUtils::ciEqual((*iter).get<ESM::Miscellaneous>()->mRef.mRefID, MWWorld::ContainerStore::sGoldId)) | ||||||
|             { |             { | ||||||
|                 iter->getRefData().setCount(iter->getRefData().getCount() + realCount); |                 iter->getRefData().setCount(iter->getRefData().getCount() + realCount); | ||||||
|                 flagAsModified(); |                 flagAsModified(); | ||||||
|  | @ -195,7 +212,7 @@ MWWorld::ContainerStoreIterator MWWorld::ContainerStore::addImp (const Ptr& ptr, | ||||||
|             } |             } | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|         MWWorld::ManualRef ref(esmStore, "Gold_001", count); |         MWWorld::ManualRef ref(esmStore, MWWorld::ContainerStore::sGoldId, count); | ||||||
|         return addNewStack(ref.getPtr(), count); |         return addNewStack(ref.getPtr(), count); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  | @ -305,8 +322,8 @@ void MWWorld::ContainerStore::addInitialItem (const std::string& id, const std:: | ||||||
|             const ESM::ItemLevList* levItem = ref.getPtr().get<ESM::ItemLevList>()->mBase; |             const ESM::ItemLevList* levItem = ref.getPtr().get<ESM::ItemLevList>()->mBase; | ||||||
|             const std::vector<ESM::LeveledListBase::LevelItem>& items = levItem->mList; |             const std::vector<ESM::LeveledListBase::LevelItem>& items = levItem->mList; | ||||||
| 
 | 
 | ||||||
|             MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayer().getPlayer(); |             MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr(); | ||||||
|             int playerLevel = MWWorld::Class::get(player).getCreatureStats(player).getLevel(); |             int playerLevel = player.getClass().getCreatureStats(player).getLevel(); | ||||||
| 
 | 
 | ||||||
|             failChance += levItem->mChanceNone; |             failChance += levItem->mChanceNone; | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -35,6 +35,8 @@ namespace MWWorld | ||||||
| 
 | 
 | ||||||
|             static const int Type_All = 0xffff; |             static const int Type_All = 0xffff; | ||||||
| 
 | 
 | ||||||
|  |             static const std::string sGoldId; | ||||||
|  | 
 | ||||||
|         private: |         private: | ||||||
| 
 | 
 | ||||||
|             MWWorld::CellRefList<ESM::Potion>            potions; |             MWWorld::CellRefList<ESM::Potion>            potions; | ||||||
|  | @ -92,6 +94,9 @@ namespace MWWorld | ||||||
|             void unstack (const Ptr& ptr, const Ptr& container); |             void unstack (const Ptr& ptr, const Ptr& container); | ||||||
|             ///< Unstack an item in this container. The item's count will be set to 1, then a new stack will be added with (origCount-1).
 |             ///< Unstack an item in this container. The item's count will be set to 1, then a new stack will be added with (origCount-1).
 | ||||||
| 
 | 
 | ||||||
|  |             /// @return How many items with refID \a id are in this container?
 | ||||||
|  |             int count (const std::string& id); | ||||||
|  | 
 | ||||||
|         protected: |         protected: | ||||||
|             ContainerStoreIterator addNewStack (const Ptr& ptr, int count); |             ContainerStoreIterator addNewStack (const Ptr& ptr, int count); | ||||||
|             ///< Add the item to this container (do not try to stack it onto existing items)
 |             ///< Add the item to this container (do not try to stack it onto existing items)
 | ||||||
|  |  | ||||||
|  | @ -166,10 +166,10 @@ namespace MWWorld | ||||||
|     void Scene::playerCellChange(MWWorld::CellStore *cell, const ESM::Position& pos, bool adjustPlayerPos) |     void Scene::playerCellChange(MWWorld::CellStore *cell, const ESM::Position& pos, bool adjustPlayerPos) | ||||||
|     { |     { | ||||||
|         MWBase::World *world = MWBase::Environment::get().getWorld(); |         MWBase::World *world = MWBase::Environment::get().getWorld(); | ||||||
|         MWWorld::Ptr old = world->getPlayer().getPlayer(); |         MWWorld::Ptr old = world->getPlayerPtr(); | ||||||
|         world->getPlayer().setCell(cell); |         world->getPlayer().setCell(cell); | ||||||
| 
 | 
 | ||||||
|         MWWorld::Ptr player = world->getPlayer().getPlayer(); |         MWWorld::Ptr player = world->getPlayerPtr(); | ||||||
|         mRendering.updatePlayerPtr(player); |         mRendering.updatePlayerPtr(player); | ||||||
| 
 | 
 | ||||||
|         if (adjustPlayerPos) { |         if (adjustPlayerPos) { | ||||||
|  | @ -369,14 +369,14 @@ namespace MWWorld | ||||||
|         if(!loadcell) |         if(!loadcell) | ||||||
|         { |         { | ||||||
|             MWBase::World *world = MWBase::Environment::get().getWorld(); |             MWBase::World *world = MWBase::Environment::get().getWorld(); | ||||||
|             world->moveObject(world->getPlayer().getPlayer(), position.pos[0], position.pos[1], position.pos[2]); |             world->moveObject(world->getPlayerPtr(), position.pos[0], position.pos[1], position.pos[2]); | ||||||
| 
 | 
 | ||||||
|             float x = Ogre::Radian(position.rot[0]).valueDegrees(); |             float x = Ogre::Radian(position.rot[0]).valueDegrees(); | ||||||
|             float y = Ogre::Radian(position.rot[1]).valueDegrees(); |             float y = Ogre::Radian(position.rot[1]).valueDegrees(); | ||||||
|             float z = Ogre::Radian(position.rot[2]).valueDegrees(); |             float z = Ogre::Radian(position.rot[2]).valueDegrees(); | ||||||
|             world->rotateObject(world->getPlayer().getPlayer(), x, y, z); |             world->rotateObject(world->getPlayerPtr(), x, y, z); | ||||||
| 
 | 
 | ||||||
|             MWWorld::Class::get(world->getPlayer().getPlayer()).adjustPosition(world->getPlayer().getPlayer()); |             MWWorld::Class::get(world->getPlayerPtr()).adjustPosition(world->getPlayerPtr()); | ||||||
|             world->getFader()->fadeIn(0.5f); |             world->getFader()->fadeIn(0.5f); | ||||||
|             return; |             return; | ||||||
|         } |         } | ||||||
|  |  | ||||||
|  | @ -665,7 +665,7 @@ void WeatherManager::changeWeather(const std::string& region, const unsigned int | ||||||
| 
 | 
 | ||||||
|     mRegionOverrides[Misc::StringUtils::lowerCase(region)] = weather; |     mRegionOverrides[Misc::StringUtils::lowerCase(region)] = weather; | ||||||
| 
 | 
 | ||||||
|     std::string playerRegion = MWBase::Environment::get().getWorld()->getPlayer().getPlayer().getCell()->mCell->mRegion; |     std::string playerRegion = MWBase::Environment::get().getWorld()->getPlayerPtr().getCell()->mCell->mRegion; | ||||||
|     if (Misc::StringUtils::ciEqual(region, playerRegion)) |     if (Misc::StringUtils::ciEqual(region, playerRegion)) | ||||||
|         setWeather(weather); |         setWeather(weather); | ||||||
| } | } | ||||||
|  | @ -696,7 +696,7 @@ void WeatherManager::switchToNextWeather(bool instantly) | ||||||
|     MWBase::World* world = MWBase::Environment::get().getWorld(); |     MWBase::World* world = MWBase::Environment::get().getWorld(); | ||||||
|     if (world->isCellExterior() || world->isCellQuasiExterior()) |     if (world->isCellExterior() || world->isCellQuasiExterior()) | ||||||
|     { |     { | ||||||
|         std::string regionstr = Misc::StringUtils::lowerCase(world->getPlayer().getPlayer().getCell()->mCell->mRegion); |         std::string regionstr = Misc::StringUtils::lowerCase(world->getPlayerPtr().getCell()->mCell->mRegion); | ||||||
| 
 | 
 | ||||||
|         if (mWeatherUpdateTime <= 0 || regionstr != mCurrentRegion) |         if (mWeatherUpdateTime <= 0 || regionstr != mCurrentRegion) | ||||||
|         { |         { | ||||||
|  |  | ||||||
|  | @ -753,16 +753,16 @@ namespace MWWorld | ||||||
| 
 | 
 | ||||||
|     void World::changeToInteriorCell (const std::string& cellName, const ESM::Position& position) |     void World::changeToInteriorCell (const std::string& cellName, const ESM::Position& position) | ||||||
|     { |     { | ||||||
|         removeContainerScripts(getPlayer().getPlayer()); |         removeContainerScripts(getPlayerPtr()); | ||||||
|         mWorldScene->changeToInteriorCell(cellName, position); |         mWorldScene->changeToInteriorCell(cellName, position); | ||||||
|         addContainerScripts(getPlayer().getPlayer(), getPlayer().getPlayer().getCell()); |         addContainerScripts(getPlayerPtr(), getPlayerPtr().getCell()); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     void World::changeToExteriorCell (const ESM::Position& position) |     void World::changeToExteriorCell (const ESM::Position& position) | ||||||
|     { |     { | ||||||
|         removeContainerScripts(getPlayer().getPlayer()); |         removeContainerScripts(getPlayerPtr()); | ||||||
|         mWorldScene->changeToExteriorCell(position); |         mWorldScene->changeToExteriorCell(position); | ||||||
|         addContainerScripts(getPlayer().getPlayer(), getPlayer().getPlayer().getCell()); |         addContainerScripts(getPlayerPtr(), getPlayerPtr().getCell()); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     void World::markCellAsUnchanged() |     void World::markCellAsUnchanged() | ||||||
|  | @ -869,7 +869,7 @@ namespace MWWorld | ||||||
|                     int cellY = newCell.mCell->getGridY(); |                     int cellY = newCell.mCell->getGridY(); | ||||||
|                     mWorldScene->changeCell(cellX, cellY, pos, false); |                     mWorldScene->changeCell(cellX, cellY, pos, false); | ||||||
|                 } |                 } | ||||||
|                 addContainerScripts (getPlayer().getPlayer(), &newCell); |                 addContainerScripts (getPlayerPtr(), &newCell); | ||||||
|             } |             } | ||||||
|             else |             else | ||||||
|             { |             { | ||||||
|  | @ -1493,9 +1493,9 @@ namespace MWWorld | ||||||
|             cell = mCells.getExterior(cellX, cellY); |             cell = mCells.getExterior(cellX, cellY); | ||||||
|         } |         } | ||||||
|         else |         else | ||||||
|             cell = getPlayer().getPlayer().getCell(); |             cell = getPlayerPtr().getCell(); | ||||||
| 
 | 
 | ||||||
|         ESM::Position pos = getPlayer().getPlayer().getRefData().getPosition(); |         ESM::Position pos = getPlayerPtr().getRefData().getPosition(); | ||||||
|         pos.pos[0] = result.second[0]; |         pos.pos[0] = result.second[0]; | ||||||
|         pos.pos[1] = result.second[1]; |         pos.pos[1] = result.second[1]; | ||||||
|         pos.pos[2] = result.second[2]; |         pos.pos[2] = result.second[2]; | ||||||
|  | @ -2035,7 +2035,7 @@ namespace MWWorld | ||||||
| 
 | 
 | ||||||
|         std::string message; |         std::string message; | ||||||
|         bool fail = false; |         bool fail = false; | ||||||
|         bool isPlayer = (actor == getPlayer().getPlayer()); |         bool isPlayer = (actor == getPlayerPtr()); | ||||||
| 
 | 
 | ||||||
|         std::string selectedSpell = stats.getSpells().getSelectedSpell(); |         std::string selectedSpell = stats.getSpells().getSelectedSpell(); | ||||||
| 
 | 
 | ||||||
|  | @ -2273,6 +2273,8 @@ namespace MWWorld | ||||||
| 
 | 
 | ||||||
|     bool World::findInteriorPositionInWorldSpace(MWWorld::CellStore* cell, Ogre::Vector3& result) |     bool World::findInteriorPositionInWorldSpace(MWWorld::CellStore* cell, Ogre::Vector3& result) | ||||||
|     { |     { | ||||||
|  |         if (cell->isExterior()) | ||||||
|  |             return false; | ||||||
|         MWWorld::CellRefList<ESM::Door>& doors = cell->mDoors; |         MWWorld::CellRefList<ESM::Door>& doors = cell->mDoors; | ||||||
|         CellRefList<ESM::Door>::List& refList = doors.mList; |         CellRefList<ESM::Door>::List& refList = doors.mList; | ||||||
| 
 | 
 | ||||||
|  | @ -2293,8 +2295,12 @@ namespace MWWorld | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     void World::teleportToClosestMarker (const MWWorld::Ptr& ptr, |     void World::teleportToClosestMarker (const MWWorld::Ptr& ptr, | ||||||
|                                           const std::string& id, Ogre::Vector3 worldPos) |                                           const std::string& id) | ||||||
|     { |     { | ||||||
|  |         Ogre::Vector3 worldPos; | ||||||
|  |         if (!findInteriorPositionInWorldSpace(ptr.getCell(), worldPos)) | ||||||
|  |             worldPos = mPlayer->getLastKnownExteriorPosition(); | ||||||
|  | 
 | ||||||
|         MWWorld::Ptr closestMarker; |         MWWorld::Ptr closestMarker; | ||||||
|         float closestDistance = FLT_MAX; |         float closestDistance = FLT_MAX; | ||||||
| 
 | 
 | ||||||
|  | @ -2415,4 +2421,30 @@ namespace MWWorld | ||||||
|         // with the Telekinesis effect.
 |         // with the Telekinesis effect.
 | ||||||
|         return feet * 22; |         return feet * 22; | ||||||
|     } |     } | ||||||
|  | 
 | ||||||
|  |     MWWorld::Ptr World::getPlayerPtr() | ||||||
|  |     { | ||||||
|  |         return mPlayer->getPlayer(); | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     void World::updateDialogueGlobals() | ||||||
|  |     { | ||||||
|  |         MWWorld::Ptr player = getPlayerPtr(); | ||||||
|  |         int bounty = player.getClass().getNpcStats(player).getBounty(); | ||||||
|  |         int playerGold = player.getClass().getContainerStore(player).count(ContainerStore::sGoldId); | ||||||
|  | 
 | ||||||
|  |         float fCrimeGoldDiscountMult = getStore().get<ESM::GameSetting>().find("fCrimeGoldDiscountMult")->getFloat(); | ||||||
|  |         float fCrimeGoldTurnInMult = getStore().get<ESM::GameSetting>().find("fCrimeGoldTurnInMult")->getFloat(); | ||||||
|  | 
 | ||||||
|  |         int discount = bounty*fCrimeGoldDiscountMult; | ||||||
|  |         int turnIn = bounty * fCrimeGoldTurnInMult; | ||||||
|  | 
 | ||||||
|  |         mGlobalVariables->setInt("pchascrimegold", (bounty <= playerGold) ? 1 : 0); | ||||||
|  | 
 | ||||||
|  |         mGlobalVariables->setInt("pchasgolddiscount", (discount <= playerGold) ? 1 : 0); | ||||||
|  |         mGlobalVariables->setInt("crimegolddiscount", discount); | ||||||
|  | 
 | ||||||
|  |         mGlobalVariables->setInt("crimegoldturnin", turnIn); | ||||||
|  |         mGlobalVariables->setInt("pchasturnin", (turnIn <= playerGold) ? 1 : 0); | ||||||
|  |     } | ||||||
| } | } | ||||||
|  |  | ||||||
|  | @ -187,6 +187,7 @@ namespace MWWorld | ||||||
|             virtual const Fallback *getFallback() const; |             virtual const Fallback *getFallback() const; | ||||||
| 
 | 
 | ||||||
|             virtual Player& getPlayer(); |             virtual Player& getPlayer(); | ||||||
|  |             virtual MWWorld::Ptr getPlayerPtr(); | ||||||
| 
 | 
 | ||||||
|             virtual const MWWorld::ESMStore& getStore() const; |             virtual const MWWorld::ESMStore& getStore() const; | ||||||
| 
 | 
 | ||||||
|  | @ -521,17 +522,20 @@ namespace MWWorld | ||||||
| 
 | 
 | ||||||
|             virtual bool findInteriorPositionInWorldSpace(MWWorld::CellStore* cell, Ogre::Vector3& result); |             virtual bool findInteriorPositionInWorldSpace(MWWorld::CellStore* cell, Ogre::Vector3& result); | ||||||
| 
 | 
 | ||||||
|             /// Teleports \a ptr to the reference of \a id (e.g. DivineMarker, PrisonMarker, TempleMarker)
 |             /// Teleports \a ptr to the closest reference of \a id (e.g. DivineMarker, PrisonMarker, TempleMarker)
 | ||||||
|             /// closest to \a worldPos.
 |  | ||||||
|             /// @note id must be lower case
 |             /// @note id must be lower case
 | ||||||
|             virtual void teleportToClosestMarker (const MWWorld::Ptr& ptr, |             virtual void teleportToClosestMarker (const MWWorld::Ptr& ptr, | ||||||
|                                                   const std::string& id, Ogre::Vector3 worldPos); |                                                   const std::string& id); | ||||||
| 
 | 
 | ||||||
|             /// List all references (filtered by \a type) detected by \a ptr. The range
 |             /// List all references (filtered by \a type) detected by \a ptr. The range
 | ||||||
|             /// is determined by the current magnitude of the "Detect X" magic effect belonging to \a type.
 |             /// is determined by the current magnitude of the "Detect X" magic effect belonging to \a type.
 | ||||||
|             /// @note This also works for references in containers.
 |             /// @note This also works for references in containers.
 | ||||||
|             virtual void listDetectedReferences (const MWWorld::Ptr& ptr, std::vector<MWWorld::Ptr>& out, |             virtual void listDetectedReferences (const MWWorld::Ptr& ptr, std::vector<MWWorld::Ptr>& out, | ||||||
|                                                   DetectionType type); |                                                   DetectionType type); | ||||||
|  | 
 | ||||||
|  |             /// Update the value of some globals according to the world state, which may be used by dialogue entries.
 | ||||||
|  |             /// This should be called when initiating a dialogue.
 | ||||||
|  |             virtual void updateDialogueGlobals(); | ||||||
|     }; |     }; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -198,7 +198,7 @@ namespace Compiler | ||||||
|             extensions.registerInstruction ("enablerest", "", opcodeEnableRest); |             extensions.registerInstruction ("enablerest", "", opcodeEnableRest); | ||||||
|             extensions.registerInstruction ("enablelevelupmenu", "", opcodeEnableRest); |             extensions.registerInstruction ("enablelevelupmenu", "", opcodeEnableRest); | ||||||
| 
 | 
 | ||||||
|             extensions.registerInstruction ("showrestmenu", "", opcodeShowRestMenu); |             extensions.registerInstruction ("showrestmenu", "", opcodeShowRestMenu, opcodeShowRestMenuExplicit); | ||||||
| 
 | 
 | ||||||
|             extensions.registerFunction ("getbuttonpressed", 'l', "", opcodeGetButtonPressed); |             extensions.registerFunction ("getbuttonpressed", 'l', "", opcodeGetButtonPressed); | ||||||
| 
 | 
 | ||||||
|  | @ -244,6 +244,9 @@ namespace Compiler | ||||||
|             extensions.registerFunction ("getpcjumping", 'l', "", opcodeGetPcJumping); |             extensions.registerFunction ("getpcjumping", 'l', "", opcodeGetPcJumping); | ||||||
|             extensions.registerInstruction ("wakeuppc", "", opcodeWakeUpPc); |             extensions.registerInstruction ("wakeuppc", "", opcodeWakeUpPc); | ||||||
|             extensions.registerInstruction ("playbink", "Sl", opcodePlayBink); |             extensions.registerInstruction ("playbink", "Sl", opcodePlayBink); | ||||||
|  |             extensions.registerInstruction ("payfine", "", opcodePayFine); | ||||||
|  |             extensions.registerInstruction ("payfinethief", "", opcodePayFineThief); | ||||||
|  |             extensions.registerInstruction ("gotojail", "", opcodeGoToJail); | ||||||
|             extensions.registerFunction ("getlocked", 'l', "", opcodeGetLocked, opcodeGetLockedExplicit); |             extensions.registerFunction ("getlocked", 'l', "", opcodeGetLocked, opcodeGetLockedExplicit); | ||||||
|             extensions.registerFunction ("geteffect", 'l', "S", opcodeGetEffect, opcodeGetEffectExplicit); |             extensions.registerFunction ("geteffect", 'l', "S", opcodeGetEffect, opcodeGetEffectExplicit); | ||||||
|             extensions.registerInstruction ("addsoulgem", "cc", opcodeAddSoulGem, opcodeAddSoulGemExplicit); |             extensions.registerInstruction ("addsoulgem", "cc", opcodeAddSoulGem, opcodeAddSoulGemExplicit); | ||||||
|  |  | ||||||
|  | @ -161,6 +161,7 @@ namespace Compiler | ||||||
|         const int opcodeEnableStatsMenu = 0x2000016; |         const int opcodeEnableStatsMenu = 0x2000016; | ||||||
|         const int opcodeEnableRest = 0x2000017; |         const int opcodeEnableRest = 0x2000017; | ||||||
|         const int opcodeShowRestMenu = 0x2000018; |         const int opcodeShowRestMenu = 0x2000018; | ||||||
|  |         const int opcodeShowRestMenuExplicit = 0x2000234; | ||||||
|         const int opcodeGetButtonPressed = 0x2000137; |         const int opcodeGetButtonPressed = 0x2000137; | ||||||
|         const int opcodeToggleFogOfWar = 0x2000145; |         const int opcodeToggleFogOfWar = 0x2000145; | ||||||
|         const int opcodeToggleFullHelp = 0x2000151; |         const int opcodeToggleFullHelp = 0x2000151; | ||||||
|  | @ -222,6 +223,9 @@ namespace Compiler | ||||||
|         const int opcodeGetStandingActorExplicit = 0x200020f; |         const int opcodeGetStandingActorExplicit = 0x200020f; | ||||||
|         const int opcodeGetWindSpeed = 0x2000212; |         const int opcodeGetWindSpeed = 0x2000212; | ||||||
|         const int opcodePlayBink = 0x20001f7; |         const int opcodePlayBink = 0x20001f7; | ||||||
|  |         const int opcodeGoToJail = 0x2000235; | ||||||
|  |         const int opcodePayFine = 0x2000236; | ||||||
|  |         const int opcodePayFineThief = 0x2000237; | ||||||
|         const int opcodeHitOnMe = 0x2000213; |         const int opcodeHitOnMe = 0x2000213; | ||||||
|         const int opcodeHitOnMeExplicit = 0x2000214; |         const int opcodeHitOnMeExplicit = 0x2000214; | ||||||
|         const int opcodeDisableTeleporting = 0x2000215; |         const int opcodeDisableTeleporting = 0x2000215; | ||||||
|  |  | ||||||
|  | @ -17,14 +17,6 @@ | ||||||
|         <BasisSkin type="SimpleText" offset="0 0 16 16" align="Stretch"/> |         <BasisSkin type="SimpleText" offset="0 0 16 16" align="Stretch"/> | ||||||
|     </Skin> |     </Skin> | ||||||
| 
 | 
 | ||||||
|     <!-- HTML colour: #9A9074 --> |  | ||||||
|     <Skin name="SandTextGreyedOut" size="16 16"> |  | ||||||
|         <Property key="FontName" value="Default"/> |  | ||||||
|         <Property key="TextAlign" value="Left Bottom"/> |  | ||||||
|         <Property key="TextColour" value="0.6 0.56 0.45"/> |  | ||||||
|         <BasisSkin type="SimpleText" offset="0 0 16 16" align="Stretch"/> |  | ||||||
|     </Skin> |  | ||||||
| 
 |  | ||||||
|     <!-- HTML colour: #BF9959 --> |     <!-- HTML colour: #BF9959 --> | ||||||
|     <Skin name="SandText" size="16 16"> |     <Skin name="SandText" size="16 16"> | ||||||
|         <Property key="FontName" value="Default"/> |         <Property key="FontName" value="Default"/> | ||||||
|  |  | ||||||
		Loading…
	
		Reference in a new issue