2025-07-20 17:02 CEST

View Issue Details Jump to Notes ]
IDProjectCategoryView StatusLast Update
0000560Spring engineGeneralpublic2007-07-18 17:40
Reporterimbaczek 
Assigned Totvo 
PrioritynormalSeverityminorReproducibilityalways
StatusresolvedResolutionfixed 
Product Version 
Target VersionFixed in Version 
Summary0000560: [patch] TargetBorder broken on vertical targets
DescriptionTargetBorder does not take the correct vertical distance into account. This patch fixes this.
Additional InformationThe vertical distance was calculated using weaponPos and target center - should be weaponPos and point on the radius*TargetBorder.
TagsNo tags attached.
Checked infolog.txt for Errors
Attached Files
  • patch file icon fix_targetborder_vertical_behaviour.patch (564 bytes) 2007-07-18 00:31 -
    Index: rts/Sim/Weapons/Weapon.cpp
    ===================================================================
    --- rts/Sim/Weapons/Weapon.cpp	(revision 3995)
    +++ rts/Sim/Weapons/Weapon.cpp	(working copy)
    @@ -567,9 +567,9 @@
     
     	float r;
     	if (!unit || cylinderTargetting < 0.01) {
    -		r=GetRange2D(owner->pos.y-pos.y);
    +		r=GetRange2D(owner->pos.y-(owner->pos+dif).y);
     	} else {
    -		if (cylinderTargetting * unit->radius > owner->pos.y-pos.y) {
    +		if (cylinderTargetting * unit->radius > owner->pos.y-(owner->pos+dif).y) {
     			r = GetRange2D(0);
     		} else {
     			r = 0;
    
    patch file icon fix_targetborder_vertical_behaviour.patch (564 bytes) 2007-07-18 00:31 +
  • patch file icon fix_targetborder_vertical_behaviour_v2.patch (872 bytes) 2007-07-18 08:26 -
    Index: rts/Sim/Weapons/Weapon.cpp
    ===================================================================
    --- rts/Sim/Weapons/Weapon.cpp	(revision 3995)
    +++ rts/Sim/Weapons/Weapon.cpp	(working copy)
    @@ -550,6 +550,7 @@
     		return false;
     
     	float3 dif=pos-weaponPos;
    +	float heightDiff;
     
     	if (targetBorder != 0 && unit) {
     		float3 diff(dif);
    @@ -563,13 +564,16 @@
     			//logOutput << "outside\n";
     		}
     		//geometricObjects->AddLine(weaponMuzzlePos, weaponMuzzlePos+dif, 3, 0, 16);
    +		heightDiff = pos.y - (weaponPos.y + dif.y);
    +	} else {
    +		heightDiff = dif.y;
     	}
     
     	float r;
     	if (!unit || cylinderTargetting < 0.01) {
    -		r=GetRange2D(owner->pos.y-pos.y);
    +		r=GetRange2D(heightDiff);
     	} else {
    -		if (cylinderTargetting * unit->radius > owner->pos.y-pos.y) {
    +		if (cylinderTargetting * unit->radius > heightDiff) {
     			r = GetRange2D(0);
     		} else {
     			r = 0;
    
    patch file icon fix_targetborder_vertical_behaviour_v2.patch (872 bytes) 2007-07-18 08:26 +
  • patch file icon fix_targetborder_vertical_behaviour_v3.patch (894 bytes) 2007-07-18 08:32 -
    Index: rts/Sim/Weapons/Weapon.cpp
    ===================================================================
    --- rts/Sim/Weapons/Weapon.cpp	(revision 3995)
    +++ rts/Sim/Weapons/Weapon.cpp	(working copy)
    @@ -550,6 +550,7 @@
     		return false;
     
     	float3 dif=pos-weaponPos;
    +	float heightDiff;
     
     	if (targetBorder != 0 && unit) {
     		float3 diff(dif);
    @@ -563,13 +564,16 @@
     			//logOutput << "outside\n";
     		}
     		//geometricObjects->AddLine(weaponMuzzlePos, weaponMuzzlePos+dif, 3, 0, 16);
    +		heightDiff = owner->pos.y - (weaponPos.y + dif.y);
    +	} else {
    +		heightDiff = owner->pos.y - pos.y;
     	}
     
     	float r;
     	if (!unit || cylinderTargetting < 0.01) {
    -		r=GetRange2D(owner->pos.y-pos.y);
    +		r=GetRange2D(heightDiff);
     	} else {
    -		if (cylinderTargetting * unit->radius > owner->pos.y-pos.y) {
    +		if (cylinderTargetting * unit->radius > heightDiff) {
     			r = GetRange2D(0);
     		} else {
     			r = 0;
    
    patch file icon fix_targetborder_vertical_behaviour_v3.patch (894 bytes) 2007-07-18 08:32 +

-Relationships
+Relationships

-Notes

~0001007

imbaczek (reporter)

Please disregard the previous two patches, guess I was too tired while making the first two.

~0001011

tvo (reporter)

committed
+Notes

-Issue History
Date Modified Username Field Change
2007-07-18 00:31 imbaczek New Issue
2007-07-18 00:31 imbaczek File Added: fix_targetborder_vertical_behaviour.patch
2007-07-18 08:26 imbaczek File Added: fix_targetborder_vertical_behaviour_v2.patch
2007-07-18 08:31 imbaczek Note Added: 0001007
2007-07-18 08:32 imbaczek File Added: fix_targetborder_vertical_behaviour_v3.patch
2007-07-18 17:40 tvo Status new => resolved
2007-07-18 17:40 tvo Resolution open => fixed
2007-07-18 17:40 tvo Assigned To => tvo
2007-07-18 17:40 tvo Note Added: 0001011
+Issue History