reset all settings

git-svn-id: svn://svn.code.sf.net/p/actiongame/code/trunk/ac@1713 e016b1c5-ed68-44aa-a2f7-31cac88cffde
This commit is contained in:
driAn
2008-03-21 11:32:33 +00:00
parent 52de812b6b
commit 71d72dc592
5 changed files with 21 additions and 1 deletions
+10
View File
@@ -562,6 +562,16 @@ void writecfg()
COMMAND(writecfg, ARG_NONE);
bool deletecfg()
{
if(!delfile("config/saved.cfg"))
{
conoutf("could not delete the file config/saved.cfg");
return false;
}
return true;
}
void identnames(vector<const char *> &names, bool builtinonly)
{
enumerateht(*idents) if(!builtinonly || idents->enumc->data.type != ID_ALIAS) names.add(idents->enumc->key);
+4 -1
View File
@@ -24,12 +24,15 @@ void cleanup(char *msg) // single program exit point;
SDL_Quit();
}
VARF(resetcfg, 0, 0, 1);
void quit() // normal exit
{
extern void writeinitcfg();
writeinitcfg();
writeservercfg();
writecfg();
if(resetcfg) deletecfg();
else writecfg();
cleanup(NULL);
exit(EXIT_SUCCESS);
}
+1
View File
@@ -39,6 +39,7 @@ extern void pop(const char *name);
extern void alias(const char *name, const char *action);
extern const char *getalias(const char *name);
extern void writecfg();
extern bool deletecfg();
extern void identnames(vector<const char *> &names, bool builtinonly);
extern void changescriptcontext(int newcontext);
extern void explodelist(const char *s, vector<char *> &elems);
+5
View File
@@ -228,6 +228,11 @@ int listfiles(const char *dir, const char *ext, vector<char *> &files)
return dirs;
}
bool delfile(const char *path)
{
return !remove(path);
}
///////////////////////// misc tools ///////////////////////
bool cmpb(void *b, int n, enet_uint32 c)
+1
View File
@@ -501,6 +501,7 @@ extern gzFile opengzfile(const char *filename, const char *mode);
extern char *loadfile(const char *fn, int *size, const char *mode = NULL);
extern bool listdir(const char *dir, const char *ext, vector<char *> &files);
extern int listfiles(const char *dir, const char *ext, vector<char *> &files);
extern bool delfile(const char *path);
extern bool cmpb(void *b, int n, enet_uint32 c);
extern bool cmpf(char *fn, enet_uint32 c);
extern void endianswap(void *, int, int);