@@ -449,11 +449,11 @@ bool SoldierDiary::manageCommendations(Ruleset *rules)
449449 {
450450 int count = 0 ; // Each AND vector has to match the award criteria
451451 // Loop over the KILLS
452- for (std::vector<SoldierDiaryKills*>::const_iterator singleKill = _killList-> begin (); singleKill != _killList-> end (); ++singleKill)
452+ for (std::vector<SoldierDiaryKills*>::const_iterator singleKill = _killList. begin (); singleKill != _killList. end (); ++singleKill)
453453 {
454454 bool foundMatch = true ;
455455 // Loop over the DETAILs of the AND vector
456- for (std::vector<std::string>::const_iterator detail = (* andCriteria). second -> begin (); detail != (* andCriteria). second -> end (); ++detail)
456+ for (std::vector<std::string>::const_iterator detail = andCriteria-> second . begin (); detail != andCriteria-> second . end (); ++detail)
457457 {
458458 // See if we find no matches with any criteria. If so, break and try the next kill.
459459 if ( (*singleKill)->getAlienRank () != (*detail) && (*singleKill)->getAlienRace () != (*detail) &&
@@ -482,15 +482,15 @@ bool SoldierDiary::manageCommendations(Ruleset *rules)
482482 {
483483 int count = 0 ; // Each AND vector has to match the award criteria
484484 // Loop over MISSIONS
485- for (std::vector<SoldierDiaryEntries*>::const_iterator singleMission = _diaryEntries-> begin (); singleMission != _diaryEntries-> end (); ++singleMission)
485+ for (std::vector<SoldierDiaryEntries*>::const_iterator singleMission = _diaryEntries. begin (); singleMission != _diaryEntries. end (); ++singleMission)
486486 {
487487 // Loop over KILLS
488488 // These kills are confined to the mission; kills won't be borrowed from other missions for commendation purposes
489- for (std::vector<SoldierDiaryKills*>::const_iterator singleKill = (*singleMission)->getMissionKills ()->begin (); singleKill != (*singleMission)->getMissionKills ()->end (); ++singleKill)
489+ for (std::vector<SoldierDiaryKills*>::const_iterator singleKill = (*singleMission)->getMissionKillsReference ()->begin (); singleKill != (*singleMission)->getMissionKillsReference ()->end (); ++singleKill)
490490 {
491491 bool foundMatch = true ;
492492 // Loop over the DETAILs of the AND vector
493- for (std::vector<std::string>::const_iterator detail = (* andCriteria). second -> begin (); detail != (* andCriteria). second -> end (); ++detail)
493+ for (std::vector<std::string>::const_iterator detail = andCriteria-> second . begin (); detail != andCriteria-> second . end (); ++detail)
494494 {
495495 // See if we find no matches with any criteria. If so, break and try the next kill.
496496 if ( (*singleKill)->getAlienRank () != (*detail) && (*singleKill)->getAlienRace () != (*detail) &&
@@ -524,32 +524,33 @@ bool SoldierDiary::manageCommendations(Ruleset *rules)
524524 // Loop over the AND vectors
525525 for (std::map<int , std::vector<std::string> >::const_iterator andCriteria = orCriteria->begin (); andCriteria != orCriteria->end (); ++andCriteria)
526526 {
527- int count = 0 ; // How many AND vectors (list of DETAILs) have been successful
527+ int count = 1 ; // How many AND vectors (list of DETAILs) have been successful
528528 int killThisTurn = 0 ;
529529 int killLastTurn = -1 ;
530530 bool goToNextTurn = false ;
531531 // Loop over the KILLS
532- for (std::vector<SoldierDiaryKills*>::const_iterator singleKill = _killList-> begin (); singleKill != _killList-> end (); ++singleKill)
532+ for (std::vector<SoldierDiaryKills*>::const_iterator singleKill = _killList. begin (); singleKill != _killList. end (); ++singleKill)
533533 {
534534 // Set kill turns
535535 killThisTurn = (*singleKill)->getTurn ();
536- if (singleKill != _killList-> begin ())
536+ if (singleKill != _killList. begin ())
537537 {
538538 --singleKill;
539539 killLastTurn = (*singleKill)->getTurn ();
540540 ++singleKill;
541541 }
542542 // Skip kill-groups that we already got an award for
543543 // Skip kills that are inbetween turns
544- if ( killThisTurn == killLastTurn && goToNextKill ) continue ;
544+ if ( killThisTurn == killLastTurn && goToNextTurn ) continue ;
545545 else if ( killThisTurn != killLastTurn )
546546 {
547+ count = 1 ; // Reset
547548 goToNextTurn = false ;
548549 continue ;
549550 }
550551 bool foundMatch = true ;
551552 // Loop over the DETAILs of the AND vector
552- for (std::vector<std::string>::const_iterator detail = (* andCriteria). second -> begin (); detail != (* andCriteria). second -> end (); ++detail)
553+ for (std::vector<std::string>::const_iterator detail = andCriteria-> second . begin (); detail != andCriteria-> second . end (); ++detail)
553554 {
554555 // See if we find no matches with any criteria. If so, break and try the next kill.
555556 if ( (*singleKill)->getAlienRank () != (*detail) && (*singleKill)->getAlienRace () != (*detail) &&
@@ -783,6 +784,14 @@ std::vector<SoldierDiaryKills*> SoldierDiaryEntries::getMissionKills() const
783784 return _missionStatistics->kills ;
784785}
785786
787+ /* *
788+ *
789+ */
790+ std::vector<SoldierDiaryKills*> *SoldierDiaryEntries::getMissionKillsReference ()
791+ {
792+ return &_missionStatistics->kills ;
793+ }
794+
786795/* *
787796 *
788797 */
0 commit comments