mirror of
				https://github.com/OpenMW/openmw.git
				synced 2025-11-04 00:26:39 +00:00 
			
		
		
		
	Merge branch 'master' of https://github.com/zinnschlag/openmw
This commit is contained in:
		
						commit
						ec7e7e3f8b
					
				
					 5 changed files with 62 additions and 45 deletions
				
			
		| 
						 | 
				
			
			@ -223,50 +223,60 @@ void DialogueWindow::onByeClicked(MyGUI::Widget* _sender)
 | 
			
		|||
    MWBase::Environment::get().getDialogueManager()->goodbyeSelected();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void DialogueWindow::onSelectTopic(std::string topic)
 | 
			
		||||
void DialogueWindow::onSelectTopic(const std::string& topic, int id)
 | 
			
		||||
{
 | 
			
		||||
    if (!mEnabled) return;
 | 
			
		||||
 | 
			
		||||
    const MWWorld::Store<ESM::GameSetting> &gmst =
 | 
			
		||||
        MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>();
 | 
			
		||||
    int separatorPos = mTopicsList->getItemCount();
 | 
			
		||||
    for (unsigned int i=0; i<mTopicsList->getItemCount(); ++i)
 | 
			
		||||
    {
 | 
			
		||||
        if (mTopicsList->getItemNameAt(i) == "")
 | 
			
		||||
            separatorPos = i;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if (topic == gmst.find("sBarter")->getString())
 | 
			
		||||
    {
 | 
			
		||||
        /// \todo check if the player is allowed to trade with this actor (e.g. faction rank high enough)?
 | 
			
		||||
        mWindowManager.pushGuiMode(GM_Barter);
 | 
			
		||||
        mWindowManager.getTradeWindow()->startTrade(mPtr);
 | 
			
		||||
    }
 | 
			
		||||
    if (topic == gmst.find("sPersuasion")->getString())
 | 
			
		||||
    {
 | 
			
		||||
        mPersuasionDialog.setVisible(true);
 | 
			
		||||
    }
 | 
			
		||||
    else if (topic == gmst.find("sSpells")->getString())
 | 
			
		||||
    {
 | 
			
		||||
        mWindowManager.pushGuiMode(GM_SpellBuying);
 | 
			
		||||
        mWindowManager.getSpellBuyingWindow()->startSpellBuying(mPtr);
 | 
			
		||||
    }
 | 
			
		||||
    else if (topic == gmst.find("sTravel")->getString())
 | 
			
		||||
    {
 | 
			
		||||
        mWindowManager.pushGuiMode(GM_Travel);
 | 
			
		||||
        mWindowManager.getTravelWindow()->startTravel(mPtr);
 | 
			
		||||
    }
 | 
			
		||||
    else if (topic == gmst.find("sSpellMakingMenuTitle")->getString())
 | 
			
		||||
    {
 | 
			
		||||
        mWindowManager.pushGuiMode(GM_SpellCreation);
 | 
			
		||||
        mWindowManager.startSpellMaking (mPtr);
 | 
			
		||||
    }
 | 
			
		||||
    else if (topic == gmst.find("sEnchanting")->getString())
 | 
			
		||||
    {
 | 
			
		||||
        mWindowManager.pushGuiMode(GM_Enchanting);
 | 
			
		||||
        mWindowManager.startEnchanting (mPtr);
 | 
			
		||||
    }
 | 
			
		||||
    else if (topic == gmst.find("sServiceTrainingTitle")->getString())
 | 
			
		||||
    {
 | 
			
		||||
        mWindowManager.pushGuiMode(GM_Training);
 | 
			
		||||
        mWindowManager.startTraining (mPtr);
 | 
			
		||||
    }
 | 
			
		||||
    else
 | 
			
		||||
    if (id > separatorPos)
 | 
			
		||||
        MWBase::Environment::get().getDialogueManager()->keywordSelected(lower_string(topic));
 | 
			
		||||
    else
 | 
			
		||||
    {
 | 
			
		||||
        const MWWorld::Store<ESM::GameSetting> &gmst =
 | 
			
		||||
            MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>();
 | 
			
		||||
 | 
			
		||||
        if (topic == gmst.find("sBarter")->getString())
 | 
			
		||||
        {
 | 
			
		||||
            /// \todo check if the player is allowed to trade with this actor (e.g. faction rank high enough)?
 | 
			
		||||
            mWindowManager.pushGuiMode(GM_Barter);
 | 
			
		||||
            mWindowManager.getTradeWindow()->startTrade(mPtr);
 | 
			
		||||
        }
 | 
			
		||||
        if (topic == gmst.find("sPersuasion")->getString())
 | 
			
		||||
        {
 | 
			
		||||
            mPersuasionDialog.setVisible(true);
 | 
			
		||||
        }
 | 
			
		||||
        else if (topic == gmst.find("sSpells")->getString())
 | 
			
		||||
        {
 | 
			
		||||
            mWindowManager.pushGuiMode(GM_SpellBuying);
 | 
			
		||||
            mWindowManager.getSpellBuyingWindow()->startSpellBuying(mPtr);
 | 
			
		||||
        }
 | 
			
		||||
        else if (topic == gmst.find("sTravel")->getString())
 | 
			
		||||
        {
 | 
			
		||||
            mWindowManager.pushGuiMode(GM_Travel);
 | 
			
		||||
            mWindowManager.getTravelWindow()->startTravel(mPtr);
 | 
			
		||||
        }
 | 
			
		||||
        else if (topic == gmst.find("sSpellMakingMenuTitle")->getString())
 | 
			
		||||
        {
 | 
			
		||||
            mWindowManager.pushGuiMode(GM_SpellCreation);
 | 
			
		||||
            mWindowManager.startSpellMaking (mPtr);
 | 
			
		||||
        }
 | 
			
		||||
        else if (topic == gmst.find("sEnchanting")->getString())
 | 
			
		||||
        {
 | 
			
		||||
            mWindowManager.pushGuiMode(GM_Enchanting);
 | 
			
		||||
            mWindowManager.startEnchanting (mPtr);
 | 
			
		||||
        }
 | 
			
		||||
        else if (topic == gmst.find("sServiceTrainingTitle")->getString())
 | 
			
		||||
        {
 | 
			
		||||
            mWindowManager.pushGuiMode(GM_Training);
 | 
			
		||||
            mWindowManager.startTraining (mPtr);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void DialogueWindow::startDialogue(MWWorld::Ptr actor, std::string npcName)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -85,7 +85,7 @@ namespace MWGui
 | 
			
		|||
        };
 | 
			
		||||
 | 
			
		||||
    protected:
 | 
			
		||||
        void onSelectTopic(std::string topic);
 | 
			
		||||
        void onSelectTopic(const std::string& topic, int id);
 | 
			
		||||
        void onByeClicked(MyGUI::Widget* _sender);
 | 
			
		||||
        void onHistoryClicked(MyGUI::Widget* _sender);
 | 
			
		||||
        void onMouseWheel(MyGUI::Widget* _sender, int _rel);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -56,6 +56,7 @@ void MWList::redraw(bool scrollbarShown)
 | 
			
		|||
    }
 | 
			
		||||
 | 
			
		||||
    mItemHeight = 0;
 | 
			
		||||
    int i=0;
 | 
			
		||||
    for (std::vector<std::string>::const_iterator it=mItems.begin();
 | 
			
		||||
        it!=mItems.end(); ++it)
 | 
			
		||||
    {
 | 
			
		||||
| 
						 | 
				
			
			@ -72,6 +73,7 @@ void MWList::redraw(bool scrollbarShown)
 | 
			
		|||
 | 
			
		||||
            int height = button->getTextSize().height;
 | 
			
		||||
            button->setSize(MyGUI::IntSize(button->getSize().width, height));
 | 
			
		||||
            button->setUserData(i);
 | 
			
		||||
 | 
			
		||||
            mItemHeight += height + spacing;
 | 
			
		||||
        }
 | 
			
		||||
| 
						 | 
				
			
			@ -84,6 +86,7 @@ void MWList::redraw(bool scrollbarShown)
 | 
			
		|||
 | 
			
		||||
            mItemHeight += 18 + spacing;
 | 
			
		||||
        }
 | 
			
		||||
        ++i;
 | 
			
		||||
    }
 | 
			
		||||
    mScrollView->setCanvasSize(mClient->getSize().width + (_scrollBarWidth-scrollBarWidth), std::max(mItemHeight, mClient->getSize().height));
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -135,8 +138,8 @@ void MWList::onMouseWheel(MyGUI::Widget* _sender, int _rel)
 | 
			
		|||
void MWList::onItemSelected(MyGUI::Widget* _sender)
 | 
			
		||||
{
 | 
			
		||||
    std::string name = static_cast<MyGUI::Button*>(_sender)->getCaption();
 | 
			
		||||
 | 
			
		||||
    eventItemSelected(name);
 | 
			
		||||
    int id = *_sender->getUserData<int>();
 | 
			
		||||
    eventItemSelected(name, id);
 | 
			
		||||
    eventWidgetSelected(_sender);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -30,14 +30,14 @@ namespace MWGui
 | 
			
		|||
        public:
 | 
			
		||||
            MWList();
 | 
			
		||||
 | 
			
		||||
            typedef MyGUI::delegates::CMultiDelegate1<std::string> EventHandle_String;
 | 
			
		||||
            typedef MyGUI::delegates::CMultiDelegate2<const std::string&, int> EventHandle_StringInt;
 | 
			
		||||
            typedef MyGUI::delegates::CMultiDelegate1<MyGUI::Widget*> EventHandle_Widget;
 | 
			
		||||
 | 
			
		||||
            /**
 | 
			
		||||
             * Event: Item selected with the mouse.
 | 
			
		||||
             * signature: void method(std::string itemName)
 | 
			
		||||
             */
 | 
			
		||||
            EventHandle_String eventItemSelected;
 | 
			
		||||
            EventHandle_StringInt eventItemSelected;
 | 
			
		||||
 | 
			
		||||
            /**
 | 
			
		||||
             * Event: Item selected with the mouse.
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -144,7 +144,11 @@ void MWMechanics::Alchemy::updateEffects()
 | 
			
		|||
            MWBase::Environment::get().getWorld()->getStore().get<ESM::MagicEffect>().find (iter->mId);         
 | 
			
		||||
        
 | 
			
		||||
        if (magicEffect->mData.mBaseCost<=0)
 | 
			
		||||
            throw std::runtime_error ("invalid base cost for magic effect " + iter->mId);
 | 
			
		||||
        {
 | 
			
		||||
            std::ostringstream os;
 | 
			
		||||
            os << "invalid base cost for magic effect " << iter->mId;
 | 
			
		||||
            throw std::runtime_error (os.str());
 | 
			
		||||
        }
 | 
			
		||||
        
 | 
			
		||||
        float fPotionT1MagMul =
 | 
			
		||||
            MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>().find ("fPotionT1MagMult")->getFloat();
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in a new issue