]> git.jsancho.org Git - lugaru.git/commitdiff
Friends fight with true enemies, before they attacked player but hurting enemies improvements
authorJavier Sancho <jsf@jsancho.org>
Thu, 22 Feb 2018 15:57:17 +0000 (16:57 +0100)
committerJavier Sancho <jsf@jsancho.org>
Thu, 22 Feb 2018 15:57:17 +0000 (16:57 +0100)
Source/GameTick.cpp
Source/Objects/Person.hpp

index f96dbd4a8de16ab37619181a1ef2402c92038d31..285c80cff87fec2740a2d486c5657a4b5d021ef7 100644 (file)
@@ -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) {
index 22c76eb17c4e82fd9038352c5e35ad2b022067b4..3c415a5bc829664d938e1fccdc9be6c69187a349 100644 (file)
@@ -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;