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/m_config.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/m_config.h') diff --git a/src/m_config.h b/src/m_config.h index a17de2b4..43882a49 100644 --- a/src/m_config.h +++ b/src/m_config.h @@ -26,10 +26,12 @@ void M_LoadDefaults(void); void M_SaveDefaults(void); void M_SaveDefaultsAlternate(char *main, char *extra); void M_SetConfigDir(char *dir); -void M_BindVariable(char *name, void *variable); +void M_BindIntVariable(char *name, int *variable); +void M_BindFloatVariable(char *name, float *variable); +void M_BindStringVariable(char *name, char **variable); boolean M_SetVariable(char *name, char *value); int M_GetIntVariable(char *name); -const char *M_GetStrVariable(char *name); +const char *M_GetStringVariable(char *name); float M_GetFloatVariable(char *name); void M_SetConfigFilenames(char *main_config, char *extra_config); char *M_GetSaveGameDir(char *iwadname); -- cgit v1.2.3