View Issue Details

IDProjectCategoryView StatusLast Update
0002564FSSCPmath-relatedpublic2012-01-15 11:17
ReporterEchelon9 Assigned ToEchelon9  
PrioritynormalSeveritymajorReproducibilityalways
Status resolvedResolutionfixed 
Product Version3.6.14 RC2 
Target Version3.6.14 RC2Fixed in Version3.6.14 RC2 
Summary0002564: GCC warning: Use of NULL in arithmetic operation in ship.cpp (winfo_p->pre_launch_snd != NULL)
DescriptionA NULL comparison check here is incorrect, as we are checking against an int not a pointer.

The correct check is against the value assigned to pre_launch_snd when a nonexistent sound was provided from the tables.

The table parsing ultimately calls parse_sound_core():

Warning(LOCATION, "%s sound index out of range on '%s'. Must be between 0 and %d. Forcing to -1 (Nonexistent sound).\n", tag, object_name, size_to_check);
TagsNo tags attached.

Activities

Echelon9

2012-01-15 00:59

developer   ~0013047

Fixed in revision 8209

Zacam

2012-01-15 10:33

administrator   ~0013052

Apparently, -1 in place of NULL causes Primary Weapons fire to play the Missile Lock On sound instead. (Only for single shots, press and hold to repeat fire, and the actual primary weapon sfx comes through)

Eli2

2012-01-15 10:44

developer  

preLaunchSndFix.svn.patch (574 bytes)   
Index: code/weapon/weapons.cpp
===================================================================
--- code/weapon/weapons.cpp
+++ code/weapon/weapons.cpp
@@ -856,11 +856,14 @@ void init_weapon_entry(int weap_info_index)
 	wip->catchup_pixels_per_sec = 50;
 	wip->catchup_pixel_penalty = 50;
 	wip->seeker_strength = 1.0f;
-	
+
 	wip->swarm_count = -1;
 	// *Default is 150  -Et1
 	wip->SwarmWait = SWARM_MISSILE_DELAY;
 	
+	wip->pre_launch_snd = -1;
+	wip->pre_launch_snd_min_interval = 0;
+
 	wip->launch_snd = -1;
 	wip->impact_snd = -1;
 	wip->disarmed_impact_snd = -1;
preLaunchSndFix.svn.patch (574 bytes)   

Eli2

2012-01-15 10:44

developer   ~0013053

attached fix

Echelon9

2012-01-15 11:12

developer   ~0013055

The NULL to -1 change has revealed a related bug in init_weapon_entry() which Eli2 has helpfully provided a patch for -- that patch should be good to go in trunk.

Echelon9

2012-01-15 11:17

developer   ~0013056

Related issue that was uncovered has been fixed in 8228.

Issue History

Date Modified Username Field Change
2012-01-14 00:06 Echelon9 New Issue
2012-01-14 00:06 Echelon9 Status new => assigned
2012-01-14 00:06 Echelon9 Assigned To => Echelon9
2012-01-15 00:59 Echelon9 Note Added: 0013047
2012-01-15 00:59 Echelon9 Status assigned => resolved
2012-01-15 00:59 Echelon9 Fixed in Version => 3.6.14 RC2
2012-01-15 00:59 Echelon9 Resolution open => fixed
2012-01-15 10:33 Zacam Note Added: 0013052
2012-01-15 10:33 Zacam Status resolved => feedback
2012-01-15 10:33 Zacam Resolution fixed => reopened
2012-01-15 10:44 Eli2 File Added: preLaunchSndFix.svn.patch
2012-01-15 10:44 Eli2 Note Added: 0013053
2012-01-15 11:12 Echelon9 Note Added: 0013055
2012-01-15 11:12 Echelon9 Status feedback => assigned
2012-01-15 11:17 Echelon9 Note Added: 0013056
2012-01-15 11:17 Echelon9 Status assigned => resolved
2012-01-15 11:17 Echelon9 Resolution reopened => fixed