Quote Originally Posted by AthenaOfDelphi View Post
I still stand by what I said.... do this....

Code:
If (lightsource[i].sourceType=GUNFIRE) then
begin
  // Do something
end;
A single, integer comparison is going to be faster than the sample code. Four floating point comparisons (which as we've discussed are flakey) and the logic to combine their results. I'd go for the single integer comparison any day (in this instance).
I might end up doing this if the current code becomes a bottleneck. The code is only called very rarely during runtime, though, (once whenever a weapon has ended firing to check if the light source associated with the character holding the gun should be deactivated -- which probably only happens once every minute or so during play, if that (it's going to be a sneaking/assassination game, not a guns blazing action game)) so I currently prefer to use the existing variables instead of adding new variables that will only be used rarely. Maybe that's just my personal coding preference, or something.