No looting if you attack units in same faction

This commit is contained in:
Mike Hoffert 2014-07-19 16:44:11 -06:00
parent 68455a819f
commit 3cae2559c7
1 changed files with 25 additions and 22 deletions

View File

@ -2573,6 +2573,8 @@ void UnitUpdater::damage(Unit *attacker, const AttackSkillType* ast, Unit *attac
attacker->incKills(attacked->getTeam());
}
// Perform resource looting iff the attack is from a different faction
if(attacker->getFaction() != attacked->getFaction()) {
int lootableResourceCount = attacked->getType()->getLootableResourceCount();
for(int i = 0; i < lootableResourceCount; i++) {
LootableResource resource = attacked->getType()->getLootableResource(i);
@ -2600,6 +2602,7 @@ void UnitUpdater::damage(Unit *attacker, const AttackSkillType* ast, Unit *attac
attacker->getFaction()->incResourceAmount(resource.getResourceType(), min(resource.getAmountValue(), factionTotalResource));
}
}
}
switch(this->game->getGameSettings()->getPathFinderType()) {
case pfBasic: