From b61b47dcbe628bacb37f61974c1d1e36fbc7c867 Mon Sep 17 00:00:00 2001 From: Cong Date: Sat, 23 Nov 2024 12:04:39 +1100 Subject: [PATCH] Fix shadow --- src/cdogs/map_wolf.c | 4 ++-- src/cdogs/map_wolf.h | 2 +- src/prep.c | 19 +++++++++++-------- 3 files changed, 14 insertions(+), 11 deletions(-) diff --git a/src/cdogs/map_wolf.c b/src/cdogs/map_wolf.c index 317bc48a1..5f44fc996 100644 --- a/src/cdogs/map_wolf.c +++ b/src/cdogs/map_wolf.c @@ -3543,11 +3543,11 @@ static bool TryLoadCampaign(CampaignList *list, const char *path) } void MapWolfN3DCheckAndLoadCustomQuiz( - const Campaign *c, const CArray *playerDatas) + const char *title, const CArray *playerDatas) { // Special case for N3D: Epic of Gilgamesh quiz easter egg // This code is pretty cursed - if (strcmp(c->Setting.Title, "Super 2D Noah's Ark") != 0) + if (strcmp(title, "Super 2D Noah's Ark") != 0) { return; } diff --git a/src/cdogs/map_wolf.h b/src/cdogs/map_wolf.h index 95f4c7887..3f7697770 100644 --- a/src/cdogs/map_wolf.h +++ b/src/cdogs/map_wolf.h @@ -42,4 +42,4 @@ int MapWolfLoad( void MapWolfLoadCampaignsFromSystem(CampaignList *list); void MapWolfN3DCheckAndLoadCustomQuiz( - const Campaign *c, const CArray *playerDatas); + const char *title, const CArray *playerDatas); diff --git a/src/prep.c b/src/prep.c index 4f0241715..5a7b35d8c 100644 --- a/src/prep.c +++ b/src/prep.c @@ -364,7 +364,8 @@ static void PlayerSelectionOnExit(GameLoopData *data) { gCampaign.MissionIndex = 0; } - MapWolfN3DCheckAndLoadCustomQuiz(&gCampaign, &gPlayerDatas); + MapWolfN3DCheckAndLoadCustomQuiz( + gCampaign.Setting.Title, &gPlayerDatas); } else { @@ -393,13 +394,13 @@ static GameLoopResult PlayerSelectionUpdate(GameLoopData *data, LoopRunner *l) LoopRunnerPop(l); return UPDATE_RESULT_OK; } - + int idx = 0; if (pData->endCounter == 0) { // Menu input - const int localHumanPlayers = GetNumPlayers(PLAYER_ANY, true, true); - const bool useMenuCmd = (localHumanPlayers <= 1); + const int localHumanPlayers = GetNumPlayers(PLAYER_ANY, true, true); + const bool useMenuCmd = (localHumanPlayers <= 1); for (int i = 0; i < (int)gPlayerDatas.size; i++, idx++) { const PlayerData *p = CArrayGet(&gPlayerDatas, i); @@ -414,13 +415,13 @@ static GameLoopResult PlayerSelectionUpdate(GameLoopData *data, LoopRunner *l) if (ms->current->customPostUpdateFunc) { ms->current->customPostUpdateFunc( - ms->current, ms->current->customPostUpdateData); + ms->current, ms->current->customPostUpdateData); } MenuUpdateMouse(ms); if (useMenuCmd) { cmds[idx] |= - GetMenuCmd(&gEventHandlers, ms->current->mouseHover); + GetMenuCmd(&gEventHandlers, ms->current->mouseHover); } if (!MenuIsExit(ms) && cmds[idx]) { @@ -467,11 +468,13 @@ static GameLoopResult PlayerSelectionUpdate(GameLoopData *data, LoopRunner *l) idx--; continue; } - if (p->inputDevice == INPUT_DEVICE_UNSET || p->inputDevice == INPUT_DEVICE_AI) + if (p->inputDevice == INPUT_DEVICE_UNSET || + p->inputDevice == INPUT_DEVICE_AI) { hasAIPlayers = true; PlayerTrySetInputDevice(p, INPUT_DEVICE_AI, 0); - pData->menus[idx].ms.current = MenuGetSubmenuByName(pData->menus[idx].ms.root, "Done"); + pData->menus[idx].ms.current = + MenuGetSubmenuByName(pData->menus[idx].ms.root, "Done"); } } if (hasAIPlayers && pData->endCounter < 70)