View Issue Details

IDProjectCategoryView StatusLast Update
0001929Spring engineLuapublic2010-08-09 23:17
Reporterzwzsg Assigned ToKloot  
PrioritynormalSeverityminorReproducibilityrandom
Status resolvedResolutionfixed 
Product Version0.81.2.1 
Fixed in Version0.82.0+git 
Summary0001929: GetUnitNearestEnemy sometimes return the unit itself
DescriptionI had written a synced gadget that spawned a Dino unit belonging to Gaia, and then ran:
local target=Spring.GetUnitNearestEnemy(DinoID,nil,false)
(I wanted closest enemy, map-wide, even if out of los.)
I was testing it by speccing a KAIK 2v2.
I noticed that Spring.GetUnitNearestEnemy sometimes returned the DinoID itself, instead of the ID of an enemy unit.

It's not that a terrible bug because it's easy to rewrite a custom non buggy implementation of GetUnitNearestEnemy in Lua, nevertheless, I lost a few hours trying to debug my gadget until I found out the bug lied in GetUnitNearestEnemy, so to avoid that to other Lua coders, I guess it ought to be reported.

I don't recall having that bug when I was playing a team instead of speccing AIs, maybe this plays a role? Also, maybe that I used a Gaia unit played a part?
TagsNo tags attached.
Checked infolog.txt for Errors

Activities

tvo

2010-06-11 00:00

reporter   ~0004969

Possibly Gaia isn't allied to itself?

(Yeah, it's actually possible [in certain parts of the code] for an allyteam to not be allied to itself.)

Kloot

2010-06-11 02:00

developer   ~0004970

May also have been the result of the bug fixed by http://github.com/spring/spring/commit/284731c07e70d0372aaa34cb8a5d076416651037 .

hoijui

2010-06-11 08:55

reporter   ~0004971

Z, if possible, please test with spring master, or wait for the RC.

zwzsg

2010-08-09 23:14

reporter   ~0005229

Indeed 0.81.2.1 gaia was not allied with itself.
In the third RC (0.82.1) gaia is now allied with itself, and Spring.GetUnitNearestEnemy doesn't return its first argument.

So, fixed.

Issue History

Date Modified Username Field Change
2010-05-17 14:43 zwzsg New Issue
2010-06-11 00:00 tvo Note Added: 0004969
2010-06-11 02:00 Kloot Note Added: 0004970
2010-06-11 08:55 hoijui Note Added: 0004971
2010-06-11 08:55 hoijui Status new => feedback
2010-08-09 23:14 zwzsg Note Added: 0005229
2010-08-09 23:17 Kloot Status feedback => resolved
2010-08-09 23:17 Kloot Fixed in Version => 0.82.0+git
2010-08-09 23:17 Kloot Resolution open => fixed
2010-08-09 23:17 Kloot Assigned To => Kloot