2022-08-10 03:55 EDT

View Issue Details Jump to Notes ]
IDProjectCategoryView StatusLast Update
0001950FSSCP---------public2009-12-18 04:46
Assigned Tokarajorma 
PlatformIBM PCOSWindowsOS VersionVista SP1
Product Version3.6.11 
Target VersionFixed in Version3.6.11 
Summary0001950: primary-fired-since and secondary-fired-since trigger when bank is selected
Descriptionboth SEXPs basically work, but they have a bug.

This is how they work in the code (relevant lines)

last_fired = shipp->weapons.next_primary_fire_stamp[requested_bank] - (int)(wip->fire_wait * 1000);

if (timestamp() - delay < last_fired) {
    return SEXP_TRUE;

This is all fine to determine the time the gun was fired the last time.. except for one thing...

next_primary_fire_stamp is always set to NOW whenever the weapon bank is selected by the player, which is logical since that's the time he can fire it the next time.

Steps To ReproduceIf you have an event that sends a message like "Fox 2" if a missile was fired in the last 2 seconds, that message is already sent as soon as that missile bank is activated/selected. If it is the standard bank the message will most likely be sent right on mission start already.
Additional InformationYou better do not rely on the "when can I fire the weapon the next time" timestamp but rather add a new timestamp "fired last" to the weapon info scruct. This is much more relyable, although it's more work to code.

Working with additional checks to make the existing code work is very hard to test and will be hard to maintain.
TagsNo tags attached.
Attached Files




karajorma (administrator)

I was unaware it did that. But if that's the case then yeah I'm going to need to add another timestamp.


KeldorKatarn (reporter)

wasn't this already fixed?


karajorma (administrator)

Don't think so. I guess I forgot about it cause I didn't assign it to myself. I'll try to look at it this weekend.


KeldorKatarn (reporter)

Back then you showed me a build in which it works and in current nightly builds the bug isn't present anymore. I'm pretty sure you already did this.


karajorma (administrator)

Yeah, it's fixed. I didn't look back far enough when I checked if I'd fixed it. :D

-Issue History
Date Modified Username Field Change
2009-07-03 19:09 KeldorKatarn New Issue
2009-07-04 02:56 karajorma Note Added: 0011046
2009-12-10 01:46 KeldorKatarn Note Added: 0011394
2009-12-17 04:42 karajorma Status new => assigned
2009-12-17 04:42 karajorma Assigned To => karajorma
2009-12-17 04:43 karajorma Note Added: 0011426
2009-12-17 09:53 KeldorKatarn Note Added: 0011427
2009-12-18 04:46 karajorma Note Added: 0011429
2009-12-18 04:46 karajorma Status assigned => resolved
2009-12-18 04:46 karajorma Fixed in Version => 3.6.11
2009-12-18 04:46 karajorma Resolution open => fixed
+Issue History