AGOS: (ELVIRA2) - fix mouse wheel handling

- Fix messed up inventory (bug no. 11998) caused by the asynchronous (outsize of the normal engine) handling of the mouse wheel. This often lead to wrong inventory item icons.

- Also prevent crash due to nullptr deref. This can happen when using the mouse wheel while the inventory items are not visible (e. g. during the copy protection, when the symbol and words for the code wheel are displayed in the inventory window).
This commit is contained in:
athrxx 2021-04-05 02:54:14 +02:00
parent 819b4230bc
commit cac259ba26

View File

@ -21,6 +21,7 @@
*/
#include "common/config-manager.h"
#include "common/events.h"
#include "common/file.h"
#include "agos/intern.h"
@ -493,8 +494,8 @@ void AGOSEngine_Elvira2::handleMouseWheelUp() {
_saveLoadRowCurPos -= 3;
listSaveGames();
} else {
AGOSEngine::handleMouseWheelUp();
} else if ((ha = findBox(0x7FFB)) && ha->window && ha->window->iconPtr) {
_lastHitArea3 = _lastHitArea = ha;
}
}
@ -507,8 +508,8 @@ void AGOSEngine_Elvira2::handleMouseWheelDown() {
_saveLoadRowCurPos = 1;
listSaveGames();
} else {
AGOSEngine::handleMouseWheelDown();
} else if ((ha = findBox(0x7FFC)) && ha->window && ha->window->iconPtr) {
_lastHitArea3 = _lastHitArea = ha;
}
}