forked from mirror/openmw-tes3mp
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");
|
||||
}
|
||||
|
||||
void DialogueWindow::addMessageBox(std::string text)
|
||||
{
|
||||
mHistory->addDialogText("\n#FFFFFF"+text+"#B29154");
|
||||
}
|
||||
|
||||
void DialogueWindow::addTitle(std::string text)
|
||||
{
|
||||
// This is called from the dialogue manager, so text is
|
||||
|
|
|
@ -65,6 +65,7 @@ namespace MWGui
|
|||
void setKeywords(std::list<std::string> keyWord);
|
||||
void removeKeyword(std::string keyWord);
|
||||
void addText(std::string text);
|
||||
void addMessageBox(std::string text);
|
||||
void addTitle(std::string text);
|
||||
void askQuestion(std::string question);
|
||||
void goodbye();
|
||||
|
|
|
@ -537,14 +537,20 @@ void WindowManager::removeDialog(OEngine::GUI::Layout*dialog)
|
|||
|
||||
void WindowManager::messageBox (const std::string& message, const std::vector<std::string>& buttons)
|
||||
{
|
||||
if (buttons.empty())
|
||||
{
|
||||
mMessageBoxManager->createMessageBox(message);
|
||||
}
|
||||
else
|
||||
{
|
||||
mMessageBoxManager->createInteractiveMessageBox(message, buttons);
|
||||
pushGuiMode(GM_InterMessageBox);
|
||||
/* 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())
|
||||
{
|
||||
mMessageBoxManager->createMessageBox(message);
|
||||
}
|
||||
else
|
||||
{
|
||||
mMessageBoxManager->createInteractiveMessageBox(message, buttons);
|
||||
pushGuiMode(GM_InterMessageBox);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
#include <components/interpreter/opcodes.hpp>
|
||||
|
||||
#include "../mwbase/environment.hpp"
|
||||
#include "../mwbase/windowmanager.hpp"
|
||||
|
||||
#include "../mwworld/manualref.hpp"
|
||||
#include "../mwworld/class.hpp"
|
||||
|
@ -107,11 +108,40 @@ namespace MWScript
|
|||
|
||||
MWWorld::ContainerStore& store = MWWorld::Class::get (ptr).getContainerStore (ptr);
|
||||
|
||||
std::string itemName = "";
|
||||
|
||||
for (MWWorld::ContainerStoreIterator iter (store.begin()); iter!=store.end() && count;
|
||||
++iter)
|
||||
{
|
||||
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)
|
||||
{
|
||||
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
|
||||
// count is >= 0 here and throw an exception. But let's be tollerant instead.
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue