fix(battle): unblock LocalMP backup respawns and normalize unit names
Store the selected LocalMP backup token in a separate wtoLastBackup handler field instead of mutating requestData.wtoBackup. Mutating requestData caused respawn.nut checkReady() u.isEqual(lastRequestData, getSelectedRequestData()) to always evaluate false for backup spawns, preventing doRespawnPlayer() from ever running. Also fix downstream ground and naval backup accounting where native UnitInfo::name carries folder prefixes (e.g. tankModels/cn_type_59) that mismatched bare unit IDs in session.spareSlots, by stripping path prefixes in local_mp_awards.c, record-local-battle-awards, battle-spares.ts, and battle-queue-requests.ts. Update hook_is_slot_ready_at_host to check USED_SPARES_MASK rather than BROKEN_SLOTS_MASK so unrepaired slots remain eligible for a backup spawn. Verified root and launcher typecheck, 2.61.0.37 and 2.61.0.58 check-gui (50 patches / 37 .nut), check-patches (14/14), checkPatchSet, battle-spares runnable check, and MSVC temp build of wto_ws.dll (0 warnings in project C sources). Pending regular-terminal build of build/native/wto_ws.dll and in-game acceptance.
This commit is contained in:
1 parent
c3cf4e3707
commit
647eff35fe
11 files changed
+49
-16
No files matched your search
@@ -114,9 +114,13 @@ void local_mp_report_backup_spawn(const char *unit_name, int32_t slot_id, const
|
||||
{
|
||||
__declspec(align(16)) uint8_t blk[LMP_BLK_SIZE];
|
||||
uint8_t *gsd = g_game_save_data ? *g_game_save_data : NULL;
|
||||
const char *slash;
|
||||
|
||||
if (gsd == NULL || fn_hud_notify_script == NULL || unit_name == NULL)
|
||||
return;
|
||||
slash = strrchr(unit_name, '/');
|
||||
if (slash != NULL && slash[1] != '\0')
|
||||
unit_name = slash + 1;
|
||||
memset(blk, 0, sizeof(blk));
|
||||
fn_blk_ctor(blk);
|
||||
fn_blk_set_str(blk, "unit", unit_name);
|
||||
|
||||
@@ -244,7 +244,8 @@ static uint8_t __fastcall hook_is_slot_ready_at_host(int32_t slot_id, const char
|
||||
mplayer = g_local_mp_mplayer ? *g_local_mp_mplayer : NULL;
|
||||
if (mplayer == NULL)
|
||||
return 1;
|
||||
return (*(uint32_t *)(mplayer + LMP_MP_OFF_BROKEN_SLOTS_MASK) & (1u << (uint32_t)slot_id)) == 0 ? 1 : 0;
|
||||
/* Allow broken slots whose backup has not been used yet; isCrewAvailableInSession enforces backup eligibility. */
|
||||
return (*(uint32_t *)(mplayer + LMP_MP_OFF_USED_SPARES_MASK) & (1u << (uint32_t)slot_id)) == 0 ? 1 : 0;
|
||||
}
|
||||
|
||||
int install_local_mp_player_hooks(void)
|
||||
|
||||
Reference in new issue
Block a user