@@ -40,7 +40,8 @@ SoldierDiary::SoldierDiary() : _killList(), _regionTotal(), _countryTotal(), _ty
4040 _totalShotByFriendlyCounter(0 ), _totalShotFriendlyCounter(0 ), _ironManTotal(0 ), _importantMissionTotal(0 ), _longDistanceHitCounterTotal(0 ),
4141 _lowAccuracyHitCounterTotal(0 ), _shotsFiredCounterTotal(0 ), _shotsLandedCounterTotal(0 ), _shotAtCounter10in1Mission(0 ), _hitCounter5in1Mission(0 ),
4242 _reactionFireTotal(0 ), _timesWoundedTotal(0 ), _valiantCruxTotal(0 ), _KIA(0 ), _trapKillTotal(0 ), _alienBaseAssaultTotal(0 ), _allAliensKilledTotal(0 ), _allAliensStunnedTotal(0 ),
43- _woundsHealedTotal(0 ), _allUFOs(0 ), _allMissionTypes(0 ), _statGainTotal(0 ), _revivedUnitTotal(0 ), _wholeMedikitTotal(0 ), _braveryGainTotal(0 )
43+ _woundsHealedTotal(0 ), _allUFOs(0 ), _allMissionTypes(0 ), _statGainTotal(0 ), _revivedUnitTotal(0 ), _wholeMedikitTotal(0 ), _braveryGainTotal(0 ), _bestOfRank(0 ),
44+ _bestSoldier(false )
4445{
4546}
4647/* *
@@ -116,6 +117,8 @@ void SoldierDiary::load(const YAML::Node& node)
116117 _revivedUnitTotal = node[" _revivedUnitTotal" ].as <int >(_revivedUnitTotal);
117118 _wholeMedikitTotal = node[" _wholeMedikitTotal" ].as <int >(_wholeMedikitTotal);
118119 _braveryGainTotal = node[" _braveryGainTotal" ].as <int >(_braveryGainTotal);
120+ _bestOfRank = node[" _bestOfRank" ].as <int >(_bestOfRank);
121+ _bestSoldier = node[" _bestSoldier" ].as <bool >(_bestSoldier);
119122}
120123/* *
121124 * Saves the diary to a YAML file.
@@ -171,6 +174,8 @@ YAML::Node SoldierDiary::save() const
171174 if (_revivedUnitTotal) node[" _revivedUnitTotal" ] = _revivedUnitTotal;
172175 if (_wholeMedikitTotal) node[" _wholeMedikitTotal" ] = _wholeMedikitTotal;
173176 if (_braveryGainTotal) node[" _braveryGainTotal" ] = _braveryGainTotal;
177+ if (_bestOfRank) node[" _bestOfRank" ] = _bestOfRank;
178+ if (_bestSoldier) node[" _bestSoldier" ] = _bestSoldier;
174179 return node;
175180}
176181/* *
@@ -363,7 +368,9 @@ bool SoldierDiary::manageCommendations(Ruleset *rules)
363368 ((*j).first == " totalStatGain" && _statGainTotal < (*j).second .at (nextCommendationLevel[" noNoun" ])) ||
364369 ((*j).first == " totalRevives" && _revivedUnitTotal < (*j).second .at (nextCommendationLevel[" noNoun" ])) ||
365370 ((*j).first == " totalWholeMedikit" && _wholeMedikitTotal < (*j).second .at (nextCommendationLevel[" noNoun" ])) ||
366- ((*j).first == " totalBraveryGain" && _braveryGainTotal < (*j).second .at (nextCommendationLevel[" noNoun" ])) )
371+ ((*j).first == " totalBraveryGain" && _braveryGainTotal < (*j).second .at (nextCommendationLevel[" noNoun" ])) ||
372+ ((*j).first == " bestOfRank" && _bestOfRank < (*j).second .at (nextCommendationLevel[" noNoun" ])) ||
373+ ((*j).first == " bestSoldier" && (int )_bestSoldier < (*j).second .at (nextCommendationLevel[" noNoun" ])) )
367374 {
368375 awardCommendationBool = false ;
369376 break ;
@@ -754,6 +761,21 @@ void SoldierDiary::awardOriginalEightCommendation()
754761{
755762 _commendations.push_back (new SoldierCommendations (" STR_MEDAL_ORIGINAL8_NAME" , " NoNoun" ));
756763}
764+ /* *
765+ * Award post-humous best-of commendation.
766+ */
767+ void SoldierDiary::awardBestOfRank (SoldierRank rank)
768+ {
769+ _bestOfRank = (int )rank + 1 ;
770+ }
771+ /* *
772+ * Award post-humous best-of commendation.
773+ */
774+ void SoldierDiary::awardBestOverall ()
775+ {
776+ _bestSoldier = true ;
777+ }
778+
757779/* *
758780 * Initializes a new commendation entry from YAML.
759781 * @param node YAML node.
0 commit comments