This commit is contained in:
Jakob Fries 2007-06-01 12:24:13 +00:00
parent 03201a3a6f
commit f18df70e53
4 changed files with 13 additions and 1 deletions

View file

@ -76,6 +76,12 @@ void config_save(const char *filename)
file.close();
}
#define MACRO_CONFIG_INT(name,def,min,max) int config_get_ ## name (configuration *c) { return c->name; }
#define MACRO_CONFIG_STR(name,len,def) const char *config_get_ ## name (configuration *c) { return c->name; }
#include "config_variables.h"
#undef MACRO_CONFIG_INT
#undef MACRO_CONFIG_STR
#define MACRO_CONFIG_INT(name,def,min,max) void config_set_ ## name (configuration *c, int val) { if (val < min) val = min; if (max != 0 && val > max) val = max; c->name = val; }
#define MACRO_CONFIG_STR(name,len,def) void config_set_ ## name (configuration *c, const char *str) { strncpy(c->name, str, len-1); c->name[sizeof(c->name)-1] = 0; }
#include "config_variables.h"

View file

@ -16,6 +16,12 @@ void config_reset();
void config_load(const char *filename);
void config_save(const char *filename);
#define MACRO_CONFIG_INT(name,def,min,max) int config_get_ ## name (configuration *c);
#define MACRO_CONFIG_STR(name,len,def) const char *config_get_ ## name (configuration *c);
#include "config_variables.h"
#undef MACRO_CONFIG_INT
#undef MACRO_CONFIG_STR
#define MACRO_CONFIG_INT(name,def,min,max) void config_set_ ## name (configuration *c, int val);
#define MACRO_CONFIG_STR(name,len,def) void config_set_ ## name (configuration *c, const char *str);
#include "config_variables.h"

View file

@ -1,2 +1,2 @@
#include "../game/config_variables.h"
#include "../game/game_variables.h"