killmessage simplification.

git-svn-id: svn://svn.code.sf.net/p/actiongame/code/trunk/ac@6453 e016b1c5-ed68-44aa-a2f7-31cac88cffde
This commit is contained in:
Lucas GAUTHERON
2011-05-21 08:21:48 +00:00
parent 6da076a337
commit 2fffcb6f1a
5 changed files with 14 additions and 16 deletions
+1 -2
View File
@@ -777,8 +777,7 @@ void setkillmessage(int gun, bool gib, const char *message)
return;
}
if(gib) copystring(gibmessages[gun], message, sizeof(gibmessages[gun]));
else copystring(fragmessages[gun], message, sizeof(fragmessages[gun]));
copystring(killmessages[gib?1:0][gun], message, sizeof(killmessages[gib?1:0][gun]));
}
void fragmessage(const char *gun, const char *message)
+2 -4
View File
@@ -615,12 +615,10 @@ enum {MD_FRAGS = 0, MD_DEATHS, END_MDS};
struct medalsst {bool assigned; int cn; int item;};
#define MAXKILLMSGLEN 16
extern char fragmessages[NUMGUNS][MAXKILLMSGLEN];
extern char gibmessages[NUMGUNS][MAXKILLMSGLEN];
extern char killmessages[2][NUMGUNS][MAXKILLMSGLEN];
inline const char *killmessage(int gun, bool gib = false)
{
if(gun<0 || gun>=NUMGUNS) return "";
if(gib) return gibmessages[gun];
else return fragmessages[gun];
return killmessages[gib?1:0][gun];
}
+3 -3
View File
@@ -19,7 +19,7 @@ servernickblacklist nickblacklist;
serverforbiddenlist forbiddenlist;
serverpasswords passwords;
serverinfofile infofiles;
killmessagesfile killmessages;
killmessagesfile killmsgs;
// server state
bool isdedicated = false;
@@ -3582,7 +3582,7 @@ void rereadcfgs(void)
nickblacklist.read();
forbiddenlist.read();
passwords.read();
killmessages.read();
killmsgs.read();
}
void loggamestatus(const char *reason)
@@ -4100,7 +4100,7 @@ void initserver(bool dedicated, int argc, char **argv)
ipblacklist.init(scl.blfile);
nickblacklist.init(scl.nbfile);
forbiddenlist.init(scl.forbidden);
killmessages.init(scl.killmessages);
killmsgs.init(scl.killmessages);
infofiles.init(scl.infopath, scl.motdpath);
infofiles.getinfo("en"); // cache 'en' serverinfo
logline(ACLOG_VERBOSE, "holding up to %d recorded demos in memory", scl.maxdemos);
+2 -3
View File
@@ -496,6 +496,5 @@ const char *teamnames[TEAM_NUM+1] = {"CLA", "RVSF", "CLA-SPECT", "RVSF-SPECT", "
const char *teamnames_s[TEAM_NUM+1] = {"CLA", "RVSF", "CSPC", "RSPC", "SPEC", "void"};
// for both client and server
// default messages are hardcoded ! (in case there's a problem with cfgs)
char fragmessages[NUMGUNS][MAXKILLMSGLEN] = { "", "busted", "picked off", "peppered", "sprayed", "punctured", "shredded", "busted", "", "busted" };
char gibmessages[NUMGUNS][MAXKILLMSGLEN] = { "slashed", "", "", "splattered", "", "headshot", "", "", "gibbed", "" };
// default messages are hardcoded !
char killmessages[2][NUMGUNS][MAXKILLMSGLEN] = {{ "", "busted", "picked off", "peppered", "sprayed", "punctured", "shredded", "busted", "", "busted" }, { "slashed", "", "", "splattered", "", "headshot", "", "", "gibbed", "" }};
+6 -4
View File
@@ -909,7 +909,9 @@ struct killmessagesfile : serverconfigfile
if(l)
{
s = strtok(NULL, sep);
if(s && (!strcmp(l, "fragmessage") || !strcmp(l, "gibmessage")))
bool fragmsg = !strcmp(l, "fragmessage");
bool gibmsg = !strcmp(l, "gibmessage");
if(s && (fragmsg || gibmsg))
{
int errors = 0;
int gun = atoi(s);
@@ -950,14 +952,14 @@ struct killmessagesfile : serverconfigfile
}
if(!errors)
{
if(!strcmp(l, "fragmessage"))
if(fragmsg)
{
formatstring(fragmessages[gun])("%s", message);
formatstring(killmessages[0][gun])("%s", message);
logline(ACLOG_VERBOSE, " added msg '%s' for frags with weapon %i ", message, gun);
}
else
{
formatstring(gibmessages[gun])("%s", message);
formatstring(killmessages[1][gun])("%s", message);
logline(ACLOG_VERBOSE, " added msg '%s' for gibs with weapon %i ", message, gun);
}
}