[Client] Fix client script messagebox buttons that had always broken in tes3mp

0.6.1
David Cernat 8 years ago
parent e36c0afc59
commit 708d3723eb

@ -29,7 +29,18 @@
#include <components/files/configurationmanager.hpp>
#include <components/version/version.hpp>
/*
Start of tes3mp addition
Include additional headers for multiplayer purposes
*/
#include <components/openmw-mp/Log.hpp>
#include "mwmp/Main.hpp"
#include "mwmp/GUIController.hpp"
/*
End of tes3mp addition
*/
#include "mwinput/inputmanagerimp.hpp"
@ -57,9 +68,6 @@
#include "mwstate/statemanagerimp.hpp"
#include "mwmp/Main.hpp"
#include "mwmp/GUIController.hpp"
namespace
{
void checkSDLError(int ret)

@ -257,6 +257,16 @@ namespace MWBase
/// returns the index of the pressed button or -1 if no button was pressed (->MessageBoxmanager->InteractiveMessageBox)
virtual int readPressedButton() = 0;
/*
Start of tes3mp addition
Allow the reading of a pressed button without resetting it
*/
virtual int readPressedButton(bool reset) = 0;
/*
End of tes3mp addition
*/
virtual void onFrame (float frameDuration) = 0;
/// \todo get rid of this stuff. Move it to the respective UI element classes, if needed.

@ -926,6 +926,19 @@ namespace MWGui
return mMessageBoxManager->readPressedButton();
}
/*
Start of tes3mp addition
Allow the reading of a pressed button without resetting it
*/
int WindowManager::readPressedButton(bool reset)
{
return mMessageBoxManager->readPressedButton(reset);
}
/*
End of tes3mp addition
*/
std::string WindowManager::getGameSettingString(const std::string &id, const std::string &default_)
{
const ESM::GameSetting *setting = mStore->get<ESM::GameSetting>().search(id);

@ -287,6 +287,16 @@ namespace MWGui
virtual int readPressedButton (); ///< returns the index of the pressed button or -1 if no button was pressed (->MessageBoxmanager->InteractiveMessageBox)
/*
Start of tes3mp addition
Allow the reading of a pressed button without resetting it
*/
virtual int readPressedButton(bool reset);
/*
End of tes3mp addition
*/
virtual void onFrame (float frameDuration);
/// \todo get rid of this stuff. Move it to the respective UI element classes, if needed.

@ -197,13 +197,15 @@ bool mwmp::GUIController::hasFocusedElement()
return false;
}
void mwmp::GUIController::update(float dt)
{
if (mChat != nullptr)
mChat->Update(dt);
int pressedButton = MWBase::Environment::get().getWindowManager()->readPressedButton();
// Make sure we read the pressed button without resetting it, because it may also get
// checked somewhere else
int pressedButton = MWBase::Environment::get().getWindowManager()->readPressedButton(false);
if (pressedButton != -1 && calledMessageBox)
{
LOG_MESSAGE_SIMPLE(Log::LOG_VERBOSE, "Pressed: %d", pressedButton);
@ -214,7 +216,6 @@ void mwmp::GUIController::update(float dt)
}
blockConsole();
}
void mwmp::GUIController::WM_UpdateVisible(MWGui::GuiMode mode)

Loading…
Cancel
Save