Hard Light Productions Forums

Modding, Mission Design, and Coding => FS2 Open Coding - The Source Code Project (SCP) => Topic started by: Yarn on October 03, 2012, 08:59:49 pm

Title: #Weak weapon variants and the "player allowed" flag
Post by: Yarn on October 03, 2012, 08:59:49 pm
I noticed that if a #Weak variant of a weapon does not have the "player allowed" flag, FSO automatically adds the flag to that weapon if the non-weak variant has that flag. Is this behavior correct? This doesn't happen in retail FS2, and I'm almost certain that it was introduced in revision 7345.

This bug/feature (whatever it is) causes Hornet#Weak#Shivan and Harpoon#Weak#Shivan to appear in the Team Loadout Editor in FRED as available player weapons, and they're selected by default. Those weapons are obviously not supposed to be player weapons (except in mods that configure them as such).
Title: Re: #Weak weapon variants and the "player allowed" flag
Post by: Echelon9 on October 03, 2012, 09:37:28 pm
We noticed something similar during Diaspora development, with a patch floating around to amend (I think it is in trunk now).

Karajorma or Ace might be able to shed more light.
Title: Re: #Weak weapon variants and the "player allowed" flag
Post by: niffiwan on October 03, 2012, 09:49:51 pm
r9229 (http://svn.icculus.org/fs2open?limit_changes=100&view=rev&sortby=file&revision=9229) & r9218 (http://svn.icculus.org/fs2open?limit_changes=100&view=rev&sortby=file&revision=9218) in trunk?

Quote
Author:    Goober5000
Date:    Fri Sep 28 06:26:14 2012 UTC (5 days, 20 hours ago)
Log Message:    

fix the techroom bug where #weak weapons appear because they were assigned the player-allowed flag during parsing

Quote
Author:    karajorma
Date:    Sun Sep 23 08:33:32 2012 UTC (10 days, 18 hours ago)
Log Message:    

Stop #weak weapons appearing in the tech room in multiplayer missions.
Title: Re: #Weak weapon variants and the "player allowed" flag
Post by: karajorma on October 03, 2012, 10:20:22 pm
Yeah, I'd been under the assumption that this was a retail bug so I fixed it then got told it wasn't which basically meant reverting my fix and letting Goober fix it the way it should have been fixed all along.
Title: Re: #Weak weapon variants and the "player allowed" flag
Post by: Yarn on October 03, 2012, 11:01:00 pm
OK then. Does this also prevent the #Weak#Shivan weapons from appearing in the Team Loadout Editor? (Just to be clear, I'm talking about the dialog box in FRED that allows the FREDder to select which ships and weapons are available to the player in that mission.)
Title: Re: #Weak weapon variants and the "player allowed" flag
Post by: karajorma on October 03, 2012, 11:17:53 pm
It appears not. I'll leave this one to Goober for the moment.
Title: Re: #Weak weapon variants and the "player allowed" flag
Post by: Goober5000 on October 03, 2012, 11:20:38 pm
This fixes a problem with retail, seen most prominently in FSPort, where the game will complain if the player is assigned a #weak weapon that isn't player allowed.  Retail FS1 had the player-allowed flag on the Interceptor but not on the Interceptor#Weak.

Right now, the code just checks for the five characters #-w-e-a-k but doesn't check any characters after that.  The solution would be to check that the string ends after #weak.

On the other hand, the latest version of FSPort assigns player-allowed to Interceptor#weak, so maybe we should just remove the fix entirely.
Title: Re: #Weak weapon variants and the "player allowed" flag
Post by: karajorma on October 04, 2012, 01:01:51 am
I think you should just do that. This seems to be a data error with non-retail data only. So it shouldn't be fixed in code.