From c5a14dfbeaae2f6085b69a7f93e7d6d91b7349d3 Mon Sep 17 00:00:00 2001 From: Javier Sancho Date: Thu, 22 Feb 2018 16:57:17 +0100 Subject: [PATCH] Friends fight with true enemies, before they attacked player but hurting enemies --- Source/GameTick.cpp | 4 +++- Source/Objects/Person.hpp | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/Source/GameTick.cpp b/Source/GameTick.cpp index f96dbd4..285c80c 100644 --- a/Source/GameTick.cpp +++ b/Source/GameTick.cpp @@ -2270,7 +2270,9 @@ void doAttacks() Person::players[k]->hasvictim = 0; if (Person::players.size() > 1) { for (unsigned i = 0; i < Person::players.size(); i++) { - if (i == k || !(k == 0 || i == 0)) { + if (i == k || + (Person::players[k]->isPlayerTeam() && Person::players[i]->isPlayerTeam()) || + !(Person::players[k]->isPlayerTeam() || Person::players[i]->isPlayerTeam())) { continue; } if (!Person::players[k]->hasvictim) { diff --git a/Source/Objects/Person.hpp b/Source/Objects/Person.hpp index 22c76eb..3c415a5 100644 --- a/Source/Objects/Person.hpp +++ b/Source/Objects/Person.hpp @@ -407,6 +407,7 @@ public: bool hasWeapon() { return (weaponactive != -1); } bool isPlayerControlled() { return (aitype == playercontrolled); } bool isPlayerFriend() { return isplayerfriend; } + bool isPlayerTeam() { return isPlayerControlled() || isPlayerFriend(); } }; const int maxplayers = 10; -- 2.39.2