Skip to content

Fix research sync toggle and classic medikit crash - #185

Merged
xcomcoopdev merged 1 commit into
mainfrom
fix/research-sync-toggle-and-medikit-crash
Sep 4, 2026
Merged

xcomcoopdev merged 1 commit into
mainfrom
fix/research-sync-toggle-and-medikit-crash

Conversation

@xcomcoopdev

Copy link
Copy Markdown
Collaborator

Summary

This fixes two co-op issues:

  1. Setting Enable Research Sync (Separate) to NO did not disable research synchronization because the actual send, receive, and apply paths ignored the negotiated value.
  2. Healing performed by a client in classic-turn co-op could crash the host because the replayed action did not contain a medikit weapon.

It also prevents a disabled PvP reaction-fire setting from leaking into later non-PvP co-op sessions.

Disabled research synchronization

  • Do not send research completions when Enable Research Sync (Separate) is set to NO.
  • Ignore incoming research packets while synchronization is disabled.
  • Do not apply or retain queued research while synchronization is disabled.
  • Mirror the host-authoritative value to the client's Multiplayer options UI.
  • Prevent the client from overriding the host's value while connected.
  • Propagate host changes to the client during an active session.
  • Rename the displayed option to Enable Research Sync (Separate).
  • Fix the research packet typo from base_lot to base_lon.

Classic medikit crash

The classic replay path reused the host's current BattleAction. It assigned the actor, action type, and TU cost, but never assigned action->weapon.

TileEngine::medikitUse() subsequently dereferenced:

action->weapon->getRules()

This caused an access violation when a client healed a soldier and the host's current action had no weapon.

The fix:

  • Uses a stack-local replay action in both classic and parallel turns.
  • Resolves the healer's actual medikit using the packet's healer, weapon, type, and hand identifiers.
  • Validates the healer, medikit type, and body part.
  • Safely skips malformed or stale packets.
  • Adds a defensive null check to TileEngine::medikitUse().

PvP reaction fire

  • Reset the session reaction-fire value to enabled in non-PvP modes.
  • This prevents Enable Reaction Fire in PvP = NO from affecting a later normal co-op campaign.

Testing

  • Reproduced the classic-turn crash with a client healing a soldier.
  • Confirmed the crash occurred at action->weapon->getRules() with a null weapon.
  • Manually verified after the fix that client healing succeeds and the host no longer crashes.

Make the research sync toggle actually disable research synchronization.

- Stop sending, receiving, and applying research updates when disabled.
- Keep the client UI synchronized with the host-authoritative setting.
- Propagate host changes made during an active session.
- Clear pending research updates when synchronization is disabled.
- Fix the research packet base longitude field name.
- Label research synchronization as a Separate campaign option.
- Prevent a disabled PvP reaction-fire setting from leaking into co-op.
- Resolve the healer's actual medikit during classic-turn replay.
- Validate the healer, medikit, item type, and body part.
- Guard medikitUse against missing action, target, weapon, or rules.
@xcomcoopdev
xcomcoopdev merged commit f8b0834 into main Sep 4, 2026
11 checks passed
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