From b39121c6a682eb8ae5efd29a875bd7c098185f04 Mon Sep 17 00:00:00 2001 From: Simon Howard Date: Fri, 20 Feb 2015 00:31:09 -0500 Subject: Refactor config file API. The config file API previously relied on binding config variables using M_BindVariable() which took a void pointer. It occurred to me that if used on a boolean variable, this would be erroneous, but the void pointer would make it impossible to tell. Split this into separate M_Bind{Foo}Variable() functions based on type, which allows for proper type checking on the pointers that are passed. Vaguely related to #509. --- src/setup/mode.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) (limited to 'src/setup/mode.c') diff --git a/src/setup/mode.c b/src/setup/mode.c index d0e1f201..ed637849 100644 --- a/src/setup/mode.c +++ b/src/setup/mode.c @@ -115,14 +115,14 @@ static void BindMiscVariables(void) { if (gamemission == doom) { - M_BindVariable("detaillevel", &detailLevel); - M_BindVariable("show_messages", &showMessages); + M_BindIntVariable("detaillevel", &detailLevel); + M_BindIntVariable("show_messages", &showMessages); } if (gamemission == hexen) { - M_BindVariable("savedir", &savedir); - M_BindVariable("messageson", &showMessages); + M_BindStringVariable("savedir", &savedir); + M_BindIntVariable("messageson", &showMessages); // Hexen has a variable to control the savegame directory // that is used. @@ -140,14 +140,15 @@ static void BindMiscVariables(void) if (gamemission == strife) { - M_BindVariable("back_flat", &back_flat); - M_BindVariable("screensize" , &screenblocks); - M_BindVariable("comport", &comport); - M_BindVariable("nickname", &nickname); + M_BindStringVariable("back_flat", &back_flat); + M_BindStringVariable("nickname", &nickname); + + M_BindIntVariable("screensize", &screenblocks); + M_BindIntVariable("comport", &comport); } else { - M_BindVariable("screenblocks", &screenblocks); + M_BindIntVariable("screenblocks", &screenblocks); } } -- cgit v1.2.3