Source Code Project Mantis - FSSCP
View Issue Details
0002120FSSCPSEXPspublic2010-02-10 14:222010-08-26 23:43
Assigned ToZacam 
PlatformIBM PCOSMS WindowsOS VersionVista SP2
Product Version3.6.11 
Target VersionFixed in Version3.6.12 
Summary0002120: 'is-primary-selected' returns wrong value if primaries linked
DescriptionSince a ship can only have one primary as the currently selected one, this SEXP returns false for every bank but the last one before primaries were linked.

This is of course wrong behavior. When primaries are linked this should return true for ALL primary banks.
This SEXP is checking whether a gun is active and will fail if it isn't active.

I provided a patch that fixes this. In the long run it might be beneficial to also have a 'are-primaries-linked' SEXP in case this special case should be handled differently.

However this fix is necessary right now because it interpretes game data wrong, therefore one cannot handle linked primaries correctly at the moment.
if one checks for
and {
    is-primary-selected (bank 1)
    is-primary-selected (bank 2)
on a two-primaries fighter, it will return false when primaries are linked.
because in that case bank 2 is most likely selected as the current primary.
This should however return true, since both banks are active.
The game ignores the currently selected primary variable when primaries are linked, and so should the SEXP.

As mentioned, patch attached.
TagsNo tags attached.
Attached Filespatch is-primary-selected.patch (515) 2010-02-10 14:22
patch M2120_patch_02102010.patch (421) 2010-02-10 23:55

2010-02-10 23:55   
(Last edited: 2010-02-10 23:58)
Yeah, it seems that when banks are linked, Bank 0 (Primary 1) and Bank 1 (Primary 2) become considered as being Bank 0, so checks on Bank 1 fail because it "technically" doesn't exist while they are linked.

Technically, I think the attached one line change _should_ handle the idea better, but it may require some testing to verify that it works as well as I think it does.

2010-02-11 11:10   
We'll go ahead with it and make sure it works during the RC phase. Just keep it in mind when testing.
2010-02-11 11:21   
I tested it with some SEXP events that change some HUD element.

Checking for both banks to be true with an "and" condition works when linked.

For one being active

Bank1 selected AND NOT bank2 selected

works also fine

NOT (AND bank1 selected, bank2 selected) never triggers

so this works as expected from my point of view.
2010-02-11 11:30   
Committed Zacam's version in r5900.
2010-08-26 23:43   
No additional feedback, marking as resolved.

Issue History
2010-02-10 14:22KeldorKatarnNew Issue
2010-02-10 14:22KeldorKatarnFile Added: is-primary-selected.patch
2010-02-10 23:55ZacamNote Added: 0011630
2010-02-10 23:55ZacamFile Added: M2120_patch_02102010.patch
2010-02-10 23:58ZacamNote Edited: 0011630
2010-02-11 00:22ZacamStatusnew => feedback
2010-02-11 04:08ZacamStatusfeedback => assigned
2010-02-11 04:08ZacamAssigned To => Zacam
2010-02-11 04:09ZacamStatusassigned => feedback
2010-02-11 11:10chief1983Note Added: 0011644
2010-02-11 11:21KeldorKatarnNote Added: 0011645
2010-02-11 11:30chief1983Note Added: 0011647
2010-08-26 23:43ZacamNote Added: 0012333
2010-08-26 23:43ZacamStatusfeedback => resolved
2010-08-26 23:43ZacamFixed in Version => 3.6.12
2010-08-26 23:43ZacamResolutionopen => fixed