forked from mirror/openmw-tes3mp
Merge remote-tracking branch 'wheybags/master'
This commit is contained in:
commit
5f523afa05
4 changed files with 45 additions and 4 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(const 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(const 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,10 +537,15 @@ 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 (buttons.empty())
|
if(buttons.empty()){
|
||||||
{
|
/* If there are no buttons, and there is a dialogue window open, messagebox goes to the dialogue window */
|
||||||
mMessageBoxManager->createMessageBox(message);
|
if(std::find(mGuiModes.begin(), mGuiModes.end(), GM_Dialogue) != mGuiModes.end())
|
||||||
|
mDialogueWindow->addMessageBox(MyGUI::LanguageManager::getInstance().replaceTags(message));
|
||||||
|
|
||||||
|
else
|
||||||
|
mMessageBoxManager->createMessageBox(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
mMessageBoxManager->createInteractiveMessageBox(message, buttons);
|
mMessageBoxManager->createInteractiveMessageBox(message, buttons);
|
||||||
|
|
|
@ -3,6 +3,10 @@
|
||||||
|
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
|
|
||||||
|
#include <boost/format.hpp>
|
||||||
|
|
||||||
|
#include <MyGUI_LanguageManager.h>
|
||||||
|
|
||||||
#include <components/compiler/extensions.hpp>
|
#include <components/compiler/extensions.hpp>
|
||||||
|
|
||||||
#include <components/interpreter/interpreter.hpp>
|
#include <components/interpreter/interpreter.hpp>
|
||||||
|
@ -10,6 +14,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"
|
||||||
|
@ -101,17 +106,22 @@ namespace MWScript
|
||||||
|
|
||||||
Interpreter::Type_Integer count = runtime[0].mInteger;
|
Interpreter::Type_Integer count = runtime[0].mInteger;
|
||||||
runtime.pop();
|
runtime.pop();
|
||||||
|
|
||||||
if (count<0)
|
if (count<0)
|
||||||
throw std::runtime_error ("second argument for RemoveItem must be non-negative");
|
throw std::runtime_error ("second argument for RemoveItem must be non-negative");
|
||||||
|
|
||||||
MWWorld::ContainerStore& store = MWWorld::Class::get (ptr).getContainerStore (ptr);
|
MWWorld::ContainerStore& store = MWWorld::Class::get (ptr).getContainerStore (ptr);
|
||||||
|
|
||||||
|
std::string itemName = "";
|
||||||
|
Interpreter::Type_Integer originalCount = count;
|
||||||
|
|
||||||
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))
|
||||||
{
|
{
|
||||||
|
itemName = MWWorld::Class::get(*iter).getName(*iter);
|
||||||
|
|
||||||
if (iter->getRefData().getCount()<=count)
|
if (iter->getRefData().getCount()<=count)
|
||||||
{
|
{
|
||||||
count -= iter->getRefData().getCount();
|
count -= iter->getRefData().getCount();
|
||||||
|
@ -124,6 +134,26 @@ namespace MWScript
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* 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;
|
||||||
|
if(originalCount - count > 1)
|
||||||
|
{
|
||||||
|
msgBox = MyGUI::LanguageManager::getInstance().replaceTags("#{sNotifyMessage63}");
|
||||||
|
std::stringstream temp;
|
||||||
|
temp << boost::format(msgBox) % (originalCount - count) % itemName;
|
||||||
|
msgBox = temp.str();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
msgBox = MyGUI::LanguageManager::getInstance().replaceTags("#{sNotifyMessage62}");
|
||||||
|
std::stringstream temp;
|
||||||
|
temp << boost::format(msgBox) % itemName;
|
||||||
|
msgBox = temp.str();
|
||||||
|
}
|
||||||
|
|
||||||
|
if(originalCount - count > 0)
|
||||||
|
MWBase::Environment::get().getWindowManager()->messageBox(msgBox, 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