mirror of
https://github.com/OpenMW/openmw.git
synced 2025-01-21 07:53:53 +00:00
replaced explicit text with GMST entries, thanks to zinnschlag
This commit is contained in:
parent
ba2301a156
commit
ad9b86058b
3 changed files with 27 additions and 4 deletions
|
@ -370,7 +370,7 @@ void DialogueWindow::addText(std::string text)
|
|||
mHistory->addDialogText("#B29154"+parseText(text)+"#B29154");
|
||||
}
|
||||
|
||||
void DialogueWindow::addMessageBox(std::string text)
|
||||
void DialogueWindow::addMessageBox(const std::string& text)
|
||||
{
|
||||
mHistory->addDialogText("\n#FFFFFF"+text+"#B29154");
|
||||
}
|
||||
|
|
|
@ -65,7 +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 addMessageBox(const std::string& text);
|
||||
void addTitle(std::string text);
|
||||
void askQuestion(std::string question);
|
||||
void goodbye();
|
||||
|
|
|
@ -3,6 +3,10 @@
|
|||
|
||||
#include <stdexcept>
|
||||
|
||||
#include <boost/format.hpp>
|
||||
|
||||
#include <MyGUI_LanguageManager.h>
|
||||
|
||||
#include <components/compiler/extensions.hpp>
|
||||
|
||||
#include <components/interpreter/interpreter.hpp>
|
||||
|
@ -109,6 +113,7 @@ namespace MWScript
|
|||
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;
|
||||
++iter)
|
||||
|
@ -130,7 +135,25 @@ namespace MWScript
|
|||
}
|
||||
}
|
||||
|
||||
MWBase::Environment::get().getWindowManager()->messageBox(itemName + " has been removed from your inventory.", std::vector<std::string>());
|
||||
/* 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
|
||||
// count is >= 0 here and throw an exception. But let's be tollerant instead.
|
||||
|
|
Loading…
Reference in a new issue