Skip to content

Commit

Permalink
XEEN: Fix for deleting characters from the roster
Browse files Browse the repository at this point in the history
  • Loading branch information
dreammaster committed Aug 30, 2019
1 parent de4d181 commit bbd663d
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 17 deletions.
1 change: 1 addition & 0 deletions engines/xeen/character.cpp
Expand Up @@ -59,6 +59,7 @@ Character::Character(const Character &src) : _weapons(this), _armor(this), _acce
}

void Character::clear() {
_name = "";
_sex = MALE;
_race = HUMAN;
_xeenSide = 0;
Expand Down
34 changes: 17 additions & 17 deletions engines/xeen/dialogs/dialogs_party.cpp
Expand Up @@ -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();
Expand Down Expand Up @@ -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);
}
}
Expand All @@ -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);
Expand Down
5 changes: 5 additions & 0 deletions engines/xeen/dialogs/dialogs_party.h
Expand Up @@ -52,6 +52,11 @@ class PartyDialog : public ButtonContainer, public PartyDrawer {
*/
void execute();

/**
* Loads the list of character
*/
void loadCharacters();

/**
* Loads buttons for the dialog
*/
Expand Down

0 comments on commit bbd663d

Please sign in to comment.