From 1960b373f1a3124053339e2febbc7990ef92cf7f Mon Sep 17 00:00:00 2001 From: KarolTrzeszczkowski Date: Sun, 3 Apr 2016 12:45:50 +0200 Subject: [PATCH] Solves #700 It turns out, that tower is not over powered in code battle mode. It never hits flying enemy robot. --- src/object/auto/autotower.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/object/auto/autotower.cpp b/src/object/auto/autotower.cpp index 23d8f2c0..ad436af7 100644 --- a/src/object/auto/autotower.cpp +++ b/src/object/auto/autotower.cpp @@ -271,12 +271,16 @@ CObject* CAutoTower::SearchTarget(Math::Vector &impact) CObject* best = nullptr; for (CObject* obj : CObjectManager::GetInstancePointer()->GetAllObjects()) { + int oTeam=obj->GetTeam(); + int myTeam=m_object->GetTeam(); ObjectType oType = obj->GetType(); if ( oType != OBJECT_MOTHER && oType != OBJECT_ANT && oType != OBJECT_SPIDER && oType != OBJECT_BEE && - oType != OBJECT_WORM ) continue; + oType != OBJECT_WORM && + (oTeam == myTeam || + oTeam == 0) ) continue; if ( !obj->GetDetectable() ) continue; // inactive?