From ee30fe33e94c3e967757a1ad3f7aa0fb8b0e8a35 Mon Sep 17 00:00:00 2001 From: Meridian Date: Mon, 23 Sep 2024 14:46:00 +0200 Subject: [PATCH 1/5] listOrder on Armor --- src/Mod/Armor.cpp | 5 +++-- src/Mod/Armor.h | 6 +++++- src/Mod/Mod.cpp | 9 +++++---- src/Mod/Mod.h | 2 +- src/Ufopaedia/StatsForNerdsState.cpp | 1 + 5 files changed, 15 insertions(+), 8 deletions(-) diff --git a/src/Mod/Armor.cpp b/src/Mod/Armor.cpp index d3da7bc196..27c0d42f2d 100644 --- a/src/Mod/Armor.cpp +++ b/src/Mod/Armor.cpp @@ -33,7 +33,7 @@ const std::string Armor::NONE = "STR_NONE"; * type of armor. * @param type String defining the type. */ -Armor::Armor(const std::string &type) : +Armor::Armor(const std::string &type, int listOrder) : _type(type), _infiniteSupply(false), _frontArmor(0), _sideArmor(0), _leftArmorDiff(0), _rearArmor(0), _underArmor(0), _drawingRoutine(0), _drawBubbles(false), _movementType(MT_WALK), _specab(SPECAB_NONE), _turnBeforeFirstStep(false), _turnCost(1), _moveSound(-1), _size(1), _weight(0), _visibilityAtDark(0), _visibilityAtDay(0), @@ -45,7 +45,7 @@ Armor::Armor(const std::string &type) : _overKill(0.5f), _meleeDodgeBackPenalty(0), _allowsRunning(defBoolNullable), _allowsStrafing(defBoolNullable), _allowsSneaking(defBoolNullable), _allowsKneeling(defBoolNullable), _allowsMoving(1), _isPilotArmor(false), _allowTwoMainWeapons(false), _instantWoundRecovery(false), - _standHeight(-1), _kneelHeight(-1), _floatHeight(-1) + _standHeight(-1), _kneelHeight(-1), _floatHeight(-1), _listOrder(listOrder) { for (int i=0; i < DAMAGE_TYPES; i++) _damageModifier[i] = 1.0f; @@ -246,6 +246,7 @@ void Armor::load(const YAML::Node &node, Mod *mod, const ModScript &parsers) _standHeight = node["standHeight"].as(_standHeight); _kneelHeight = node["kneelHeight"].as(_kneelHeight); _floatHeight = node["floatHeight"].as(_floatHeight); + _listOrder = node["listOrder"].as(_listOrder); } /** diff --git a/src/Mod/Armor.h b/src/Mod/Armor.h index e65e8c56bd..f227ae37b4 100644 --- a/src/Mod/Armor.h +++ b/src/Mod/Armor.h @@ -175,9 +175,10 @@ class Armor bool _instantWoundRecovery; bool _isAlwaysVisible = false; int _standHeight, _kneelHeight, _floatHeight; + int _listOrder; public: /// Creates a blank armor ruleset. - Armor(const std::string &type); + Armor(const std::string &type, int listOrder); /// Cleans up the armor ruleset. ~Armor(); @@ -452,6 +453,9 @@ class Armor int getKneelHeight() const; /// Gets a unit's float elevation while wearing this armor. int getFloatHeight() const; + + /// Get the list weight for this armor. + int getListOrder() const { return _listOrder; } }; } diff --git a/src/Mod/Mod.cpp b/src/Mod/Mod.cpp index 097ce6371c..581c13185b 100644 --- a/src/Mod/Mod.cpp +++ b/src/Mod/Mod.cpp @@ -439,7 +439,7 @@ Mod::Mod() : _tuRecoveryWakeUpNewTurn(100), _shortRadarRange(0), _buildTimeReductionScaling(100), _defeatScore(0), _defeatFunds(0), _difficultyDemigod(false), _startingTime(6, 1, 1, 1999, 12, 0, 0), _startingDifficulty(0), _baseDefenseMapFromLocation(0), _disableUnderwaterSounds(false), _enableUnitResponseSounds(false), _pediaReplaceCraftFuelWithRangeType(-1), - _facilityListOrder(0), _craftListOrder(0), _itemCategoryListOrder(0), _itemListOrder(0), + _facilityListOrder(0), _craftListOrder(0), _itemCategoryListOrder(0), _itemListOrder(0), _armorListOrder(0), _researchListOrder(0), _manufactureListOrder(0), _soldierBonusListOrder(0), _transformationListOrder(0), _ufopaediaListOrder(0), _invListOrder(0), _soldierListOrder(0), _modCurrent(0), _statePalette(0) { @@ -2824,7 +2824,7 @@ void Mod::loadFile(const FileMap::FileRecord &filerec, ModScript &parsers) for (YAML::const_iterator i : iterateRules("armors", "type")) { - Armor *rule = loadRule(*i, &_armors, &_armorsIndex); + Armor *rule = loadRule(*i, &_armors, &_armorsIndex, "type", RuleListOrderedFactory{ _armorListOrder, 100 }); if (rule != 0) { rule->load(*i, this, parsers); @@ -4857,13 +4857,14 @@ struct compareRule const RuleItem *rule1 = armor1->getStoreItem(); const RuleItem *rule2 = armor2->getStoreItem(); if (!rule1 && !rule2) - return (armor1 < armor2); // tiebreaker, don't care about order, pointers are as good as any + return (armor1->getListOrder() < armor2->getListOrder()); // tiebreaker else if (!rule1) return true; else if (!rule2) return false; else - return (rule1->getListOrder() < rule2->getListOrder()); + return (rule1->getListOrder() < rule2->getListOrder() || + (rule1->getListOrder() == rule2->getListOrder() && armor1->getListOrder() < armor2->getListOrder())); } }; diff --git a/src/Mod/Mod.h b/src/Mod/Mod.h index 2f47db1c2e..ad9e60066c 100644 --- a/src/Mod/Mod.h +++ b/src/Mod/Mod.h @@ -302,7 +302,7 @@ class Mod std::vector _alienMissionsIndex, _terrainIndex, _customPalettesIndex, _arcScriptIndex, _eventScriptIndex, _eventIndex, _missionScriptIndex; std::vector > _alienItemLevels; std::vector> _transparencies; - int _facilityListOrder, _craftListOrder, _itemCategoryListOrder, _itemListOrder, _researchListOrder, _manufactureListOrder; + int _facilityListOrder, _craftListOrder, _itemCategoryListOrder, _itemListOrder, _armorListOrder, _researchListOrder, _manufactureListOrder; int _soldierBonusListOrder, _transformationListOrder, _ufopaediaListOrder, _invListOrder, _soldierListOrder; std::vector _modData; ModData* _modCurrent; diff --git a/src/Ufopaedia/StatsForNerdsState.cpp b/src/Ufopaedia/StatsForNerdsState.cpp index ce0ea42a9f..5d7b97584f 100644 --- a/src/Ufopaedia/StatsForNerdsState.cpp +++ b/src/Ufopaedia/StatsForNerdsState.cpp @@ -2812,6 +2812,7 @@ void StatsForNerdsState::initArmorList() addSection("{Naming}", "", _white); addSingleString(ss, armorRule->getType(), "type"); addSingleString(ss, armorRule->getUfopediaType(), "ufopediaType"); + addInteger(ss, armorRule->getListOrder(), "listOrder"); addRuleNamed(ss, armorRule->getRequiredResearch(), "requires"); addSection("{Recovery}", "", _white); From 844bc3ea7452c0fd0deb73cd29d17a544d648faa Mon Sep 17 00:00:00 2001 From: Meridian Date: Mon, 23 Sep 2024 14:46:00 +0200 Subject: [PATCH 2/5] listOrder on AlienRace --- src/Mod/AlienRace.cpp | 3 ++- src/Mod/AlienRace.h | 5 ++++- src/Mod/Mod.cpp | 5 +++-- src/Mod/Mod.h | 2 +- 4 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/Mod/AlienRace.cpp b/src/Mod/AlienRace.cpp index 6fbeb97536..3e2d4105bb 100644 --- a/src/Mod/AlienRace.cpp +++ b/src/Mod/AlienRace.cpp @@ -28,7 +28,7 @@ namespace OpenXcom * Creates a blank alien race. * @param id String defining the id. */ -AlienRace::AlienRace(const std::string &id) : _id(id), _retaliationAggression(0) +AlienRace::AlienRace(const std::string &id, int listOrder) : _id(id), _retaliationAggression(0), _listOrder(listOrder) { } @@ -66,6 +66,7 @@ void AlienRace::load(const YAML::Node &node, const Mod* mod) _retaliationMissionDistribution.push_back(std::make_pair(nn->first.as(0), nw)); } } + _listOrder = node["listOrder"].as(_listOrder); } /** diff --git a/src/Mod/AlienRace.h b/src/Mod/AlienRace.h index b6fa167842..fe1e21dc36 100644 --- a/src/Mod/AlienRace.h +++ b/src/Mod/AlienRace.h @@ -43,9 +43,10 @@ class AlienRace std::vector _members; std::vector< std::vector > _membersRandom; int _retaliationAggression; + int _listOrder; public: /// Creates a blank alien race ruleset. - AlienRace(const std::string &id); + AlienRace(const std::string &id, int listOrder); /// Cleans up the alien race ruleset. ~AlienRace(); /// Loads alien race data from YAML. @@ -64,6 +65,8 @@ class AlienRace int getRetaliationAggression() const; /// Returns a list of retaliation missions based on the given month. WeightedOptions* retaliationMissionWeights(const size_t monthsPassed) const; + /// Get the list weight for this alien race. + int getListOrder() const { return _listOrder; } }; } diff --git a/src/Mod/Mod.cpp b/src/Mod/Mod.cpp index 581c13185b..d89ebf4919 100644 --- a/src/Mod/Mod.cpp +++ b/src/Mod/Mod.cpp @@ -439,7 +439,7 @@ Mod::Mod() : _tuRecoveryWakeUpNewTurn(100), _shortRadarRange(0), _buildTimeReductionScaling(100), _defeatScore(0), _defeatFunds(0), _difficultyDemigod(false), _startingTime(6, 1, 1, 1999, 12, 0, 0), _startingDifficulty(0), _baseDefenseMapFromLocation(0), _disableUnderwaterSounds(false), _enableUnitResponseSounds(false), _pediaReplaceCraftFuelWithRangeType(-1), - _facilityListOrder(0), _craftListOrder(0), _itemCategoryListOrder(0), _itemListOrder(0), _armorListOrder(0), + _facilityListOrder(0), _craftListOrder(0), _itemCategoryListOrder(0), _itemListOrder(0), _armorListOrder(0), _alienRaceListOrder(0), _researchListOrder(0), _manufactureListOrder(0), _soldierBonusListOrder(0), _transformationListOrder(0), _ufopaediaListOrder(0), _invListOrder(0), _soldierListOrder(0), _modCurrent(0), _statePalette(0) { @@ -2856,7 +2856,7 @@ void Mod::loadFile(const FileMap::FileRecord &filerec, ModScript &parsers) } for (YAML::const_iterator i : iterateRules("alienRaces", "id")) { - AlienRace *rule = loadRule(*i, &_alienRaces, &_aliensIndex, "id"); + AlienRace *rule = loadRule(*i, &_alienRaces, &_aliensIndex, "id", RuleListOrderedFactory{ _alienRaceListOrder, 100 }); if (rule != 0) { rule->load(*i, this); @@ -4948,6 +4948,7 @@ void Mod::sortLists() std::sort(_ufopaediaIndex.begin(), _ufopaediaIndex.end(), compareRule(this)); std::sort(_ufopaediaCatIndex.begin(), _ufopaediaCatIndex.end(), compareSection(this)); std::sort(_soldiersIndex.begin(), _soldiersIndex.end(), compareRule(this, (compareRule::RuleLookup) & Mod::getSoldier)); + std::sort(_aliensIndex.begin(), _aliensIndex.end(), compareRule(this, (compareRule::RuleLookup) & Mod::getAlienRace)); } /** diff --git a/src/Mod/Mod.h b/src/Mod/Mod.h index ad9e60066c..fd538e261a 100644 --- a/src/Mod/Mod.h +++ b/src/Mod/Mod.h @@ -302,7 +302,7 @@ class Mod std::vector _alienMissionsIndex, _terrainIndex, _customPalettesIndex, _arcScriptIndex, _eventScriptIndex, _eventIndex, _missionScriptIndex; std::vector > _alienItemLevels; std::vector> _transparencies; - int _facilityListOrder, _craftListOrder, _itemCategoryListOrder, _itemListOrder, _armorListOrder, _researchListOrder, _manufactureListOrder; + int _facilityListOrder, _craftListOrder, _itemCategoryListOrder, _itemListOrder, _armorListOrder, _alienRaceListOrder, _researchListOrder, _manufactureListOrder; int _soldierBonusListOrder, _transformationListOrder, _ufopaediaListOrder, _invListOrder, _soldierListOrder; std::vector _modData; ModData* _modCurrent; From 01e0464d6e2836d15ae6aa704c55e061590c8af4 Mon Sep 17 00:00:00 2001 From: Meridian Date: Mon, 23 Sep 2024 14:46:00 +0200 Subject: [PATCH 3/5] R-click in Martial Training --- src/Basescape/SoldierInfoState.cpp | 11 ++++++++--- src/Basescape/SoldierInfoState.h | 3 ++- src/Geoscape/AllocateTrainingState.cpp | 17 ++++++++++++++++- src/Geoscape/AllocateTrainingState.h | 2 ++ 4 files changed, 28 insertions(+), 5 deletions(-) diff --git a/src/Basescape/SoldierInfoState.cpp b/src/Basescape/SoldierInfoState.cpp index fba3bfbc81..410c372907 100644 --- a/src/Basescape/SoldierInfoState.cpp +++ b/src/Basescape/SoldierInfoState.cpp @@ -56,7 +56,8 @@ namespace OpenXcom * @param base Pointer to the base to get info from. NULL to use the dead soldiers list. * @param soldierId ID of the selected soldier. */ -SoldierInfoState::SoldierInfoState(Base *base, size_t soldierId, bool forceLimits) : _base(base), _soldierId(soldierId), _forceLimits(forceLimits), _soldier(0) +SoldierInfoState::SoldierInfoState(Base *base, size_t soldierId, bool forceLimits, bool readOnly) : + _base(base), _soldierId(soldierId), _forceLimits(forceLimits), _readOnly(readOnly), _soldier(0) { if (_base == 0) { @@ -277,6 +278,10 @@ SoldierInfoState::SoldierInfoState(Base *base, size_t soldierId, bool forceLimit _btnArmor->setText(tr("STR_ARMOR")); _btnArmor->onMouseClick((ActionHandler)&SoldierInfoState::btnArmorClick); + if (_readOnly) + { + _btnArmor->setVisible(false); + } _btnBonuses->setText(tr("STR_BONUSES_BUTTON")); // tiny button, default translation is " " _btnBonuses->onMouseClick((ActionHandler)&SoldierInfoState::btnBonusesClick); @@ -289,7 +294,7 @@ SoldierInfoState::SoldierInfoState(Base *base, size_t soldierId, bool forceLimit { _game->getSavedGame()->getAvailableTransformations(availableTransformations, _game->getMod(), _base); } - if (availableTransformations.empty()) + if (_readOnly || availableTransformations.empty()) { _btnTransformations->setVisible(false); } @@ -477,7 +482,7 @@ void SoldierInfoState::init() _btnArmor->setText(wsArmor); - _btnSack->setVisible(_game->getSavedGame()->getMonthsPassed() > -1 && !(_soldier->getCraft() && _soldier->getCraft()->getStatus() == "STR_OUT")); + _btnSack->setVisible(!_readOnly && _game->getSavedGame()->getMonthsPassed() > -1 && !(_soldier->getCraft() && _soldier->getCraft()->getStatus() == "STR_OUT")); _txtRank->setText(tr("STR_RANK_").arg(tr(_soldier->getRankString()))); diff --git a/src/Basescape/SoldierInfoState.h b/src/Basescape/SoldierInfoState.h index 96352eb2bd..7766968597 100644 --- a/src/Basescape/SoldierInfoState.h +++ b/src/Basescape/SoldierInfoState.h @@ -41,6 +41,7 @@ class SoldierInfoState : public State Base *_base; size_t _soldierId; bool _forceLimits; + bool _readOnly; Soldier *_soldier; std::vector *_list; @@ -58,7 +59,7 @@ class SoldierInfoState : public State public: /// Creates the Soldier Info state. - SoldierInfoState(Base *base, size_t soldierId, bool forceLimits = true); + SoldierInfoState(Base *base, size_t soldierId, bool forceLimits = true, bool readOnly = false); /// Cleans up the Soldier Info state. ~SoldierInfoState(); /// Updates the soldier info. diff --git a/src/Geoscape/AllocateTrainingState.cpp b/src/Geoscape/AllocateTrainingState.cpp index 02b028fe59..6aac96df81 100644 --- a/src/Geoscape/AllocateTrainingState.cpp +++ b/src/Geoscape/AllocateTrainingState.cpp @@ -35,6 +35,7 @@ #include "../Engine/Options.h" #include "../Interface/ComboBox.h" #include "../Mod/Mod.h" +#include "../Basescape/SoldierInfoState.h" #include "../Basescape/SoldierSortUtil.h" #include #include "../Engine/Unicode.h" @@ -47,7 +48,7 @@ namespace OpenXcom * @param game Pointer to the core game. * @param base Pointer to the base to handle. */ -AllocateTrainingState::AllocateTrainingState(Base *base) : _sel(0), _base(base), _origSoldierOrder(*_base->getSoldiers()) +AllocateTrainingState::AllocateTrainingState(Base *base) : _sel(0), _base(base), _origSoldierOrder(*_base->getSoldiers()), _doNotReset(false) { // Create objects _window = new Window(this, 320, 200, 0, 0); @@ -190,6 +191,7 @@ AllocateTrainingState::AllocateTrainingState(Base *base) : _sel(0), _base(base), _lstSoldiers->onLeftArrowClick((ActionHandler)&AllocateTrainingState::lstItemsLeftArrowClick); _lstSoldiers->onRightArrowClick((ActionHandler)&AllocateTrainingState::lstItemsRightArrowClick); _lstSoldiers->onMouseClick((ActionHandler)&AllocateTrainingState::lstSoldiersClick); + _lstSoldiers->onMouseClick((ActionHandler)&AllocateTrainingState::lstSoldiersClick, SDL_BUTTON_RIGHT); _lstSoldiers->onMousePress((ActionHandler)&AllocateTrainingState::lstSoldiersMousePress); } @@ -292,6 +294,14 @@ void AllocateTrainingState::btnPlusClick(Action *action) void AllocateTrainingState::init() { State::init(); + + // coming back from SoldierInfoState + if (_doNotReset) + { + _doNotReset = false; + return; + } + _base->prepareSoldierStatsWithBonuses(); // refresh stats for sorting initList(0); } @@ -521,6 +531,11 @@ void AllocateTrainingState::lstSoldiersClick(Action *action) soldier->setReturnToTrainingWhenHealed(false); } } + else if (action->getDetails()->button.button == SDL_BUTTON_RIGHT) + { + _doNotReset = true; + _game->pushState(new SoldierInfoState(_base, _sel, true, true)); + } } /** diff --git a/src/Geoscape/AllocateTrainingState.h b/src/Geoscape/AllocateTrainingState.h index 19015e290b..0edf7df097 100644 --- a/src/Geoscape/AllocateTrainingState.h +++ b/src/Geoscape/AllocateTrainingState.h @@ -54,6 +54,8 @@ class AllocateTrainingState : public State std::vector _origSoldierOrder; std::vector _sortFunctors; std::vector _sortFunctorsPlus; + bool _doNotReset; + ///initializes the display list void initList(size_t scrl); public: From 18ccc91f2107876580578a6aa1e49e8393c4304e Mon Sep 17 00:00:00 2001 From: Meridian Date: Mon, 23 Sep 2024 14:46:01 +0200 Subject: [PATCH 4/5] R-click in Psi Training --- src/Geoscape/AllocatePsiTrainingState.cpp | 17 ++++++++++++++++- src/Geoscape/AllocatePsiTrainingState.h | 2 ++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/src/Geoscape/AllocatePsiTrainingState.cpp b/src/Geoscape/AllocatePsiTrainingState.cpp index cf33fca49e..e78c8cb97b 100644 --- a/src/Geoscape/AllocatePsiTrainingState.cpp +++ b/src/Geoscape/AllocatePsiTrainingState.cpp @@ -35,6 +35,7 @@ #include "../Engine/Options.h" #include "../Interface/ComboBox.h" #include "../Mod/RuleSoldier.h" +#include "../Basescape/SoldierInfoState.h" #include "../Basescape/SoldierSortUtil.h" #include #include "../Engine/Unicode.h" @@ -47,7 +48,7 @@ namespace OpenXcom * @param game Pointer to the core game. * @param base Pointer to the base to handle. */ -AllocatePsiTrainingState::AllocatePsiTrainingState(Base *base) : _sel(0), _base(base), _origSoldierOrder(*_base->getSoldiers()) +AllocatePsiTrainingState::AllocatePsiTrainingState(Base *base) : _sel(0), _base(base), _origSoldierOrder(*_base->getSoldiers()), _doNotReset(false) { // Create objects _window = new Window(this, 320, 200, 0, 0); @@ -178,6 +179,7 @@ AllocatePsiTrainingState::AllocatePsiTrainingState(Base *base) : _sel(0), _base( _lstSoldiers->onLeftArrowClick((ActionHandler)&AllocatePsiTrainingState::lstItemsLeftArrowClick); _lstSoldiers->onRightArrowClick((ActionHandler)&AllocatePsiTrainingState::lstItemsRightArrowClick); _lstSoldiers->onMouseClick((ActionHandler)&AllocatePsiTrainingState::lstSoldiersClick); + _lstSoldiers->onMouseClick((ActionHandler)&AllocatePsiTrainingState::lstSoldiersClick, SDL_BUTTON_RIGHT); _lstSoldiers->onMousePress((ActionHandler)&AllocatePsiTrainingState::lstSoldiersMousePress); } /** @@ -284,6 +286,14 @@ void AllocatePsiTrainingState::btnPlusClick(Action *action) void AllocatePsiTrainingState::init() { State::init(); + + // coming back from SoldierInfoState + if (_doNotReset) + { + _doNotReset = false; + return; + } + _base->prepareSoldierStatsWithBonuses(); // refresh stats for sorting initList(0); } @@ -507,6 +517,11 @@ void AllocatePsiTrainingState::lstSoldiersClick(Action *action) s->setPsiTraining(false); } } + else if (action->getDetails()->button.button == SDL_BUTTON_RIGHT) + { + _doNotReset = true; + _game->pushState(new SoldierInfoState(_base, _sel, true, true)); + } } /** diff --git a/src/Geoscape/AllocatePsiTrainingState.h b/src/Geoscape/AllocatePsiTrainingState.h index ce40b6492e..4e78e9da78 100644 --- a/src/Geoscape/AllocatePsiTrainingState.h +++ b/src/Geoscape/AllocatePsiTrainingState.h @@ -54,6 +54,8 @@ class AllocatePsiTrainingState : public State std::vector _origSoldierOrder; std::vector _sortFunctors; std::vector _sortFunctorsPlus; + bool _doNotReset; + ///initializes the display list based on the craft soldier's list and the position to display void initList(size_t scrl); public: From 8295f01fd166d520538957e53c0cd49f22369d11 Mon Sep 17 00:00:00 2001 From: Meridian Date: Mon, 23 Sep 2024 14:46:01 +0200 Subject: [PATCH 5/5] Preserve scroll position when returning from detail --- src/Basescape/SoldierDiaryOverviewState.cpp | 12 +++++++++++- src/Basescape/SoldierDiaryOverviewState.h | 1 + src/version.h | 2 +- 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/src/Basescape/SoldierDiaryOverviewState.cpp b/src/Basescape/SoldierDiaryOverviewState.cpp index cbe04ff557..83477cf57e 100755 --- a/src/Basescape/SoldierDiaryOverviewState.cpp +++ b/src/Basescape/SoldierDiaryOverviewState.cpp @@ -46,7 +46,8 @@ namespace OpenXcom * @param soldierId ID of the selected soldier. * @param soldierInfoState Pointer to the Soldier Info screen. */ -SoldierDiaryOverviewState::SoldierDiaryOverviewState(Base *base, size_t soldierId, SoldierInfoState *soldierInfoState) : _base(base), _soldierId(soldierId), _soldierInfoState(soldierInfoState) +SoldierDiaryOverviewState::SoldierDiaryOverviewState(Base *base, size_t soldierId, SoldierInfoState *soldierInfoState) : + _base(base), _soldierId(soldierId), _soldierInfoState(soldierInfoState), _doNotReset(false) { if (_base == 0) { @@ -175,6 +176,14 @@ SoldierDiaryOverviewState::~SoldierDiaryOverviewState() void SoldierDiaryOverviewState::init() { State::init(); + + // coming back from SoldierDiaryMissionState + if (_doNotReset) + { + _doNotReset = false; + return; + } + if (_list->empty()) { _game->popState(); @@ -328,6 +337,7 @@ void SoldierDiaryOverviewState::btnNextClick(Action *) void SoldierDiaryOverviewState::lstDiaryInfoClick(Action *) { int absoluteRowEntry = _lstDiary->getSelectedRow(); + _doNotReset = true; _game->pushState(new SoldierDiaryMissionState(_soldier, absoluteRowEntry)); } diff --git a/src/Basescape/SoldierDiaryOverviewState.h b/src/Basescape/SoldierDiaryOverviewState.h index 0e72989de7..2122e14f24 100755 --- a/src/Basescape/SoldierDiaryOverviewState.h +++ b/src/Basescape/SoldierDiaryOverviewState.h @@ -48,6 +48,7 @@ class SoldierDiaryOverviewState : public State Window *_window; Text *_txtTitle, *_txtMission, *_txtRating, *_txtDate, *_txtDeathTitle, *_txtDeathInfo, *_txtDeathDate; TextList *_lstDiary; + bool _doNotReset; public: /// Creates the Soldier Diary state. diff --git a/src/version.h b/src/version.h index 05bd1f55ab..f9f5030e2f 100644 --- a/src/version.h +++ b/src/version.h @@ -24,5 +24,5 @@ #define OPENXCOM_VERSION_NUMBER 7,14,2,0 #ifndef OPENXCOM_VERSION_GIT -#define OPENXCOM_VERSION_GIT " (v2024-09-22)" +#define OPENXCOM_VERSION_GIT " (v2024-09-23)" #endif