diff options
| author | Magnus Auvinen <magnus.auvinen@gmail.com> | 2008-03-01 14:36:36 +0000 |
|---|---|---|
| committer | Magnus Auvinen <magnus.auvinen@gmail.com> | 2008-03-01 14:36:36 +0000 |
| commit | 0747c2dff9289db6204b82501d03447f3ec6cc99 (patch) | |
| tree | ecca83ee860dfa5293f4dba9233820579a4bf4ac /src/engine/e_config.c | |
| parent | 622dbc6f3e5a5f398af8c6ef98d057a200c813a0 (diff) | |
| download | zcatch-0747c2dff9289db6204b82501d03447f3ec6cc99.tar.gz zcatch-0747c2dff9289db6204b82501d03447f3ec6cc99.zip | |
fixed remote console. some gui tweaks aswell.
Diffstat (limited to 'src/engine/e_config.c')
| -rw-r--r-- | src/engine/e_config.c | 37 |
1 files changed, 11 insertions, 26 deletions
diff --git a/src/engine/e_config.c b/src/engine/e_config.c index e71d2ad3..9cef342f 100644 --- a/src/engine/e_config.c +++ b/src/engine/e_config.c @@ -7,6 +7,7 @@ #include "e_system.h" #include "e_config.h" #include "e_linereader.h" +#include "e_engine.h" CONFIGURATION config; @@ -63,6 +64,7 @@ void config_set(const char *line) void config_load(const char *filename) { + /* IOHANDLE file; dbg_msg("config/load", "loading %s", filename); file = io_open(filename, IOFLAG_READ); @@ -77,37 +79,20 @@ void config_load(const char *filename) config_set(line); io_close(file); - } + }*/ } -void config_save(const char *filename) +void config_save() { - IOHANDLE file; - dbg_msg("config/save", "saving config to %s", filename); + char linebuf[512]; + + #define MACRO_CONFIG_INT(name,def,min,max) { str_format(linebuf, sizeof(linebuf), "%s %i", #name, config.name); engine_config_write_line(linebuf); } + #define MACRO_CONFIG_STR(name,len,def) { str_format(linebuf, sizeof(linebuf), "%s \"%s\"", #name, config.name); engine_config_write_line(linebuf); } - file = io_open(filename, IOFLAG_WRITE); + #include "e_config_variables.h" - if(file) - { -#if defined(CONF_FAMILY_WINDOWS) - const char newline[] = "\r\n"; -#else - const char newline[] = "\n"; -#endif - const int newline_len = sizeof(newline)-1; - - #define MACRO_CONFIG_INT(name,def,min,max) { char str[256]; str_format(str, sizeof(str), "%s=%i%s", #name, config.name, newline); io_write(file, str, strlen(str)); } - #define MACRO_CONFIG_STR(name,len,def) { io_write(file, #name, strlen(#name)); io_write(file, "=", 1); io_write(file, config.name, strlen(config.name)); io_write(file, newline, newline_len); } - - #include "e_config_variables.h" - - #undef MACRO_CONFIG_INT - #undef MACRO_CONFIG_STR - - io_close(file); - } - else - dbg_msg("config/save", "couldn't open %s for writing. :(", filename); + #undef MACRO_CONFIG_INT + #undef MACRO_CONFIG_STR } #define MACRO_CONFIG_INT(name,def,min,max) int config_get_ ## name (CONFIGURATION *c) { return c->name; } |