From 382250e8caf0c6ef395c7d605d729f44e4d50032 Mon Sep 17 00:00:00 2001 From: flowtron Date: Fri, 9 May 2008 17:51:55 +0000 Subject: [PATCH] serverbrowser can use acronymic modenames git-svn-id: svn://svn.code.sf.net/p/actiongame/code/trunk/ac@1896 e016b1c5-ed68-44aa-a2f7-31cac88cffde --- source/src/protocol.cpp | 7 +++++++ source/src/protos.h | 1 + source/src/serverbrowser.cpp | 4 +++- 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/source/src/protocol.cpp b/source/src/protocol.cpp index a20810a5..bb90c5b4 100644 --- a/source/src/protocol.cpp +++ b/source/src/protocol.cpp @@ -100,7 +100,14 @@ const char *modenames[] = "one shot, one kill", "team one shot, one kill", "bot one shot, one skill" }; +const char *modeacronymnames[] = +{ + "TDM", "coop", "DM", "SURV", "TSURV", "CTF", "PF", "BTDM", "BDM", "LSS", + "OSOK", "TOSOK", "BOSOK" +}; + 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"; } 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 c961d60e..ba248b3d 100644 --- a/source/src/protos.h +++ b/source/src/protos.h @@ -517,6 +517,7 @@ extern void scrolldoc(int i); // server extern void localservertoclient(int chan, uchar *buf, int len); extern const char *modestr(int n); +extern const char *acronymmodestr(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); extern void cleanupserver(); diff --git a/source/src/serverbrowser.cpp b/source/src/serverbrowser.cpp index 3c05ab4b..9bd9d926 100644 --- a/source/src/serverbrowser.cpp +++ b/source/src/serverbrowser.cpp @@ -457,6 +457,8 @@ int sicompare(serverinfo **ap, serverinfo **bp) void *servmenu = NULL; +VARP(modeacronyms, 0, 0, 1); + void refreshservers(void *menu, bool init) { if(init) @@ -478,7 +480,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