From 1d2543fb6a9d76f33d581b56bd30587dff0d8c06 Mon Sep 17 00:00:00 2001 From: mathusummut Date: Sun, 10 Jun 2018 17:16:04 +0200 Subject: [PATCH] Right click no longer attacks your teammates and yourself --- source/glest_game/type_instances/unit.cpp | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/source/glest_game/type_instances/unit.cpp b/source/glest_game/type_instances/unit.cpp index 1d17ed258..1b071f950 100644 --- a/source/glest_game/type_instances/unit.cpp +++ b/source/glest_game/type_instances/unit.cpp @@ -2725,14 +2725,10 @@ namespace Glest { // The default command is executed when a unit is produced and sent to a meeting point // or when the unit is selected and right clicked to a position. if (commandType == NULL) { - // move - // commandType = type->getFirstCtOfClass (ccMove); - - // attack - // Is the unit class warrior? if yes, attack by default, else walk. - commandType = - type->getFirstCtOfClass(this->getType()-> - isOfClass(ucWarrior) ? ccAttack : ccMove); + CommandClass command = ccMove; //default command + if (this->getType()->isOfClass(ucWarrior) && (targetUnit == nullptr || this->getTeam() != targetUnit->getTeam())) + command = ccAttack; + commandType = type->getFirstCtOfClass(command); // FIXME: I think a better solution would be to have a hotkey for this, // the user can decide, and toggle in-game -andy5995 2018-02-03