2018-10-17 09:25 EDT


View Issue Details Jump to Notes ] Related Changesets ]
IDProjectCategoryView StatusLast Update
0002802FSSCPmath-relatedpublic2013-05-01 05:08
Reporterpotterman28wxcv 
Assigned Toniffiwan 
PrioritylowSeverityminorReproducibilityhave not tried
StatusresolvedResolutionreopened 
PlatformWindowsOSWindows 7OS Version6.1
Product Version3.6.18 
Target Version3.7.0Fixed in Version 
Summary0002802: A miscalculation in the number of Avengers available.
DescriptionDoing the mission The Darkness and the Light from FSport 3.3 (with MediaVPs), I changed the weapon configuration, then ran into the mission. But I forgot to take Furies, so I left the mission, and launched it again : in the weapon tab, there were -6 avengers available.
Steps To Reproduce1) Launch the mission The Darkness and the Light from FSport 3.3 with MediaVPs (the mission was the main mission when the bug occured)
2) Give Alpha 1&2 one avenger instead of a ML-16, then run into the mission. (the bug may be independant of this step)
3) Leave the mission, and relaunch it
4) going in the weapon selection screen, there was "-6" avengers available, as you can see in the screenshot : (currently, alpha wing is equipped with exactly 6 avenger guns, it may be that if I had not changed the weapon settings, there would have been "-4", or 2-4 = -2, avengers available)
http://img838.imageshack.us/img838/126/sstrange.png

======================================================

Try this instead (without restarting FSO):

1) start 1st mission of ST:R (8x ships)
2) switch campaigns & start the 1st non-training mission of fsport (2x ships)
3) restart the 1st fsport mission
Additional InformationI ran the debugrelease, and tried to load the mission with it : it crashed, saying what is on crash_log.txt ; the content of the debug log is in fs2_open.log

Still, when I load the mission with the non-debug release, it doesn't crash. But it still display "-6" avengers available.

Also, you can find my current pilot files in the archive.
TagsNo tags attached.
Attached Files
  • zip file icon player_files.zip (17,409 bytes) 2013-03-04 04:36
  • patch file icon mantis2802-svn.patch (1,239 bytes) 2013-04-29 04:18 -
    Index: code/missionui/missionshipchoice.cpp
    ===================================================================
    --- code/missionui/missionshipchoice.cpp	(revision 9657)
    +++ code/missionui/missionshipchoice.cpp	(working copy)
    @@ -2919,6 +2919,10 @@
     
     	for ( i = 0; i < MAX_WSS_SLOTS; i++ ) {
     		Wss_slots[i].ship_class = -1;
    +		for ( j = 0; j < MAX_SHIP_WEAPONS; j++ ) {
    +			Wss_slots[i].wep[j] = 0;
    +			Wss_slots[i].wep_count[j] = 0;
    +		}
     	}
     
     	for ( i = 0; i < MAX_WING_BLOCKS; i++ ) {
    Index: code/missionui/missionscreencommon.cpp
    ===================================================================
    --- code/missionui/missionscreencommon.cpp	(revision 9657)
    +++ code/missionui/missionscreencommon.cpp	(working copy)
    @@ -1113,7 +1113,7 @@
     		Wss_slots[i].ship_class = slot->ship_class;
     
     		for ( j = 0; j < MAX_SHIP_WEAPONS; j++ ) {
    -			if ((slot->wep[j] >= 0) && (slot->wep[j] < MAX_WEAPON_TYPES)) {
    +			if ((slot->ship_class >= 0) && (slot->wep[j] >= 0) && (slot->wep[j] < MAX_WEAPON_TYPES)) {
     				this_loadout_weapons[slot->wep[j]] -= slot->wep_count[j];
     				Assertion((this_loadout_weapons[slot->wep[j]] >= 0), "Attempting to restore the previous missions loadout has resulted in an invalid number of weapons available");
     			}
    
    patch file icon mantis2802-svn.patch (1,239 bytes) 2013-04-29 04:18 +

-Relationships
related to 0002753resolvedZacam Custom loadouts not loaded 
+Relationships

-Notes

~0014749

potterman28wxcv (reporter)

In another mission, the same steps, the same result : some weapons gets negative numbers. I guess it happens everytime a player change the loadout, then leave the game, then launch the mission again. There must be something wrong in the source code.

~0014809

MjnMixael (manager)

Could not reproduce on 9593.

~0014945

Yarn (developer)

This bug is most likely being masked in newer revisions because custom loadouts are not being loaded. Once 0002753 is fixed, the effect of this bug will probably return.

~0014967

niffiwan (developer)

Last edited: 2013-04-28 03:22

View 3 revisions

I have an idea about the cause of this, when removing weapons from the pool the code isn't ignoring ships that are not present, i.e. Player_loadout.unit_data[idx].ship_class == -1

It would also seem that unused Player_loadout.unit_data[idx].wep/wep_count slots are not being cleared when a new mission starts. i.e. this problem would occur when the previous mission had more open ship slots than the current mission. e.g. start 1st mission of ST:R (8x ships) then switch campaigns & start the 1st non-training mission of fsport (2x ships), then restart the 1st fsport mission, all without restarting FSO.

~0014975

niffiwan (developer)

Please test this patch.

Two changes:
1) when restoring last missions loadout, ignore weapons on absent ships
2) clear ship weapons & weapon-counts when clearing loadout slots

~0014992

niffiwan (developer)

Fix committed to trunk@9662.

~0014993

niffiwan (developer)

Fix committed to trunk@9663.

~0014994

niffiwan (developer)

sorry, committed the wrong patch! Back to code review

~0015006

Zacam (administrator)

Seems to do as advertised on the tin. I had some difficulty in reproducing the issue to begin with, and with this, I can't reproduce it at all.

~0015008

niffiwan (developer)

Fix committed to trunk@9668.
+Notes

+Related Changesets

-Issue History
Date Modified Username Field Change
2013-03-04 04:36 potterman28wxcv New Issue
2013-03-04 04:36 potterman28wxcv File Added: player_files.zip
2013-03-04 05:31 potterman28wxcv Note Added: 0014749
2013-03-22 20:15 MjnMixael Note Added: 0014809
2013-04-21 22:22 Yarn Note Added: 0014945
2013-04-21 23:08 niffiwan Relationship added related to 0002753
2013-04-27 22:09 niffiwan Note Added: 0014967
2013-04-27 22:09 niffiwan Assigned To => niffiwan
2013-04-27 22:09 niffiwan Status new => assigned
2013-04-27 22:10 niffiwan Target Version => 3.7.0
2013-04-27 22:10 niffiwan Note Edited: 0014967 View Revisions
2013-04-28 03:22 niffiwan Note Edited: 0014967 View Revisions
2013-04-28 03:23 niffiwan Steps to Reproduce Updated View Revisions
2013-04-29 04:18 niffiwan File Added: mantis2802-svn.patch
2013-04-29 04:19 niffiwan Note Added: 0014975
2013-04-29 04:19 niffiwan Status assigned => code review
2013-04-30 03:33 niffiwan Changeset attached => fs2open trunk r9662
2013-04-30 03:33 niffiwan Note Added: 0014992
2013-04-30 03:33 niffiwan Status code review => resolved
2013-04-30 03:33 niffiwan Resolution open => fixed
2013-04-30 03:35 niffiwan Changeset attached => fs2open trunk r9663
2013-04-30 03:35 niffiwan Note Added: 0014993
2013-04-30 03:37 niffiwan Note Added: 0014994
2013-04-30 03:37 niffiwan Status resolved => feedback
2013-04-30 03:37 niffiwan Resolution fixed => reopened
2013-04-30 03:37 niffiwan Status feedback => code review
2013-05-01 03:43 Zacam Note Added: 0015006
2013-05-01 05:08 niffiwan Changeset attached => fs2open trunk r9668
2013-05-01 05:08 niffiwan Note Added: 0015008
2013-05-01 05:08 niffiwan Status code review => resolved
+Issue History