save kill messages into saved.cfg instead of a separate file (client)

git-svn-id: svn://svn.code.sf.net/p/actiongame/code/trunk/ac@7030 e016b1c5-ed68-44aa-a2f7-31cac88cffde
This commit is contained in:
Lucas GAUTHERON
2013-01-05 22:28:52 +00:00
parent c5e656fc9e
commit 71f3e3815b
4 changed files with 9 additions and 20 deletions
-17
View File
@@ -814,34 +814,17 @@ void setkillmessage(int gun, bool gib, const char *message)
result(killmessage(gun, gib));
return;
}
if(gun < 0 || gun >= NUMGUNS)
{
conoutf("invalid gun specified");
return;
}
copystring(killmessages[gib?1:0][gun], message, sizeof(killmessages[gib?1:0][gun]));
}
COMMANDF(fragmessage, "is", (int *gun, const char *message) { setkillmessage(*gun, false, message); });
COMMANDF(gibmessage, "is", (int *gun, const char *message) { setkillmessage(*gun, true, message); });
void writekillmsgcfg()
{
stream *f = openfile(path("config/killmessages.cfg", true), "w");
if(!f) return;
f->printf("// kill messages for each weapon\n");
loopi(NUMGUNS)
{
const char *fragmsg = killmessage(i, false);
const char *gibmsg = killmessage(i, true);
f->printf("\nfragmessage %d \"%s\"", i, fragmsg);
f->printf("\ngibmessage %d \"%s\"", i, gibmsg);
}
f->printf("\n");
}
void burstshots(int gun, int shots)
{
// args are passed as strings to differentiate 2 cases : shots_str == "0" or shots_str is empty (not specified from cubescript).
+9
View File
@@ -1385,6 +1385,15 @@ void writecfg()
f->printf("\n");
audiomgr.writesoundconfig(f);
f->printf("\n");
f->printf("// kill messages for each weapon\n");
loopi(NUMGUNS)
{
const char *fragmsg = killmessage(i, false);
const char *gibmsg = killmessage(i, true);
f->printf("\nfragmessage %d \"%s\"", i, fragmsg);
f->printf("\ngibmessage %d \"%s\"", i, gibmsg);
}
f->printf("\n");
enumerate(*idents, ident, id,
if(!id.persist) continue;
switch(id.type)
-2
View File
@@ -34,7 +34,6 @@ void quit() // normal exit
extern void writeinitcfg();
writeinitcfg();
writeservercfg();
writekillmsgcfg();
if(resetcfg) deletecfg();
else writecfg();
cleanup(NULL);
@@ -1155,7 +1154,6 @@ int main(int argc, char **argv)
exec("config/securemaps.cfg");
exec("config/admin.cfg");
execfile("config/servers.cfg");
execfile("config/killmessages.cfg");
persistidents = true;
static char resdata[] = { 112, 97, 99, 107, 97, 103, 101, 115, 47, 116, 101, 120, 116, 117, 114, 101, 115, 47, 107, 117, 114, 116, 47, 107, 108, 105, 116, 101, 50, 46, 106, 112, 103, 0 };
-1
View File
@@ -797,7 +797,6 @@ extern void push(const char *name, const char *action);
extern void pop(const char *name);
extern void alias(const char *name, const char *action);
extern const char *getalias(const char *name);
extern void writekillmsgcfg();
extern void writecfg();
extern void deletecfg();
extern void identnames(vector<const char *> &names, bool builtinonly);