Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WotC bug + Solution : Problems Editing Covert Action Soldier Loadouts with a Controller #1035

Closed
kdm2k6 opened this issue Jul 10, 2021 · 6 comments

Comments

@kdm2k6
Copy link

kdm2k6 commented Jul 10, 2021

General problem: The issue is that, while using a controller, you can edit the loadout of the 1st soldier slot for any given Covert action; however, you can not edit the loadout of the 2nd, 3rd ... soldier slot. I have come across this problem while testing LWotC; however, I believe it is a WotC bug. Additionally, I have confirmed the solution by using a modified highlander.

In order to replicate this bug do the following :

  1. Go to the Covert Actions screen.
  2. Choose a Covert Action which requires at least 2 soldiers.
  3. Using the A button, add a soldier to each soldier slot.
  4. Press the Y button while the 1st soldier slot is active; notice that the loadout screen for that soldier is brought up. This is working as intended.
  5. Go back and press the Y button while the 2nd soldier slot is active; notice that the loadout screen for the 1st soldier is brought up. This is a problem.

Why this occurs : Within the UIScreen, UICovertActions, the code : SlotContainer.Navigator.SelectedIndex is used to determine which particular slot within the slot container is currently selected. This can be seen within OnUnrealCommand, where the A button :

  1. Determines which UICovertActionStaffSlot is selected via the call : SlotContainer.Navigator.SelectedIndex
  2. Calls HandleClick on this slot, sending in the parameter "theButton" via : SlotContainer.ActionSlots[SlotContainer.Navigator.SelectedIndex].HandleClick("theButton").
  3. UICovertActionStaffSlot.HandleClick then determines if this slot should be filled with a soldier, or emptied, depending upon its current state.

Unfortunately in several locations, including the EditSoldierLoadout function, the selected slot is determined via Navigator.SelectedIndex rather than SlotContainer.Navigator.SelectedIndex. This results in the index value 0 always being returned and the 1st soldier slot being "dealt with". I never tested exactly what Navigator.SelectedIndex referenced, but I would guess the screen's navigator is pointing to the slot container itself.

Solution : There are 3 problematic lines of code within UICovertActions.

1.] Within the function : RefreshNavigation.
if( SlotContainer.ActionSlots[Navigator.SelectedIndex].CanEditLoadout() ) should become
if( SlotContainer.ActionSlots[SlotContainer.Navigator.SelectedIndex].CanEditLoadout() )

2.] Within the function : EditSoldierLoadout
if( SlotContainer.ActionSlots[Navigator.SelectedIndex].CanEditLoadout() ) should become
if( SlotContainer.ActionSlots[SlotContainer.Navigator.SelectedIndex].CanEditLoadout() )

SlotContainer.ActionSlots[Navigator.SelectedIndex].HandleClick("theButton2"); should become
SlotContainer.ActionSlots[SlotContainer.Navigator.SelectedIndex].HandleClick("theButton2");

@Xymanek
Copy link
Member

Xymanek commented Nov 23, 2021

It looks like there is a working solution already - please provide it as a PR

@Xymanek Xymanek modified the milestones: 1.23.0, 1.24.0 Nov 23, 2021
@Xymanek Xymanek removed this from the 1.24.0 milestone Feb 26, 2022
@araujorm
Copy link
Contributor

araujorm commented May 8, 2023

Hello.

This is still a problem in the latest release.

I thought I could help turning the proposed solution in a PR, however I never worked with Xcom mod sources.

I cloned this repo and searched for the aforementioned functions RefreshNavigation and EditSoldierLoadout, however nothing like that exists. Nor it seems to exist any source for the UICovertActions class. Therefore I'm assuming one should get the original UICovertActions.uc file (from where? the SDK?), edit it with the proposed changes and place it along the other .uc files with the classes inside this mod Src/XComGame/Classes. Am I thinking correctly?

@robojumper
Copy link
Member

It seems this process isn't documented in the HL repo -- we should fix that. Yes, you're correct, get the original file from SDK/Development/SrcOrig, add it unmodified to the project, do a commit, then make and commit your changes separately.

araujorm added a commit to araujorm/X2WOTCCommunityHighlander that referenced this issue May 8, 2023
@araujorm
Copy link
Contributor

araujorm commented May 9, 2023

It seems this process isn't documented in the HL repo -- we should fix that. Yes, you're correct, get the original file from SDK/Development/SrcOrig, add it unmodified to the project, do a commit, then make and commit your changes separately.

Thanks.

I did that, and after hours of despair with modbuddy and all that stuff (first time with it...) I was finally able to make a modified build based on this, and I confirm that it in fact works. I made a pull request: #1170 that therefore solves this issue.

@kdm2k6
Copy link
Author

kdm2k6 commented May 9, 2023

Great job and thanks.

araujorm added a commit to araujorm/X2WOTCCommunityHighlander that referenced this issue May 11, 2023
Iridar pushed a commit that referenced this issue May 21, 2023
Full credit to this fix for kdm2k6 on issue
#1035
@Iridar
Copy link
Contributor

Iridar commented May 21, 2023

This issue was resolved in #1170, closing.

@Iridar Iridar closed this as completed May 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants