diff --git a/source/src/clientgame.cpp b/source/src/clientgame.cpp index 6df915d1..74faadf8 100644 --- a/source/src/clientgame.cpp +++ b/source/src/clientgame.cpp @@ -6,6 +6,7 @@ int nextmode = 0; // nextmode becomes gamemode after next map load VAR(gamemode, 1, 0, 0); +VARP(modeacronyms, 0, 0, 1); flaginfo flaginfos[2]; @@ -569,7 +570,7 @@ void startmap(const char *name) // called just after a map load showscores(false); intermission = false; minutesremaining = -1; - if(*clientmap) conoutf("game mode is \"%s\"", modestr(gamemode)); + if(*clientmap) conoutf("game mode is \"%s\"", modestr(gamemode, modeacronyms)); if(firstrun && name && name[0]) { execfile("config/firstrun.cfg"); @@ -672,7 +673,7 @@ char *votestring(int type, char *arg1, char *arg2) s_sprintf(out)(msg, atoi(arg1) == 0 ? "disable" : "enable"); break; case SA_MAP: - s_sprintf(out)(msg, arg1, modestr(atoi(arg2))); + s_sprintf(out)(msg, arg1, modestr(atoi(arg2), modeacronyms)); break; default: s_sprintf(out)(msg, arg1, arg2); diff --git a/source/src/protocol.cpp b/source/src/protocol.cpp index 9abd6dae..2192da77 100644 --- a/source/src/protocol.cpp +++ b/source/src/protocol.cpp @@ -93,7 +93,7 @@ void filtertext(char *dst, const char *src, bool whitespace, int len) *dst = '\0'; } -const char *modenames[] = +const char *modefullnames[] = { "team deathmatch", "coopedit", "deathmatch", "survivor", "team survivor", "ctf", "pistol frenzy", "bot team deathmatch", "bot deathmatch", "last swiss standing", @@ -108,8 +108,9 @@ const char *modeacronymnames[] = const char *voteerrors[] = { "voting is currently disabled", "there is already a vote pending", "already voted", "can't vote that often", "this vote is not allowed in the current environment (singleplayer/multiplayer)" }; -const char *modestr(int n) { return (n>=0 && (size_t)n < sizeof(modenames)/sizeof(modenames[0])) ? modenames[n] : "unknown"; } -const char *acronymmodestr(int n) { return (n>=0 && (size_t)n < sizeof(modeacronymnames)/sizeof(modeacronymnames[0])) ? modeacronymnames[n] : "unknown"; } +const char *fullmodestr(int n) { return (n>=0 && (size_t)n < sizeof(modefullnames)/sizeof(modefullnames[0])) ? modefullnames[n] : "unknown"; } +const char *acronymmodestr(int n) { return (n>=0 && (size_t)n < sizeof(modeacronymnames)/sizeof(modeacronymnames[0])) ? modeacronymnames[n] : "n/a"; } +const char *modestr(int n, bool acronyms) { return acronyms ? acronymmodestr (n) : fullmodestr(n); } const char *voteerrorstr(int n) { return (n>=0 && (size_t)n < sizeof(voteerrors)/sizeof(voteerrors[0])) ? voteerrors[n] : "unknown"; } char msgsizesl[] = // size inclusive message token, 0 for variable or not-checked sizes diff --git a/source/src/protos.h b/source/src/protos.h index c2e4e153..069c0434 100644 --- a/source/src/protos.h +++ b/source/src/protos.h @@ -521,9 +521,9 @@ extern void scrolldoc(int i); #endif // server +extern int modeacronyms; extern void localservertoclient(int chan, uchar *buf, int len); -extern const char *modestr(int n); -extern const char *acronymmodestr(int n); +extern const char *modestr(int n, bool acronyms = false); extern const char *voteerrorstr(int n); extern void fatal(const char *s, ...); extern void initserver(bool dedicated, int uprate, const char *sdesc, const char *ip, int port, const char *master, const char *passwd, int maxcl, const char *maprot, const char *adminpwd, const char *srvmsg, int scthreshold); diff --git a/source/src/scoreboard.cpp b/source/src/scoreboard.cpp index e2eef4e1..b9467123 100644 --- a/source/src/scoreboard.cpp +++ b/source/src/scoreboard.cpp @@ -137,7 +137,7 @@ void renderscores(void *menu, bool init) if(getclientmap()[0]) { bool fldrprefix = !strncmp(getclientmap(), "maps/", strlen("maps/")); - s_sprintf(modeline)("\"%s\" on map %s", modestr(gamemode), fldrprefix ? getclientmap()+strlen("maps/") : getclientmap()); + s_sprintf(modeline)("\"%s\" on map %s", modestr(gamemode, modeacronyms), fldrprefix ? getclientmap()+strlen("maps/") : getclientmap()); } extern int minutesremaining; diff --git a/source/src/serverbrowser.cpp b/source/src/serverbrowser.cpp index 9bd9d926..d988b09c 100644 --- a/source/src/serverbrowser.cpp +++ b/source/src/serverbrowser.cpp @@ -457,8 +457,6 @@ int sicompare(serverinfo **ap, serverinfo **bp) void *servmenu = NULL; -VARP(modeacronyms, 0, 0, 1); - void refreshservers(void *menu, bool init) { if(init) @@ -480,7 +478,7 @@ void refreshservers(void *menu, bool init) if(si.address.host != ENET_HOST_ANY && si.ping != 9999) { if(si.protocol!=PROTOCOL_VERSION) s_sprintf(si.full)("%s:%d [%s protocol]", si.name, si.port, si.protocol