Skip to content

Fix co-op off-turn cursor being incorrectly set/persisted to aim cursor#9

Open
NonPolynomialTim wants to merge 1 commit into
xcomcoopdev:mainfrom
NonPolynomialTim:fix/coop-offturn-cursor
Open

Fix co-op off-turn cursor being incorrectly set/persisted to aim cursor#9
NonPolynomialTim wants to merge 1 commit into
xcomcoopdev:mainfrom
NonPolynomialTim:fix/coop-offturn-cursor

Conversation

@NonPolynomialTim

Copy link
Copy Markdown
Contributor

Two co-op bugs where the off-turn player's cursor was wrongly driven into the aiming (CT_AIM) state instead of the standard box cursor.

  1. Ending a turn with the aiming cursor out: the co-op end-turn handoff in BattlescapeState::btnEndTurnClick sets is_return=true and skips requestEndTurn(), so BattlescapeGame::endTurn() (which normally clears targeting and resets the cursor) never runs for the ending player. Reset it explicitly via cancelCurrentActionCoop(true) after the handoff.

  2. A teammate firing: at the end of a synced shot ProjectileFlyBState calls setupCursor() when getSide()==FACTION_PLAYER, which is still true for the off-turn co-op client, flipping its cursor to CT_AIM. Guard setupCursor() so that while it is not our turn (coop && isYourTurn != 2) it keeps the normal box cursor and ignores the active player's action. This also covers throw/psi/launch actions.

Two pre-existing co-op bugs where the off-turn player's cursor was wrongly
driven into the aiming (CT_AIM) state instead of the standard box cursor.

1. Ending a turn with the aiming cursor out: the co-op end-turn handoff in
   BattlescapeState::btnEndTurnClick sets is_return=true and skips
   requestEndTurn(), so BattlescapeGame::endTurn() (which normally clears
   targeting and resets the cursor) never runs for the ending player. Reset
   it explicitly via cancelCurrentActionCoop(true) after the handoff.

2. A teammate firing: at the end of a synced shot ProjectileFlyBState calls
   setupCursor() when getSide()==FACTION_PLAYER, which is still true for the
   off-turn co-op client, flipping its cursor to CT_AIM. Guard setupCursor()
   so that while it is not our turn (coop && isYourTurn != 2) it keeps the
   normal box cursor and ignores the active player's action. This also covers
   throw/psi/launch actions.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant