From ebe2e67439fb5ddbfabd969981bb8b2cd4825bfc Mon Sep 17 00:00:00 2001 From: hendricks266 Date: Mon, 10 Jul 2017 13:43:54 +0000 Subject: [PATCH] Fix a bug with undefinegamefunc breaking the key configuration menu. git-svn-id: https://svn.eduke32.com/eduke32@6350 1a8010ca-5511-0410-912e-c29ae57300e0 --- source/duke3d/src/menus.cpp | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/source/duke3d/src/menus.cpp b/source/duke3d/src/menus.cpp index bc16e66da..4b78b82e4 100644 --- a/source/duke3d/src/menus.cpp +++ b/source/duke3d/src/menus.cpp @@ -1561,22 +1561,23 @@ void Menu_Init(void) } // prepare input - k = 0; for (i = 0; i < NUMGAMEFUNCTIONS; ++i) { if (MenuGameFuncs[i][0] == '\0') + { + MEL_KEYBOARDSETUPFUNCS[i] = NULL; continue; + } - MEL_KEYBOARDSETUPFUNCS[k] = &ME_KEYBOARDSETUPFUNCS[k]; - ME_KEYBOARDSETUPFUNCS[k] = ME_KEYBOARDSETUPFUNCS_TEMPLATE; - ME_KEYBOARDSETUPFUNCS[k].name = MenuGameFuncs[i]; - ME_KEYBOARDSETUPFUNCS[k].entry = &MEO_KEYBOARDSETUPFUNCS[k]; - MEO_KEYBOARDSETUPFUNCS[k] = MEO_KEYBOARDSETUPFUNCS_TEMPLATE; - MEO_KEYBOARDSETUPFUNCS[k].column[0] = &ud.config.KeyboardKeys[i][0]; - MEO_KEYBOARDSETUPFUNCS[k].column[1] = &ud.config.KeyboardKeys[i][1]; - ++k; + MEL_KEYBOARDSETUPFUNCS[i] = &ME_KEYBOARDSETUPFUNCS[i]; + ME_KEYBOARDSETUPFUNCS[i] = ME_KEYBOARDSETUPFUNCS_TEMPLATE; + ME_KEYBOARDSETUPFUNCS[i].name = MenuGameFuncs[i]; + ME_KEYBOARDSETUPFUNCS[i].entry = &MEO_KEYBOARDSETUPFUNCS[i]; + MEO_KEYBOARDSETUPFUNCS[i] = MEO_KEYBOARDSETUPFUNCS_TEMPLATE; + MEO_KEYBOARDSETUPFUNCS[i].column[0] = &ud.config.KeyboardKeys[i][0]; + MEO_KEYBOARDSETUPFUNCS[i].column[1] = &ud.config.KeyboardKeys[i][1]; } - M_KEYBOARDKEYS.numEntries = k; + M_KEYBOARDKEYS.numEntries = NUMGAMEFUNCTIONS; for (i = 0; i < MENUMOUSEFUNCTIONS; ++i) { MEL_MOUSESETUPBTNS[i] = &ME_MOUSESETUPBTNS[i];