@@ -658,19 +658,30 @@ void BattlescapeGame::checkForCasualties(BattleItem *murderweapon, BattleUnit *m
658658 if ((*i)->getId () == victim->getMurdererId ())
659659 {
660660 murderer = (*i);
661- // Now assign the missing kill stats.
662- killStatMission = _save->getGeoscapeSave ()->getMissionStatistics ()->size ();
663-
661+ // Now find a plausible weapon. First a gun loaded with IN ammo, then a gun that can use IN ammo found in the inventory,
662+ // then simlpy the IN thing.
664663 for (std::vector<BattleItem*>::iterator it = murderer->getInventory ()->begin (); it != murderer->getInventory ()->end (); ++it)
665664 {
666- if ((*it)->getRules ()->getDamageType () == DT_IN )
665+ if ((*it)->getRules ()->getBattleType () == BT_FIREARM && (*it)-> getAmmoItem ()-> getRules ()-> getDamageType () == DT_IN )
667666 {
668- killStatWeaponAmmo = (*it)->getRules ()->getName ();
669- killStatWeapon = killStatWeaponAmmo;
667+ killStatWeaponAmmo = (*it)->getAmmoItem ()->getRules ()->getName ();
668+ killStatWeapon = (*it)->getRules ()->getName ();
669+ break ;
670670 }
671- for (std::vector<std::string>::iterator c = ( *it)->getRules ()->getCompatibleAmmo ()-> begin (); c != (*it)-> getRules ()-> getCompatibleAmmo ()-> end (); ++c )
671+ else if (( *it)->getRules ()->getDamageType () == DT_IN )
672672 {
673- if ((*c) == killStatWeaponAmmo)
673+ killStatWeaponAmmo = (*it)->getRules ()->getName ();
674+ if ((*it)->getRules ()->getBattleType () == BT_AMMO )
675+ {
676+ for (std::vector<std::string>::iterator c = (*it)->getRules ()->getCompatibleAmmo ()->begin (); c != (*it)->getRules ()->getCompatibleAmmo ()->end (); ++c)
677+ {
678+ if ((*c) == killStatWeaponAmmo)
679+ {
680+ killStatWeapon = (*it)->getRules ()->getName ();
681+ }
682+ }
683+ }
684+ else if ((*it)->getRules ()->getBattleType () == BT_GRENADE || (*it)->getRules ()->getBattleType () == BT_PROXIMITYGRENADE )
674685 {
675686 killStatWeapon = (*it)->getRules ()->getName ();
676687 }
0 commit comments