[Scummvm-git-logs] scummvm master -> 269876ce9c613e2ce35cac77eada278a7f786e2e

sev- noreply at scummvm.org
Wed Aug 27 15:43:30 UTC 2025


This automated email contains information about 7 new commits which have been
pushed to the 'scummvm' repo located at https://api.github.com/repos/scummvm/scummvm .

Summary:
c6c952c076 WAGE: Quit game when closing scene/console windows
1335b61a2d WAGE: Respect confirm_exit option
12e25224a1 WAGE: Fix crash on null pointer access
04a86d2ac2 WAGE: Add more NULL checks to script engine
89d7c7bf19 WAGE: Fix crash when exiting game with playing sound
7560d96eda GRAPHICS: MACGUI: Reset highlighted item in MacMenu::clearSubMenu
269876ce9c WAGE: Use C++11 range-based for loops


Commit: c6c952c0764ab1991a9059fef3f6a73e24aa22fe
    https://github.com/scummvm/scummvm/commit/c6c952c0764ab1991a9059fef3f6a73e24aa22fe
Author: Alikhan Balpykov (luxrage1990 at gmail.com)
Date: 2025-08-27T17:43:23+02:00

Commit Message:
WAGE: Quit game when closing scene/console windows

Changed paths:
    engines/wage/gui.cpp
    engines/wage/gui.h


diff --git a/engines/wage/gui.cpp b/engines/wage/gui.cpp
index 235fb49c3a3..295a83bbdc6 100644
--- a/engines/wage/gui.cpp
+++ b/engines/wage/gui.cpp
@@ -82,6 +82,7 @@ static const Graphics::MacMenuData menuSubItems[] = {
 	{ 0, NULL,			0, 0, false }
 };
 
+static bool consoleWindowCallback(WindowClick click, Common::Event &event, void *gui);
 static bool sceneWindowCallback(WindowClick click, Common::Event &event, void *gui);
 static void menuCommandsCallback(int action, Common::String &text, void *data);
 
@@ -131,6 +132,7 @@ Gui::Gui(WageEngine *engine) {
 	uint maxWidth = _screen.w;
 
 	_consoleWindow = _wm->addTextWindow(font, kColorBlack, kColorWhite, maxWidth, Graphics::kTextAlignLeft, _menu);
+	_consoleWindow->setCallback(consoleWindowCallback, this);
 	_consoleWindow->setEditable(true);
 
 	_selectedMenuItem = -1;
@@ -184,6 +186,21 @@ void Gui::drawScene() {
 	_menu->setDirty(true);
 }
 
+static bool consoleWindowCallback(WindowClick click, Common::Event &event, void *g) {
+	Gui *gui = (Gui *)g;
+
+	return gui->processConsoleEvents(click, event);
+}
+
+bool Gui::processConsoleEvents(WindowClick click, Common::Event &event) {
+	if (click == kBorderCloseButton && event.type == Common::EVENT_LBUTTONUP) {
+		_engine->quitGame();
+		return true;
+	}
+
+	return false;
+}
+
 static bool sceneWindowCallback(WindowClick click, Common::Event &event, void *g) {
 	Gui *gui = (Gui *)g;
 
@@ -199,6 +216,10 @@ bool Gui::processSceneEvents(WindowClick click, Common::Event &event) {
 
 		return true;
 	}
+	if (click == kBorderCloseButton && event.type == Common::EVENT_LBUTTONUP) {
+		_engine->quitGame();
+		return true;
+	}
 
 	return false;
 }
diff --git a/engines/wage/gui.h b/engines/wage/gui.h
index a2a78d6f7c4..3ffc0510d8c 100644
--- a/engines/wage/gui.h
+++ b/engines/wage/gui.h
@@ -138,6 +138,7 @@ public:
 	void enableRevert();
 
 	bool processSceneEvents(WindowClick click, Common::Event &event);
+	bool processConsoleEvents(WindowClick click, Common::Event &event);
 	void executeMenuCommand(int action, Common::String &text);
 
 	void clearOutput();


Commit: 1335b61a2d710966c6029d1df4020a245433e4dc
    https://github.com/scummvm/scummvm/commit/1335b61a2d710966c6029d1df4020a245433e4dc
Author: Alikhan Balpykov (luxrage1990 at gmail.com)
Date: 2025-08-27T17:43:23+02:00

Commit Message:
WAGE: Respect confirm_exit option

Changed paths:
    engines/wage/metaengine.cpp
    engines/wage/sound.cpp
    engines/wage/wage.cpp


diff --git a/engines/wage/metaengine.cpp b/engines/wage/metaengine.cpp
index 68739ce9500..aff9201635a 100644
--- a/engines/wage/metaengine.cpp
+++ b/engines/wage/metaengine.cpp
@@ -89,7 +89,8 @@ bool Wage::WageEngine::hasFeature(EngineFeature f) const {
 	return
 		(f == kSupportsReturnToLauncher) ||
 		(f == kSupportsLoadingDuringRuntime) ||
-		(f == kSupportsSavingDuringRuntime);
+		(f == kSupportsSavingDuringRuntime) ||
+		(f == kSupportsQuitDialogOverride);
 }
 
 Common::Error WageMetaEngine::createInstance(OSystem *syst, Engine **engine, const ADGameDescription *desc) const {
diff --git a/engines/wage/sound.cpp b/engines/wage/sound.cpp
index 8a14f91c667..b6aa842f3cd 100644
--- a/engines/wage/sound.cpp
+++ b/engines/wage/sound.cpp
@@ -47,6 +47,7 @@
 #include "audio/audiostream.h"
 #include "audio/mixer.h"
 #include "audio/decoders/raw.h"
+#include "common/config-manager.h"
 #include "common/stream.h"
 #include "common/system.h"
 
@@ -100,12 +101,16 @@ void WageEngine::playSound(Common::String soundName) {
 		if (_eventMan->pollEvent(event)) {
 			switch (event.type) {
 			case Common::EVENT_QUIT:
-				if (!_shouldQuit) {
-					g_system->getEventManager()->resetQuit();
-					if (saveDialog()) {
-						_shouldQuit = true;
-						g_system->getEventManager()->pushEvent(event);
+				if (ConfMan.hasKey("confirm_exit") && ConfMan.getBool("confirm_exit")) {
+					if (!_shouldQuit) {
+						g_system->getEventManager()->resetQuit();
+						if (saveDialog()) {
+							_shouldQuit = true;
+							g_system->getEventManager()->pushEvent(event);
+						}
 					}
+				} else {
+					_shouldQuit = true;
 				}
 				break;
 			default:
diff --git a/engines/wage/wage.cpp b/engines/wage/wage.cpp
index 9893d426823..27c3bed4fd2 100644
--- a/engines/wage/wage.cpp
+++ b/engines/wage/wage.cpp
@@ -233,13 +233,17 @@ void WageEngine::processEvents() {
 		switch (event.type) {
 		case Common::EVENT_QUIT:
 		case Common::EVENT_RETURN_TO_LAUNCHER:
-			if (!_shouldQuit) {
-				g_system->getEventManager()->resetQuit();
-				g_system->getEventManager()->resetReturnToLauncher();
-				if (saveDialog()) {
-					_shouldQuit = true;
-					g_system->getEventManager()->pushEvent(event);
+			if (ConfMan.hasKey("confirm_exit") && ConfMan.getBool("confirm_exit")) {
+				if (!_shouldQuit) {
+					g_system->getEventManager()->resetQuit();
+					g_system->getEventManager()->resetReturnToLauncher();
+					if (saveDialog()) {
+						_shouldQuit = true;
+						g_system->getEventManager()->pushEvent(event);
+					}
 				}
+			} else {
+				_shouldQuit = true;
 			}
 			break;
 		case Common::EVENT_KEYDOWN:


Commit: 12e25224a16d5659ea433bc0008d6164548e6edf
    https://github.com/scummvm/scummvm/commit/12e25224a16d5659ea433bc0008d6164548e6edf
Author: Alikhan Balpykov (luxrage1990 at gmail.com)
Date: 2025-08-27T17:43:23+02:00

Commit Message:
WAGE: Fix crash on null pointer access

Thanks to digitall for this patch

Changed paths:
    engines/wage/script.cpp


diff --git a/engines/wage/script.cpp b/engines/wage/script.cpp
index e255012dcad..4a149031e7c 100644
--- a/engines/wage/script.cpp
+++ b/engines/wage/script.cpp
@@ -713,23 +713,45 @@ struct Comparator {
 };
 
 bool Script::compare(Operand *o1, Operand *o2, int comparator) {
+	if (o1 == NULL) {
+		debug(1, "%s() o1 is null", __func__);
+		return false;
+	}
+	if (o2 == NULL) {
+		debug(1, "%s() o2 is null", __func__);
+		return false;
+	}
+
 	switch(comparator) {
 	case kCompEqNumNum:
 		return o1->_value.number == o2->_value.number;
 	case kCompEqObjScene:
-		for (ObjList::const_iterator it = o2->_value.scene->_objs.begin(); it != o2->_value.scene->_objs.end(); ++it)
-			if (*it == o1->_value.obj)
-				return true;
+		if (o2->_value.scene == NULL) {
+			debug(1, "%s() o2->_value.scene is null", __func__);
+			return false;
+		} else {
+			for (ObjList::const_iterator it = o2->_value.scene->_objs.begin(); it != o2->_value.scene->_objs.end(); ++it)
+				if (*it == o1->_value.obj)
+					return true;
+		}
 		return false;
 	case kCompEqChrScene:
-		for (ChrList::const_iterator it = o2->_value.scene->_chrs.begin(); it != o2->_value.scene->_chrs.end(); ++it)
-			if (*it == o1->_value.chr)
-				return true;
+		if (o2->_value.scene == NULL) {
+			debug(1, "%s() o2->_value.scene is null", __func__);
+		} else {
+			for (ChrList::const_iterator it = o2->_value.scene->_chrs.begin(); it != o2->_value.scene->_chrs.end(); ++it)
+				if (*it == o1->_value.chr)
+					return true;
+		}
 		return false;
 	case kCompEqObjChr:
-		for (ObjArray::const_iterator it = o2->_value.chr->_inventory.begin(); it != o2->_value.chr->_inventory.end(); ++it)
-			if (*it == o1->_value.obj)
-				return true;
+		if (o2->_value.chr == NULL) {
+			debug(1, "%s() o2->_value.chr is null", __func__);
+		} else {
+			for (ObjArray::const_iterator it = o2->_value.chr->_inventory.begin(); it != o2->_value.chr->_inventory.end(); ++it)
+				if (*it == o1->_value.obj)
+					return true;
+		}
 		return false;
 	case kCompEqChrChr:
 		return o1->_value.chr == o2->_value.chr;


Commit: 04a86d2ac29a7f67bc8da3613bb1d9fb46fdd518
    https://github.com/scummvm/scummvm/commit/04a86d2ac29a7f67bc8da3613bb1d9fb46fdd518
Author: Alikhan Balpykov (luxrage1990 at gmail.com)
Date: 2025-08-27T17:43:23+02:00

Commit Message:
WAGE: Add more NULL checks to script engine

Changed paths:
    engines/wage/script.cpp


diff --git a/engines/wage/script.cpp b/engines/wage/script.cpp
index 4a149031e7c..9115f46134a 100644
--- a/engines/wage/script.cpp
+++ b/engines/wage/script.cpp
@@ -796,11 +796,21 @@ bool Script::compare(Operand *o1, Operand *o2, int comparator) {
 	case kCompLtTextInputString:
 		return !compare(o2, o1, kCompEqStringTextInput);
 	case kCompLtObjChr:
-		return o1->_value.obj->_currentOwner != o2->_value.chr;
+		if (o1->_value.obj == NULL) {
+			debug(1, "%s() o1->_value.obj is null", __func__);
+		} else {
+			return o1->_value.obj->_currentOwner != o2->_value.chr;
+		}
+		break;
 	case kCompLtChrObj:
 		return compare(o2, o1, kCompLtObjChr);
 	case kCompLtObjScene:
-		return o1->_value.obj->_currentScene != o2->_value.scene;
+		if (o1->_value.obj == NULL) {
+			debug(1, "%s() o1->_value.obj is null", __func__);
+		} else {
+			return o1->_value.obj->_currentScene != o2->_value.scene;
+		}
+		break;
 	case kCompGtNumNum:
 		return o1->_value.number > o2->_value.number;
 	case kCompGtStringString:
@@ -808,16 +818,25 @@ bool Script::compare(Operand *o1, Operand *o2, int comparator) {
 	case kCompGtChrScene:
 		return (o1->_value.chr != NULL && o1->_value.chr->_currentScene != o2->_value.scene);
 	case kMoveObjChr:
-		if (o1->_value.obj->_currentOwner != o2->_value.chr) {
-			_world->move(o1->_value.obj, o2->_value.chr);
-			_handled = true;  // TODO: Is this correct?
+		if (o1->_value.obj == NULL) {
+			debug(1, "%s() o1->_value.obj is null", __func__);
+		} else {
+			if (o1->_value.obj->_currentOwner != o2->_value.chr) {
+				_world->move(o1->_value.obj, o2->_value.chr);
+				_handled = true;  // TODO: Is this correct?
+			}
 		}
 		break;
 	case kMoveObjScene:
-		if (o1->_value.obj->_currentScene != o2->_value.scene) {
-			_world->move(o1->_value.obj, o2->_value.scene);
-			// Note: This shouldn't call setHandled() - see
-			// Sultan's Palace 'Food and Drink' scene.
+		if (o1->_value.obj == NULL) {
+			debug(1, "%s() o1->_value.obj is null", __func__);
+			return false;
+		} else {
+			if (o1->_value.obj->_currentScene != o2->_value.scene) {
+				_world->move(o1->_value.obj, o2->_value.scene);
+				// Note: This shouldn't call setHandled() - see
+				// Sultan's Palace 'Food and Drink' scene.
+			}
 		}
 		break;
 	case kMoveChrScene:


Commit: 89d7c7bf19fcf1a0633eae437f70a4c8e60c3475
    https://github.com/scummvm/scummvm/commit/89d7c7bf19fcf1a0633eae437f70a4c8e60c3475
Author: Alikhan Balpykov (luxrage1990 at gmail.com)
Date: 2025-08-27T17:43:23+02:00

Commit Message:
WAGE: Fix crash when exiting game with playing sound

Changed paths:
    engines/wage/sound.cpp
    engines/wage/wage.cpp


diff --git a/engines/wage/sound.cpp b/engines/wage/sound.cpp
index b6aa842f3cd..41fde3a462c 100644
--- a/engines/wage/sound.cpp
+++ b/engines/wage/sound.cpp
@@ -127,6 +127,9 @@ static void soundTimer(void *refCon) {
 	Scene *scene = (Scene *)refCon;
 	WageEngine *engine = (WageEngine *)g_engine;
 
+	if (!engine)
+		return;
+
 	g_system->getTimerManager()->removeTimerProc(&soundTimer);
 
 	if (engine->_world->_player->_currentScene != scene)
diff --git a/engines/wage/wage.cpp b/engines/wage/wage.cpp
index 27c3bed4fd2..e7deff5a006 100644
--- a/engines/wage/wage.cpp
+++ b/engines/wage/wage.cpp
@@ -99,6 +99,8 @@ WageEngine::~WageEngine() {
 	delete _resManager;
 	delete _gui;
 	delete _rnd;
+
+	g_engine = nullptr;
 }
 
 bool WageEngine::pollEvent(Common::Event &event) {


Commit: 7560d96edaff1dbddcf3e6ee28fbab313d662614
    https://github.com/scummvm/scummvm/commit/7560d96edaff1dbddcf3e6ee28fbab313d662614
Author: Alikhan Balpykov (luxrage1990 at gmail.com)
Date: 2025-08-27T17:43:23+02:00

Commit Message:
GRAPHICS: MACGUI: Reset highlighted item in MacMenu::clearSubMenu

Fixes crash in WAGE game(s) when creating new sub menu from string.

Changed paths:
    graphics/macgui/macmenu.cpp


diff --git a/graphics/macgui/macmenu.cpp b/graphics/macgui/macmenu.cpp
index 2b3aeffb9a5..e761d9432d3 100644
--- a/graphics/macgui/macmenu.cpp
+++ b/graphics/macgui/macmenu.cpp
@@ -683,6 +683,7 @@ void MacMenu::clearSubMenu(int id) {
 		delete menu->submenu->items[j];
 
 	menu->submenu->items.clear();
+	menu->submenu->highlight = -1;
 }
 
 void MacMenu::createSubMenuFromString(int id, const char *str, int commandId) {


Commit: 269876ce9c613e2ce35cac77eada278a7f786e2e
    https://github.com/scummvm/scummvm/commit/269876ce9c613e2ce35cac77eada278a7f786e2e
Author: Alikhan Balpykov (luxrage1990 at gmail.com)
Date: 2025-08-27T17:43:23+02:00

Commit Message:
WAGE: Use C++11 range-based for loops

Changed paths:
    engines/wage/script.cpp


diff --git a/engines/wage/script.cpp b/engines/wage/script.cpp
index 9115f46134a..52b93b54064 100644
--- a/engines/wage/script.cpp
+++ b/engines/wage/script.cpp
@@ -307,10 +307,12 @@ bool Script::execute(World *world, int loopCount, Common::String *inputText, Des
 		} else {
 			Chr *player = _world->_player;
 			ObjArray *weapons = player->getWeapons(true);
-			for (ObjArray::const_iterator weapon = weapons->begin(); weapon != weapons->end(); ++weapon) {
-				if (_engine->tryAttack(*weapon, input)) {
-					_handled = _engine->handleAttack(*weapon);
-					break;
+			if (weapons) {
+				for (const auto &weapon : *weapons) {
+					if (_engine->tryAttack(weapon, input)) {
+						_handled = _engine->handleAttack(weapon);
+						break;
+					}
 				}
 			}
 
@@ -730,8 +732,8 @@ bool Script::compare(Operand *o1, Operand *o2, int comparator) {
 			debug(1, "%s() o2->_value.scene is null", __func__);
 			return false;
 		} else {
-			for (ObjList::const_iterator it = o2->_value.scene->_objs.begin(); it != o2->_value.scene->_objs.end(); ++it)
-				if (*it == o1->_value.obj)
+			for (const auto &obj : o2->_value.scene->_objs)
+				if (obj == o1->_value.obj)
 					return true;
 		}
 		return false;
@@ -739,8 +741,8 @@ bool Script::compare(Operand *o1, Operand *o2, int comparator) {
 		if (o2->_value.scene == NULL) {
 			debug(1, "%s() o2->_value.scene is null", __func__);
 		} else {
-			for (ChrList::const_iterator it = o2->_value.scene->_chrs.begin(); it != o2->_value.scene->_chrs.end(); ++it)
-				if (*it == o1->_value.chr)
+			for (const auto &chr : o2->_value.scene->_chrs)
+				if (chr == o1->_value.chr)
 					return true;
 		}
 		return false;
@@ -748,8 +750,8 @@ bool Script::compare(Operand *o1, Operand *o2, int comparator) {
 		if (o2->_value.chr == NULL) {
 			debug(1, "%s() o2->_value.chr is null", __func__);
 		} else {
-			for (ObjArray::const_iterator it = o2->_value.chr->_inventory.begin(); it != o2->_value.chr->_inventory.end(); ++it)
-				if (*it == o1->_value.obj)
+			for (const auto &obj : o2->_value.chr->_inventory)
+				if (obj == o1->_value.obj)
 					return true;
 		}
 		return false;




More information about the Scummvm-git-logs mailing list