View Issue Details

IDProjectCategoryView StatusLast Update
0002659FSSCPHUDpublic2012-11-20 00:28
ReporterMastadon Assigned Toiss_mneur  
PrioritynormalSeverityminorReproducibilityalways
Status resolvedResolutionfixed 
PlatformN/AOSN/A 
Product Version3.6.14 RC5 
Summary0002659: Pressing the "target nearest attacker" selects a non-attacking-but-hostile target
DescriptionWhen you press the "target nearest attacker" key (defaults to "R"), you will instead of selecting a ship that is actually attacking you, select the closest hostile target if that target is closer to you.
Steps To Reproduce1. Open up the attached mission file using FSO 3.6.14 RC5.
2. Press "R".
TagsNo tags attached.

Relationships

has duplicate 0002154 closedGoober5000 Unarmed ships getting targeted by 'R' 

Activities

Mastadon

2012-05-28 14:52

reporter  

targetDistanceTest.fs2 (14,151 bytes)

Mastadon

2012-05-28 15:54

reporter  

hudtarget.cpp.patch (1,056 bytes)   
Index: code/hud/hudtarget.cpp
===================================================================
--- code/hud/hudtarget.cpp	(revision 8833)
+++ code/hud/hudtarget.cpp	(working copy)
@@ -10,6 +10,7 @@
 
 
 
+#include "ai/ai.h"
 #include "hud/hud.h"
 #include "hud/hudparse.h"
 #include "hud/hudartillery.h"
@@ -2089,10 +2090,12 @@
 		}
 	}
 
+	int initial_attacked_objnum = attacked_objnum;
 	if (attacked_objnum == -1) {
 		attacked_objnum = player_obj_index;
 	}
 
+
 	// check all turrets if for player.
 	esct.check_all_turrets = (attacked_objnum == player_obj_index);
 	esct.filter = filter;
@@ -2108,6 +2111,11 @@
 		// fill in rest of esct
 		esct.shipp = shipp;
 
+			// Filter out any target that is not actually targeting the player  --Mastadon
+		if ( (initial_attacked_objnum == player_obj_index) && (Ai_info[shipp->ai_index].target_objnum != player_obj_index) ) {
+			continue;
+		}
+
 		// check each shipp on list and update nearest obj and subsys
 		evaluate_ship_as_closest_target(&esct);
 		if (esct.min_distance < min_distance) {
hudtarget.cpp.patch (1,056 bytes)   

Mastadon

2012-05-28 15:58

reporter   ~0013618

The hudtarget.cpp.patch file contains a patch that should correct the bug.

NOTE: this fix is extracted from my recent patch (see http://www.hard-light.net/forums/index.php?topic=80906) that causes the "target nearest attacker" key to cycle through all attackers in a manner similar to the "target nearest hostile" key does. As such, this patch should probably not be applied to trunk, since my general feeling is that my patch will be applied to trunk once 3.6.14 is released.

iss_mneur

2012-06-01 02:06

developer   ~0013621

Fix committed to trunk@8842.

Goober5000

2012-06-05 16:13

administrator   ~0013633

This seems to have had unintended side effects. See Mjn.Mixael's post here:
http://www.hard-light.net/forums/index.php?topic=80906.msg1614088#msg1614088

Mastadon

2012-06-05 19:12

reporter   ~0013634

See my comments at: http://www.hard-light.net/forums/index.php?topic=80906.msg1614149#msg1614149

Goober5000

2012-06-11 05:11

administrator   ~0013658

MjnMixael says that revision 8848 fixed all outstanding issues with this ticket.

chief1983

2012-08-27 15:18

administrator   ~0013947

Just for clarity, there are actually 4 commits tied to this ticket: 8841, 8842, 8843, and 8848. Most of these commits aren't fixes for this bug, but related to other changes in hostile targeting behavior.

chief1983

2012-08-28 04:28

administrator   ~0013948

Last edited: 2012-08-28 04:51

Made my own custom version of a test mission, tested Mastadon's patch attached to this ticket specifically against 3.6.14. It does indeed correct this bug. However, if this bug dates back to retail, I'll be apt to let it remain in 3.6.14 for now, and we can discuss a behavior change along with all these other commits in 3.7. It seems to at least go back to 3.6.9, so I'm thinking this will stay the behavior in .14.

Related Changesets

fs2open: trunk r8842

2012-05-31 22:07

iss_mneur


Ported: N/A

Details Diff
From Mastadon: "target nearest attacker" now selects only *attacking* hostiles

Fixes 0002659
Affected Issues
0002659
mod - /trunk/fs2_open/code/hud/hudtarget.cpp Diff File

Issue History

Date Modified Username Field Change
2012-05-28 14:52 Mastadon New Issue
2012-05-28 14:52 Mastadon File Added: targetDistanceTest.fs2
2012-05-28 15:54 Mastadon File Added: hudtarget.cpp.patch
2012-05-28 15:58 Mastadon Note Added: 0013618
2012-06-01 02:06 iss_mneur Changeset attached => fs2open trunk r8842
2012-06-01 02:06 iss_mneur Note Added: 0013621
2012-06-01 02:06 iss_mneur Status new => resolved
2012-06-01 02:06 iss_mneur Resolution open => fixed
2012-06-05 16:13 Goober5000 Note Added: 0013633
2012-06-05 16:13 Goober5000 Assigned To => iss_mneur
2012-06-05 16:13 Goober5000 Status resolved => code review
2012-06-05 16:13 Goober5000 Resolution fixed => reopened
2012-06-05 19:12 Mastadon Note Added: 0013634
2012-06-11 05:11 Goober5000 Note Added: 0013658
2012-06-11 05:11 Goober5000 Status code review => resolved
2012-06-11 05:11 Goober5000 Resolution reopened => fixed
2012-08-27 15:18 chief1983 Note Added: 0013947
2012-08-28 04:28 chief1983 Note Added: 0013948
2012-08-28 04:51 chief1983 Note Edited: 0013948
2012-11-20 00:28 Goober5000 Relationship added has duplicate 0002154