View Issue Details

IDProjectCategoryView StatusLast Update
0002533FSSCPSEXPspublic2011-11-09 09:24
ReporterAxem Assigned ToEli2  
PrioritynormalSeverityminorReproducibilityalways
Status resolvedResolutionfixed 
Summary0002533: is-event-true-msecs doesn't work past 32,768 ms
DescriptionOddly enough this is (2^16)/2! How interesting!

Anything above the magic number will have the event happen right away.

Repro mission attached.

Press 1 to have a ship warp in 30,000ms from the time pressed.
Press 2 to have a ship warp in 40,000ms from the time pressed.

Use time compression to wait out the longer periods of time!
TagsNo tags attached.

Activities

2011-11-02 01:11

 

MSecsTest.fs2 (4,986 bytes)

Eli2

2011-11-02 02:46

developer   ~0012916

Attached fix.

The_E

2011-11-02 11:39

administrator   ~0012917

Committed to trunk in rev 7938

The_E

2011-11-05 19:19

administrator   ~0012929

Reverted the change again. This fix seems to introduce a behavioural change, breaking existing missions.

2011-11-06 01:53

 

eventDelayFix2.svn.patch (578 bytes)   
Index: code/parse/sexp.cpp
===================================================================
--- code/parse/sexp.cpp
+++ code/parse/sexp.cpp
@@ -12650,10 +12650,15 @@ int sexp_event_delay_status( int n, int want_true, bool use_msecs = false)
 		return SEXP_FALSE;
 	}
 
-	delay = i2f(eval_num(CDR(n)));
+	uint64_t tempDelay = eval_num(CDR(n));
 
 	if (use_msecs) {
-		delay = delay / 1000l;
+		tempDelay = tempDelay << 16;
+		tempDelay = tempDelay / 1000;
+
+		delay = (fix) tempDelay;
+	} else {
+		delay = i2f(tempDelay);
 	}
 
 	for (i = 0; i < Num_mission_events; i++ ) {
eventDelayFix2.svn.patch (578 bytes)   

Eli2

2011-11-06 01:54

developer   ~0012930

Attached a less invasive patch.

The_E

2011-11-09 09:24

administrator   ~0012944

Tested and committed.

Issue History

Date Modified Username Field Change
2011-11-02 01:11 Axem New Issue
2011-11-02 01:11 Axem File Added: MSecsTest.fs2
2011-11-02 02:46 Eli2 File Added: eventTrueMsecsFix.patch
2011-11-02 02:46 Eli2 Note Added: 0012916
2011-11-02 11:39 The_E Note Added: 0012917
2011-11-02 11:39 The_E Status new => resolved
2011-11-02 11:39 The_E Resolution open => fixed
2011-11-02 11:39 The_E Assigned To => The_E
2011-11-02 11:39 The_E Assigned To The_E => Eli2
2011-11-02 11:39 The_E Status resolved => feedback
2011-11-02 11:39 The_E Resolution fixed => reopened
2011-11-02 11:39 The_E Status feedback => assigned
2011-11-02 11:40 The_E Status assigned => resolved
2011-11-02 11:40 The_E Resolution reopened => fixed
2011-11-05 19:19 The_E Note Added: 0012929
2011-11-05 19:19 The_E Status resolved => feedback
2011-11-05 19:19 The_E Resolution fixed => reopened
2011-11-06 01:53 Eli2 File Added: eventDelayFix2.svn.patch
2011-11-06 01:53 Eli2 File Deleted: eventTrueMsecsFix.patch
2011-11-06 01:54 Eli2 Note Added: 0012930
2011-11-06 04:58 Eli2 Status feedback => new
2011-11-09 09:24 The_E Note Added: 0012944
2011-11-09 09:24 The_E Status new => resolved
2011-11-09 09:24 The_E Resolution reopened => fixed