mirror of
				https://github.com/OpenMW/openmw.git
				synced 2025-11-04 13:26:44 +00:00 
			
		
		
		
	Merge branch 'messageboxes'
This commit is contained in:
		
						commit
						51fce62b69
					
				
					 4 changed files with 52 additions and 8 deletions
				
			
		| 
						 | 
					@ -370,6 +370,11 @@ void DialogueWindow::addText(std::string text)
 | 
				
			||||||
    mHistory->addDialogText("#B29154"+parseText(text)+"#B29154");
 | 
					    mHistory->addDialogText("#B29154"+parseText(text)+"#B29154");
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void DialogueWindow::addMessageBox(std::string text)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    mHistory->addDialogText("\n#FFFFFF"+text+"#B29154");
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void DialogueWindow::addTitle(std::string text)
 | 
					void DialogueWindow::addTitle(std::string text)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    // This is called from the dialogue manager, so text is
 | 
					    // This is called from the dialogue manager, so text is
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -65,6 +65,7 @@ namespace MWGui
 | 
				
			||||||
        void setKeywords(std::list<std::string> keyWord);
 | 
					        void setKeywords(std::list<std::string> keyWord);
 | 
				
			||||||
        void removeKeyword(std::string keyWord);
 | 
					        void removeKeyword(std::string keyWord);
 | 
				
			||||||
        void addText(std::string text);
 | 
					        void addText(std::string text);
 | 
				
			||||||
 | 
					        void addMessageBox(std::string text);
 | 
				
			||||||
        void addTitle(std::string text);
 | 
					        void addTitle(std::string text);
 | 
				
			||||||
        void askQuestion(std::string question);
 | 
					        void askQuestion(std::string question);
 | 
				
			||||||
        void goodbye();
 | 
					        void goodbye();
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -537,6 +537,11 @@ void WindowManager::removeDialog(OEngine::GUI::Layout*dialog)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void WindowManager::messageBox (const std::string& message, const std::vector<std::string>& buttons)
 | 
					void WindowManager::messageBox (const std::string& message, const std::vector<std::string>& buttons)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 | 
					    /* If there are no buttons, and there is a dialogue window open, messagebox goes to the dialogue window */
 | 
				
			||||||
 | 
					    if(buttons.empty() && std::find(mGuiModes.begin(), mGuiModes.end(), GM_Dialogue) != mGuiModes.end())
 | 
				
			||||||
 | 
					       mDialogueWindow->addMessageBox(MyGUI::LanguageManager::getInstance().replaceTags(message));
 | 
				
			||||||
 | 
					    
 | 
				
			||||||
 | 
					    else{
 | 
				
			||||||
        if (buttons.empty())
 | 
					        if (buttons.empty())
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            mMessageBoxManager->createMessageBox(message);
 | 
					            mMessageBoxManager->createMessageBox(message);
 | 
				
			||||||
| 
						 | 
					@ -546,6 +551,7 @@ void WindowManager::messageBox (const std::string& message, const std::vector<st
 | 
				
			||||||
            mMessageBoxManager->createInteractiveMessageBox(message, buttons);
 | 
					            mMessageBoxManager->createInteractiveMessageBox(message, buttons);
 | 
				
			||||||
            pushGuiMode(GM_InterMessageBox);
 | 
					            pushGuiMode(GM_InterMessageBox);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
int WindowManager::readPressedButton ()
 | 
					int WindowManager::readPressedButton ()
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -10,6 +10,7 @@
 | 
				
			||||||
#include <components/interpreter/opcodes.hpp>
 | 
					#include <components/interpreter/opcodes.hpp>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include "../mwbase/environment.hpp"
 | 
					#include "../mwbase/environment.hpp"
 | 
				
			||||||
 | 
					#include "../mwbase/windowmanager.hpp"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include "../mwworld/manualref.hpp"
 | 
					#include "../mwworld/manualref.hpp"
 | 
				
			||||||
#include "../mwworld/class.hpp"
 | 
					#include "../mwworld/class.hpp"
 | 
				
			||||||
| 
						 | 
					@ -107,11 +108,40 @@ namespace MWScript
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                    MWWorld::ContainerStore& store = MWWorld::Class::get (ptr).getContainerStore (ptr);
 | 
					                    MWWorld::ContainerStore& store = MWWorld::Class::get (ptr).getContainerStore (ptr);
 | 
				
			||||||
                    
 | 
					                    
 | 
				
			||||||
 | 
					                    std::string itemName = "";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                    for (MWWorld::ContainerStoreIterator iter (store.begin()); iter!=store.end() && count;
 | 
					                    for (MWWorld::ContainerStoreIterator iter (store.begin()); iter!=store.end() && count;
 | 
				
			||||||
                        ++iter)
 | 
					                        ++iter)
 | 
				
			||||||
                    {
 | 
					                    {
 | 
				
			||||||
                        if (toLower(iter->getCellRef().mRefID) == toLower(item))
 | 
					                        if (toLower(iter->getCellRef().mRefID) == toLower(item))
 | 
				
			||||||
                        {
 | 
					                        {
 | 
				
			||||||
 | 
					                            switch(iter.getType()){
 | 
				
			||||||
 | 
					                                case MWWorld::ContainerStore::Type_Potion:
 | 
				
			||||||
 | 
					                                    itemName = iter->get<ESM::Potion>()->mBase->mName; break;
 | 
				
			||||||
 | 
					                                case MWWorld::ContainerStore::Type_Apparatus:
 | 
				
			||||||
 | 
					                                    itemName = iter->get<ESM::Apparatus>()->mBase->mName; break;
 | 
				
			||||||
 | 
					                                case MWWorld::ContainerStore::Type_Armor:
 | 
				
			||||||
 | 
					                                    itemName = iter->get<ESM::Armor>()->mBase->mName; break;
 | 
				
			||||||
 | 
					                                case MWWorld::ContainerStore::Type_Book:
 | 
				
			||||||
 | 
					                                    itemName = iter->get<ESM::Book>()->mBase->mName; break;
 | 
				
			||||||
 | 
					                                case MWWorld::ContainerStore::Type_Clothing:
 | 
				
			||||||
 | 
					                                    itemName = iter->get<ESM::Clothing>()->mBase->mName; break;
 | 
				
			||||||
 | 
					                                case MWWorld::ContainerStore::Type_Ingredient:
 | 
				
			||||||
 | 
					                                    itemName = iter->get<ESM::Ingredient>()->mBase->mName; break;
 | 
				
			||||||
 | 
					                                case MWWorld::ContainerStore::Type_Light:
 | 
				
			||||||
 | 
					                                    itemName = iter->get<ESM::Light>()->mBase->mName; break;
 | 
				
			||||||
 | 
					                                case MWWorld::ContainerStore::Type_Lockpick:
 | 
				
			||||||
 | 
					                                    itemName = iter->get<ESM::Tool>()->mBase->mName; break;
 | 
				
			||||||
 | 
					                                case MWWorld::ContainerStore::Type_Miscellaneous:
 | 
				
			||||||
 | 
					                                    itemName = iter->get<ESM::Miscellaneous>()->mBase->mName; break;
 | 
				
			||||||
 | 
					                                case MWWorld::ContainerStore::Type_Probe:
 | 
				
			||||||
 | 
					                                    itemName = iter->get<ESM::Probe>()->mBase->mName; break;
 | 
				
			||||||
 | 
					                                case MWWorld::ContainerStore::Type_Repair:
 | 
				
			||||||
 | 
					                                    itemName = iter->get<ESM::Repair>()->mBase->mName; break;
 | 
				
			||||||
 | 
					                                case MWWorld::ContainerStore::Type_Weapon:
 | 
				
			||||||
 | 
					                                    itemName = iter->get<ESM::Weapon>()->mBase->mName; break;
 | 
				
			||||||
 | 
					                            }
 | 
				
			||||||
 | 
					                            
 | 
				
			||||||
                            if (iter->getRefData().getCount()<=count)
 | 
					                            if (iter->getRefData().getCount()<=count)
 | 
				
			||||||
                            {
 | 
					                            {
 | 
				
			||||||
                                count -= iter->getRefData().getCount();
 | 
					                                count -= iter->getRefData().getCount();
 | 
				
			||||||
| 
						 | 
					@ -125,6 +155,8 @@ namespace MWScript
 | 
				
			||||||
                        }
 | 
					                        }
 | 
				
			||||||
                    }
 | 
					                    }
 | 
				
			||||||
                    
 | 
					                    
 | 
				
			||||||
 | 
					                    MWBase::Environment::get().getWindowManager()->messageBox(itemName + " has been removed from your inventory.", std::vector<std::string>());
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                    // To be fully compatible with original Morrowind, we would need to check if
 | 
					                    // To be fully compatible with original Morrowind, we would need to check if
 | 
				
			||||||
                    // count is >= 0 here and throw an exception. But let's be tollerant instead.
 | 
					                    // count is >= 0 here and throw an exception. But let's be tollerant instead.
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue