View Issue Details

IDProjectCategoryView StatusLast Update
0001950FSSCP---------public2009-12-18 09:46
ReporterKeldorKatarn Assigned Tokarajorma  
PrioritynormalSeverityminorReproducibilityalways
Status resolvedResolutionfixed 
PlatformIBM PCOSWindowsOS VersionVista SP1
Product Version3.6.11 
Fixed 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.

Activities

karajorma

2009-07-04 06:56

administrator   ~0011046

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

KeldorKatarn

2009-12-10 06:46

reporter   ~0011394

wasn't this already fixed?

karajorma

2009-12-17 09:43

administrator   ~0011426

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

2009-12-17 14:53

reporter   ~0011427

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

2009-12-18 09:46

administrator   ~0011429

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 23:09 KeldorKatarn New Issue
2009-07-04 06:56 karajorma Note Added: 0011046
2009-12-10 06:46 KeldorKatarn Note Added: 0011394
2009-12-17 09:42 karajorma Status new => assigned
2009-12-17 09:42 karajorma Assigned To => karajorma
2009-12-17 09:43 karajorma Note Added: 0011426
2009-12-17 14:53 KeldorKatarn Note Added: 0011427
2009-12-18 09:46 karajorma Note Added: 0011429
2009-12-18 09:46 karajorma Status assigned => resolved
2009-12-18 09:46 karajorma Fixed in Version => 3.6.11
2009-12-18 09:46 karajorma Resolution open => fixed