[Scummvm-git-logs] scummvm master -> bbd663d3661c5daf4ae04071e3d3326ef4709143

dreammaster paulfgilbert at gmail.com
Fri Aug 30 05:52:19 CEST 2019


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:
bbd663d366 XEEN: Fix for deleting characters from the roster


Commit: bbd663d3661c5daf4ae04071e3d3326ef4709143
    https://github.com/scummvm/scummvm/commit/bbd663d3661c5daf4ae04071e3d3326ef4709143
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2019-08-29T20:52:11-07:00

Commit Message:
XEEN: Fix for deleting characters from the roster

Changed paths:
    engines/xeen/character.cpp
    engines/xeen/dialogs/dialogs_party.cpp
    engines/xeen/dialogs/dialogs_party.h


diff --git a/engines/xeen/character.cpp b/engines/xeen/character.cpp
index 1712bbb..982ffd8 100644
--- a/engines/xeen/character.cpp
+++ b/engines/xeen/character.cpp
@@ -59,6 +59,7 @@ Character::Character(const Character &src) : _weapons(this), _armor(this), _acce
 }
 
 void Character::clear() {
+	_name = "";
 	_sex = MALE;
 	_race = HUMAN;
 	_xeenSide = 0;
diff --git a/engines/xeen/dialogs/dialogs_party.cpp b/engines/xeen/dialogs/dialogs_party.cpp
index 824f45f..ac92ceb 100644
--- a/engines/xeen/dialogs/dialogs_party.cpp
+++ b/engines/xeen/dialogs/dialogs_party.cpp
@@ -64,14 +64,7 @@ void PartyDialog::execute() {
 
 		// Build up a list of available characters in the Roster that are on the
 		// same side of Xeen as the player is currently on
-		_charList.clear();
-		for (int i = 0; i < XEEN_TOTAL_CHARACTERS; ++i) {
-			Character &player = party._roster[i];
-			if (player._name.empty() || player._xeenSide != map._loadCcNum)
-				continue;
-
-			_charList.push_back(i);
-		}
+		loadCharacters();
 
 		Window &w = windows[11];
 		w.open();
@@ -254,15 +247,8 @@ void PartyDialog::execute() {
 								// Empty the character in the roster
 								c.clear();
 
-								// Rebuild the character list
-								_charList.clear();
-								for (int idx = 0; idx < XEEN_TOTAL_CHARACTERS; ++idx) {
-									Character &ch = party._roster[idx];
-									if (!ch._name.empty() && ch._savedMazeId == party._priorMazeId) {
-										_charList.push_back(idx);
-									}
-								}
-
+								loadCharacters();
+								startingChar = 0;
 								startingCharChanged(startingChar);
 							}
 						}
@@ -289,6 +275,20 @@ void PartyDialog::execute() {
 	}
 }
 
+void PartyDialog::loadCharacters() {
+	Map &map = *_vm->_map;
+	Party &party = *_vm->_party;
+
+	_charList.clear();
+	for (int i = 0; i < XEEN_TOTAL_CHARACTERS; ++i) {
+		Character &player = party._roster[i];
+		if (player._name.empty() || player._xeenSide != map._loadCcNum)
+			continue;
+
+		_charList.push_back(i);
+	}
+}
+
 void PartyDialog::loadButtons() {
 	_uiSprites.load("inn.icn");
 	addButton(Common::Rect(16, 100, 40, 120), Common::KEYCODE_UP, &_uiSprites);
diff --git a/engines/xeen/dialogs/dialogs_party.h b/engines/xeen/dialogs/dialogs_party.h
index 8f87ca3..b906c120 100644
--- a/engines/xeen/dialogs/dialogs_party.h
+++ b/engines/xeen/dialogs/dialogs_party.h
@@ -53,6 +53,11 @@ private:
 	void execute();
 
 	/**
+	 * Loads the list of character
+	 */
+	void loadCharacters();
+
+	/**
 	 * Loads buttons for the dialog
 	 */
 	void loadButtons();





More information about the Scummvm-git-logs mailing list