2022-08-17 14:30 EDT

View Issue Details Jump to Notes ]
IDProjectCategoryView StatusLast Update
0001807FSSCPFREDpublic2008-11-09 00:11
Assigned Totaylor 
Product Version3.6.9 
Target VersionFixed in Version3.6.10 
Summary0001807: Hits-left not evaluating properly
DescriptionWhile testing Taylor's multi_test build I ran into a situation where 2 caps were open firing on each other even though their turrets were locked. Traced the problem down to an event based on hits-left (ship) < 96. The ship's is set to 96% hull in the ship editor. The event becomes true immediately at mission start. If I set it to 97% it works. The 96% starting value works in 3.6.9.
Additional InformationOriginally noticed testing Vidmaster's Operations mission Black Sun 1 in TBP using Taylor's multi test build. Confirmed in single and multi player in both TBP and FS2 using the latest Knightly build as well. Occurs weather or not special hits are enabled.
TagsNo tags attached.
Attached Files




karajorma (administrator)

You're basically dealing with a rounding error here. Hits-left works out the number as being 95.999998. Since that's less than 96% the SEXP triggers immediately.

Not entirely sure what can be done about that.


FUBAR-BDHR (developer)

Last edited: 2008-10-30 17:13

It's strange that it works in 3.6.9 though. Has something changed in the way that sexp evaluates since then? Has the way the initial hull percentage changed?

Doing the math for the actual mission with special hits 96% of 260000 hull should figure out to 249600. I don't see how it can round an even whole number divisible by 100 wrong. I could see there being a problem if the initial hull was 259999 or something.


phreak (developer)

floating point optimizations probably.


FUBAR-BDHR (developer)

Wonder how many missions this has the potential to break. I don't think it's an uncommon thing to have a ship with an initial hull value < 100% in a mission with a check to see if it falls below it's initial hull value.

The basic court martial for firing before your told to do so scenario.


phreak (developer)

A common solution would be to say 95.999998 == 96 by doing something like

fabs(actual_hits_left (95.999998) - goal_hits_left (96)) < delta, where delta is a really insignificant number like 0.00001


taylor (administrator)

The precent is an int value, so the problem just looks rounding related to me, rather than a fp issue. I don't see why a simple "+ 0.5f" couldn't deal with the problem.

Maybe I'm just missing something, but there seems to be way too much thought going into a five second fix.


taylor (administrator)

Should be fixed in my next multi test build.


taylor (administrator)


-Issue History
Date Modified Username Field Change
2008-10-30 02:53 FUBAR-BDHR New Issue
2008-10-30 02:53 FUBAR-BDHR File Added: turret_test.fs2
2008-10-30 15:56 karajorma Note Added: 0010136
2008-10-30 17:08 FUBAR-BDHR Note Added: 0010137
2008-10-30 17:13 FUBAR-BDHR Note Edited: 0010137
2008-10-30 17:14 phreak Note Added: 0010138
2008-10-30 17:22 FUBAR-BDHR Note Added: 0010139
2008-10-30 19:42 phreak Note Added: 0010140
2008-11-04 19:02 taylor Note Added: 0010157
2008-11-06 13:22 taylor Status new => assigned
2008-11-06 13:22 taylor Assigned To => taylor
2008-11-06 13:22 taylor Note Added: 0010159
2008-11-09 00:11 taylor Status assigned => resolved
2008-11-09 00:11 taylor Fixed in Version => 3.6.10
2008-11-09 00:11 taylor Resolution open => fixed
2008-11-09 00:11 taylor Note Added: 0010165
+Issue History