From 7cac68c33581af1f107804a785a0f0d7fb95ac61 Mon Sep 17 00:00:00 2001 From: mr-russ <> Date: Sun, 21 Sep 2003 06:13:51 +0000 Subject: [PATCH] RevealAttacker does what it should, attack the attacker --- doc/ChangeLog.html | 1 + src/stratagus/missile.cpp | 15 --------------- src/unit/unit.cpp | 6 +++++- 3 files changed, 6 insertions(+), 16 deletions(-) diff --git a/doc/ChangeLog.html b/doc/ChangeLog.html index 71062464a..af7cd1c9e 100644 --- a/doc/ChangeLog.html +++ b/doc/ChangeLog.html @@ -36,6 +36,7 @@ <li>Future 1.19 Release<p> <ul> <li>++ + <li>RevealAttacker does what it should, attack the attacker (from Russell Smith). <li>DrawUnitInfo uses Resource Names instead of hard coded (from Russell Smith). <li>Use first races UI by default, it should be defined (from Russell Smith). <li>Allow victory/defeat backgrounds to not be set (from Russell Smith). diff --git a/src/stratagus/missile.cpp b/src/stratagus/missile.cpp index 098e864cd..56baab840 100644 --- a/src/stratagus/missile.cpp +++ b/src/stratagus/missile.cpp @@ -526,21 +526,6 @@ global void FireMissile(Unit* unit) // FIXME: goal is already dead, but missile could hit others? } - if( goal && RevealAttacker ) { // attacking units are seen - Unit* target; - // FIXME: Don't use UnitTypeByIdent during runtime. - target = MakeUnit(UnitTypeByIdent("unit-reveal-attacker"), goal->Player); - target->Orders[0].Action = UnitActionStill; - target->HP = 0; - target->X = unit->X; - target->Y = unit->Y; - target->TTL=GameCycle+CYCLES_PER_SECOND+CYCLES_PER_SECOND/2; - target->CurrentSightRange=target->Stats->SightRange; - // Little hack for the way the macro works :) - MapMarkUnitOnBoardSight(goal,unit); - CheckUnitToBeDrawn(target); - } - // // None missile hits immediately! // diff --git a/src/unit/unit.cpp b/src/unit/unit.cpp index 5581cde0e..e788afe5e 100644 --- a/src/unit/unit.cpp +++ b/src/unit/unit.cpp @@ -3325,7 +3325,11 @@ global void HitUnit(Unit* attacker,Unit* target,int damage) // if( !type->Coward ) { if( type->CanAttack && target->Stats->Speed ) { - goal=AttackUnitsInReactRange(target); + if( RevealAttacker && CanTarget(target->Type,attacker->Type)) { // Reveal Unit that is attacking + goal=attacker; + } else { + goal=AttackUnitsInReactRange(target); + } if( goal ) { if( target->SavedOrder.Action==UnitActionStill ) { // FIXME: should rewrite command handling