1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-02-28 17:39:41 +00:00

Generate sCrimeMessageReport only once per frame (bug #5012)

This commit is contained in:
Andrei Kortunov 2019-09-05 20:16:03 +04:00
parent 58be8dc976
commit c9deb1b325
4 changed files with 18 additions and 2 deletions

View file

@ -104,6 +104,7 @@
Bug #4999: Drop instruction behaves differently from vanilla Bug #4999: Drop instruction behaves differently from vanilla
Bug #5001: Possible data race in the Animation::setAlpha() Bug #5001: Possible data race in the Animation::setAlpha()
Bug #5004: Werewolves shield their eyes during storm Bug #5004: Werewolves shield their eyes during storm
Bug #5012: "Take all" on owned container generates a messagebox per item
Bug #5018: Spell tooltips don't support purely negative magnitudes Bug #5018: Spell tooltips don't support purely negative magnitudes
Bug #5025: Data race in the ICO::setMaximumNumOfObjectsToCompilePerFrame() Bug #5025: Data race in the ICO::setMaximumNumOfObjectsToCompilePerFrame()
Bug #5028: Offered price caps are not trading-specific Bug #5028: Offered price caps are not trading-specific

View file

@ -175,6 +175,7 @@ namespace MWGui
, mHudEnabled(true) , mHudEnabled(true)
, mCursorVisible(true) , mCursorVisible(true)
, mCursorActive(false) , mCursorActive(false)
, mPlayerBounty(-1)
, mPlayerName() , mPlayerName()
, mPlayerRaceId() , mPlayerRaceId()
, mPlayerAttributes() , mPlayerAttributes()
@ -1025,6 +1026,18 @@ namespace MWGui
if (!gameRunning) if (!gameRunning)
return; return;
// We should display message about crime only once per frame, even if there are several crimes.
// Otherwise we will get message spam when stealing several items via Take All button.
const MWWorld::Ptr player = MWMechanics::getPlayer();
int currentBounty = player.getClass().getNpcStats(player).getBounty();
if (currentBounty != mPlayerBounty)
{
if (mPlayerBounty >= 0 && currentBounty > mPlayerBounty)
messageBox("#{sCrimeMessage}");
mPlayerBounty = currentBounty;
}
mDragAndDrop->onFrame(); mDragAndDrop->onFrame();
mHud->onFrame(frameDuration); mHud->onFrame(frameDuration);
@ -1773,6 +1786,8 @@ namespace MWGui
void WindowManager::clear() void WindowManager::clear()
{ {
mPlayerBounty = -1;
for (WindowBase* window : mWindows) for (WindowBase* window : mWindows)
window->clear(); window->clear();

View file

@ -462,6 +462,8 @@ namespace MWGui
bool mCursorVisible; bool mCursorVisible;
bool mCursorActive; bool mCursorActive;
int mPlayerBounty;
void setCursorVisible(bool visible); void setCursorVisible(bool visible);
/// \todo get rid of this stuff. Move it to the respective UI element classes, if needed. /// \todo get rid of this stuff. Move it to the respective UI element classes, if needed.

View file

@ -1452,7 +1452,6 @@ namespace MWMechanics
if (reported) if (reported)
{ {
MWBase::Environment::get().getWindowManager()->messageBox("#{sCrimeMessage}");
player.getClass().getNpcStats(player).setBounty(player.getClass().getNpcStats(player).getBounty() player.getClass().getNpcStats(player).setBounty(player.getClass().getNpcStats(player).getBounty()
+ arg); + arg);
@ -1923,7 +1922,6 @@ namespace MWMechanics
{ {
npcStats.setBounty(npcStats.getBounty()+ npcStats.setBounty(npcStats.getBounty()+
gmst.find("iWereWolfBounty")->mValue.getInteger()); gmst.find("iWereWolfBounty")->mValue.getInteger());
windowManager->messageBox("#{sCrimeMessage}");
} }
} }
} }