[Scummvm-git-logs] scummvm master -> 74460520589acc47aac9fcfa7fbd3f9d179a4f07

dreammaster noreply at scummvm.org
Tue May 23 05:28:57 UTC 2023


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

Summary:
7446052058 MM: MM1: Fix exchanging party members


Commit: 74460520589acc47aac9fcfa7fbd3f9d179a4f07
    https://github.com/scummvm/scummvm/commit/74460520589acc47aac9fcfa7fbd3f9d179a4f07
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-05-22T22:28:50-07:00

Commit Message:
MM: MM1: Fix exchanging party members

Changed paths:
    engines/mm/mm1/views_enh/exchange.cpp
    engines/mm/mm1/views_enh/exchange.h


diff --git a/engines/mm/mm1/views_enh/exchange.cpp b/engines/mm/mm1/views_enh/exchange.cpp
index eb93ffaec82..e509d8b1a4d 100644
--- a/engines/mm/mm1/views_enh/exchange.cpp
+++ b/engines/mm/mm1/views_enh/exchange.cpp
@@ -55,20 +55,16 @@ bool Exchange::msgAction(const ActionMessage &msg) {
 	return PartyView::msgAction(msg);
 }
 
-bool Exchange::msgGame(const GameMessage &msg) {
-	if (msg._name == "UPDATE") {
-		int charNum = g_globals->_party.indexOf(g_globals->_currCharacter);
+void Exchange::charSwitched(Character *priorChar) {
+	PartyView::charSwitched(priorChar);
+	int charNum = g_globals->_party.indexOf(g_globals->_currCharacter);
 
-		if (charNum != _srcCharacter) {
-			// Swap the two characters
-			SWAP(g_globals->_party[charNum], g_globals->_party[_srcCharacter]);
-		}
-
-		close();
-		return true;
+	if (charNum != _srcCharacter) {
+		// Swap the two characters
+		SWAP(g_globals->_party[charNum], g_globals->_party[_srcCharacter]);
 	}
 
-	return PartyView::msgGame(msg);
+	close();
 }
 
 } // namespace ViewsEnh
diff --git a/engines/mm/mm1/views_enh/exchange.h b/engines/mm/mm1/views_enh/exchange.h
index 16f63e37294..f56629a1788 100644
--- a/engines/mm/mm1/views_enh/exchange.h
+++ b/engines/mm/mm1/views_enh/exchange.h
@@ -32,6 +32,12 @@ class Exchange : public PartyView {
 private:
 	int _srcCharacter = -1;
 
+protected:
+	/**
+	 * Called when the selected character has been switched
+	 */
+	void charSwitched(Character *priorChar) override;
+
 public:
 	Exchange();
 	virtual ~Exchange() {}
@@ -39,7 +45,6 @@ public:
 	bool msgFocus(const FocusMessage &msg) override;
 	void draw() override;
 	bool msgAction(const ActionMessage &msg) override;
-	bool msgGame(const GameMessage &msg) override;
 };
 
 } // namespace ViewsEnh




More information about the Scummvm-git-logs mailing list