diff --git a/source/src/protos.h b/source/src/protos.h index b3f4845e..2354fb35 100644 --- a/source/src/protos.h +++ b/source/src/protos.h @@ -143,7 +143,7 @@ struct gmenu bool (__cdecl *keyfunc)(void *, int, bool, int); char *initaction; char *usefont; - bool allowblink; + bool allowblink; const char *mdl; int anim, rotspeed, scale; int footlen; @@ -501,10 +501,10 @@ struct font short x, y, w, h; }; - struct utf8charinfo : charinfo - { - int code; - }; + struct utf8charinfo : charinfo + { + int code; + }; char *name; Texture *tex; @@ -879,7 +879,7 @@ struct servercommandline // client: dtwhzbsave switch(arg[1]) { // todo: gjlqGHJQUYZ - case '-': + case '-': if(!strncmp(arg, "--demofilenameformat=", 21)) { demofilenameformat = arg+21; @@ -890,7 +890,7 @@ struct servercommandline } else if(!strncmp(arg, "--demotimelocal=", 16)) { - int ai = atoi(arg+16); + int ai = atoi(arg+16); demotimelocal = ai == 0 ? 0 : 1; } else return false; @@ -942,7 +942,7 @@ struct servercommandline case 'X': pwdfile = a; break; case 'B': blfile = a; break; case 'K': nbfile = a; break; - case 'E': killmessages = a; break; + case 'E': killmessages = a; break; case 'I': infopath = a; break; case 'o': filterrichtext(motd, a); break; case 'O': motdpath = a; break; diff --git a/source/src/rendertext.cpp b/source/src/rendertext.cpp index 8ec4398e..38563d2c 100644 --- a/source/src/rendertext.cpp +++ b/source/src/rendertext.cpp @@ -124,7 +124,7 @@ extern int shdsize, outline, win32msg; // ringbuf for utf8 character storage struct charringbuf : ringbuf { - // find by character code + // find by character code int findbycharcode(int code) { loopi(len) @@ -190,7 +190,7 @@ void createutf8charset() SDL_Surface *fontsurface = TTF_RenderUTF8_Blended(ttffont, u, color); - // update row/column info + // update row/column info if(posx + fontsurface->w > charsetsurface->w) { posx = 0; @@ -199,11 +199,11 @@ void createutf8charset() if(posy + fontsurface->h > charsetsurface->h) break; - // blit onto charset + // blit onto charset SDL_SetAlpha(fontsurface, 0, 0); blitsurface(charsetsurface, fontsurface, posx, posy); - // update charinfo properties + // update charinfo properties charinfo.x = posx; charinfo.y = posy; charinfo.w = fontsurface->w; @@ -215,8 +215,8 @@ void createutf8charset() utf8font.tex = createtexturefromsurface("utf8charset", charsetsurface); - //extern void savepng(SDL_Surface *s, const char *name); - //savepng(t, "font.png"); + //extern void savepng(SDL_Surface *s, const char *name); + //savepng(t, "font.png"); SDL_FreeSurface(charsetsurface); } @@ -224,33 +224,33 @@ void createutf8charset() void addutf8char(int code) { - // add to buf - font::utf8charinfo charinfo; - charinfo.code = code; + // add to buf + font::utf8charinfo charinfo; + charinfo.code = code; charinfo.x = charinfo.y = charinfo.w = charinfo.h = 0; - utf8chars.add(charinfo); + utf8chars.add(charinfo); - // update charset - createutf8charset(); + // update charset + createutf8charset(); } font::charinfo *loadchar(int code) { - int idx = utf8chars.findbycharcode(code); - if(idx >= 0) - return &utf8chars[idx]; + int idx = utf8chars.findbycharcode(code); + if(idx >= 0) + return &utf8chars[idx]; - // add - addutf8char(code); + // add + addutf8char(code); - idx = utf8chars.findbycharcode(code); - return &utf8chars[idx]; + idx = utf8chars.findbycharcode(code); + return &utf8chars[idx]; } */ int draw_char(font &f, font::charinfo &info, int charcode, int x, int y) { /* - // fixme + // fixme glEnd(); glBindTexture(GL_TEXTURE_2D, f.tex->id); glBegin(GL_QUADS); @@ -273,38 +273,38 @@ int draw_char(font &f, font::charinfo &info, int charcode, int x, int y) // fixme font::charinfo &getcharinfo(int c) { - if(curfont->chars.inrange(c-curfont->skip)) - { - font::charinfo &info = curfont->chars[c-curfont->skip]; - return info; - } - //else { font::charinfo &info = *loadchar(c); return info; } - //return NULL; - font::charinfo &info = curfont->chars[0]; // 0 || (FONTCHARS-1) + if(curfont->chars.inrange(c-curfont->skip)) + { + font::charinfo &info = curfont->chars[c-curfont->skip]; + return info; + } + //else { font::charinfo &info = *loadchar(c); return info; } + //return NULL; + font::charinfo &info = curfont->chars[0]; // 0 || (FONTCHARS-1) return info; } */ static int draw_char(int c, int x, int y) { - if(curfont->chars.inrange(c-curfont->skip)) - { - font::charinfo &info = curfont->chars[c-curfont->skip]; + if(curfont->chars.inrange(c-curfont->skip)) + { + font::charinfo &info = curfont->chars[c-curfont->skip]; - return draw_char(*curfont, info, c, x, y); - } - /* - else - { - // fixme - glEnd(); - font::charinfo &info = *loadchar(c); - glBegin(GL_QUADS); + return draw_char(*curfont, info, c, x, y); + } + /* + else + { + // fixme + glEnd(); + font::charinfo &info = *loadchar(c); + glBegin(GL_QUADS); - return draw_char(utf8font, info, c, x, y); - } - */ - return 0; + return draw_char(utf8font, info, c, x, y); + } + */ + return 0; } @@ -723,7 +723,7 @@ void draw_text_wip(const char *str, int left, int top, int r, int g, int b, int */ void reloadfonts() { - //createutf8charset(); + //createutf8charset(); enumerate(fonts, font, f, if(!reloadtexture(*f.tex)) fatal("failed to reload font texture"); diff --git a/source/src/server.cpp b/source/src/server.cpp index f17433b4..d84bfcb6 100644 --- a/source/src/server.cpp +++ b/source/src/server.cpp @@ -440,32 +440,31 @@ void recordpacket(int chan, ENetPacket *packet) #ifdef STANDALONE const char *currentserver(int i, bool internal) // = false) | ignored in standalone-version! { - static string curSRVinfo; - string r; - r[0] = '\0'; - switch(i) - { - case 1: { copystring(r, scl.ip[0] ? scl.ip : "local"); break; } // IP - case 2: { copystring(r, scl.logident[0] ? scl.logident : "local"); break; } // HOST - case 3: { formatstring(r)("%d", scl.serverport); break; } // PORT - // the following are used by a client, a server will simply return empty strings for them - case 4: - case 5: - case 6: - case 7: - case 8: - { - break; - } - default: - { - - formatstring(r)("%s %d", scl.ip[0] ? scl.ip : "local", scl.serverport); - break; - } - } - copystring(curSRVinfo, r); - return curSRVinfo; + static string curSRVinfo; + string r; + r[0] = '\0'; + switch(i) + { + case 1: { copystring(r, scl.ip[0] ? scl.ip : "local"); break; } // IP + case 2: { copystring(r, scl.logident[0] ? scl.logident : "local"); break; } // HOST + case 3: { formatstring(r)("%d", scl.serverport); break; } // PORT + // the following are used by a client, a server will simply return empty strings for them + case 4: + case 5: + case 6: + case 7: + case 8: + { + break; + } + default: + { + formatstring(r)("%s %d", scl.ip[0] ? scl.ip : "local", scl.serverport); + break; + } + } + copystring(curSRVinfo, r); + return curSRVinfo; } #endif @@ -575,10 +574,10 @@ void enddemorecord() sendservmsg(msg); logline(ACLOG_INFO, "Demo \"%s\" recorded.", d.info); - // 2011feb05:ft: previously these two static formatstrings were used .. + // 2011feb05:ft: previously these two static formatstrings were used .. //formatstring(d.file)("%s_%s_%s", timestring(), behindpath(smapname), modestr(gamemode, true)); // 20100522_10.08.48_ac_mines_DM.dmo //formatstring(d.file)("%s_%s_%s", modestr(gamemode, true), behindpath(smapname), timestring( true, "%Y.%m.%d_%H%M")); // DM_ac_mines.2010.05.22_1008.dmo - // .. now we use client-side parseable fileattribs + // .. now we use client-side parseable fileattribs int mPLAY = gamemillis >= gamelimit ? gamelimit/1000 : gamemillis/1000; int mDROP = gamemillis >= gamelimit ? 0 : (gamelimit - gamemillis)/1000; int iTIME = time(NULL); @@ -3556,7 +3555,7 @@ void rereadcfgs(void) nickblacklist.read(); forbiddenlist.read(); passwords.read(); - killmessages.read(); + killmessages.read(); } void loggamestatus(const char *reason) @@ -4001,8 +4000,8 @@ string server_name = "unarmed server"; void quitproc(int param) { - // this triggers any "atexit"-calls: - exit(param == 2 ? EXIT_SUCCESS : EXIT_FAILURE); // 3 is the only reply on Win32 apparently, SIGINT == 2 == Ctrl-C + // this triggers any "atexit"-calls: + exit(param == 2 ? EXIT_SUCCESS : EXIT_FAILURE); // 3 is the only reply on Win32 apparently, SIGINT == 2 == Ctrl-C } void initserver(bool dedicated, int argc, char **argv) @@ -4066,7 +4065,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); + killmessages.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); @@ -4091,12 +4090,12 @@ void initserver(bool dedicated, int argc, char **argv) if (signal(SIGINT, quitproc) == SIG_ERR) logline(ACLOG_INFO, "Cannot handle SIGINT!"); // kill -15 / probably process-manager on Win32 *shrug* if (signal(SIGTERM, quitproc) == SIG_ERR) logline(ACLOG_INFO, "Cannot handle SIGTERM!"); - #ifndef WIN32 - // kill -1 + #ifndef WIN32 + // kill -1 if (signal(SIGHUP, quitproc) == SIG_ERR) logline(ACLOG_INFO, "Cannot handle SIGHUP!"); // kill -9 is uncatchable - http://en.wikipedia.org/wiki/SIGKILL //if (signal(SIGKILL, quitproc) == SIG_ERR) logline(ACLOG_INFO, "Cannot handle SIGKILL!"); - #endif + #endif logline(ACLOG_INFO, "dedicated server started, waiting for clients..."); logline(ACLOG_INFO, "Ctrl-C to exit"); // this will now actually call the atexit-hooks below - thanks to SIGINT hooked above - noticed and signal-code-docs found by SKB:2011feb05:ft: atexit(enet_deinitialize);