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:
@@ -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
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user