From: havoc Date: Fri, 9 Mar 2012 04:48:36 +0000 (+0000) Subject: patch from Klaus Silveira cleaning up several inefficient and redundant X-Git-Tag: xonotic-v0.8.0~96^2~285 X-Git-Url: http://de.git.xonotic.org/?p=xonotic%2Fdarkplaces.git;a=commitdiff_plain;h=f7b537c4d6f704b272a66041e03927c4bdecc40c patch from Klaus Silveira cleaning up several inefficient and redundant code bits git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@11749 d7cf8633-e32d-0410-b094-e92efae38249 --- diff --git a/cl_demo.c b/cl_demo.c index e60ac367..1584cb7b 100644 --- a/cl_demo.c +++ b/cl_demo.c @@ -609,6 +609,5 @@ void CL_TimeDemo_f (void) cls.timedemo = true; cls.td_frames = -2; // skip the first frame cls.demonum = -1; // stop demo loop - cls.demonum = -1; // stop demo loop } diff --git a/cl_parse.c b/cl_parse.c index a464db89..30026988 100644 --- a/cl_parse.c +++ b/cl_parse.c @@ -2187,7 +2187,7 @@ static void CL_ParseClientdata (void) cl.stats[STAT_CELLS] = MSG_ReadShort(&cl_message); cl.stats[STAT_ACTIVEWEAPON] = (unsigned short) MSG_ReadShort(&cl_message); } - else if (cls.protocol == PROTOCOL_QUAKE || cls.protocol == PROTOCOL_QUAKEDP || cls.protocol == PROTOCOL_NEHAHRAMOVIE || cls.protocol == PROTOCOL_NEHAHRABJP || cls.protocol == PROTOCOL_NEHAHRABJP2 || cls.protocol == PROTOCOL_NEHAHRABJP3 || cls.protocol == PROTOCOL_NEHAHRABJP || cls.protocol == PROTOCOL_NEHAHRABJP2 || cls.protocol == PROTOCOL_NEHAHRABJP3 || cls.protocol == PROTOCOL_DARKPLACES1 || cls.protocol == PROTOCOL_DARKPLACES2 || cls.protocol == PROTOCOL_DARKPLACES3 || cls.protocol == PROTOCOL_DARKPLACES4) + else if (cls.protocol == PROTOCOL_QUAKE || cls.protocol == PROTOCOL_QUAKEDP || cls.protocol == PROTOCOL_NEHAHRAMOVIE || cls.protocol == PROTOCOL_NEHAHRABJP || cls.protocol == PROTOCOL_NEHAHRABJP2 || cls.protocol == PROTOCOL_NEHAHRABJP3 || cls.protocol == PROTOCOL_DARKPLACES1 || cls.protocol == PROTOCOL_DARKPLACES2 || cls.protocol == PROTOCOL_DARKPLACES3 || cls.protocol == PROTOCOL_DARKPLACES4) { cl.stats[STAT_WEAPONFRAME] = (bits & SU_WEAPONFRAME) ? MSG_ReadByte(&cl_message) : 0; cl.stats[STAT_ARMOR] = (bits & SU_ARMOR) ? MSG_ReadByte(&cl_message) : 0; diff --git a/cmd.c b/cmd.c index 51d3f0c1..beee312d 100644 --- a/cmd.c +++ b/cmd.c @@ -463,7 +463,8 @@ static void Cmd_StuffCmds_f (void) static void Cmd_Exec(const char *filename) { char *f; - qboolean isdefaultcfg = strlen(filename) >= 11 && !strcmp(filename + strlen(filename) - 11, "default.cfg"); + size_t filenameLen = strlen(filename); + qboolean isdefaultcfg = filenameLen >= 11 && !strcmp(filename + filenameLen - 11, "default.cfg"); if (!strcmp(filename, "config.cfg")) { diff --git a/gl_rsurf.c b/gl_rsurf.c index bc378401..2d0f4795 100644 --- a/gl_rsurf.c +++ b/gl_rsurf.c @@ -1586,7 +1586,6 @@ static void R_ReplaceWorldTexture (void) if ((skinframe = R_SkinFrame_LoadExternal(newt, TEXF_MIPMAP | TEXF_ALPHA | TEXF_PICMIP, true))) { // t->skinframes[0] = skinframe; - t->currentskinframe = skinframe; t->currentskinframe = skinframe; Con_Printf("%s replaced with %s\n", r, newt); } diff --git a/gl_textures.c b/gl_textures.c index 57c7633a..57c257f2 100644 --- a/gl_textures.c +++ b/gl_textures.c @@ -2069,7 +2069,7 @@ int R_SaveTextureDDSFile(rtexture_t *rt, const char *filename, qboolean skipunco mipinfo[0][0] = glt->tilewidth; mipinfo[0][1] = glt->tileheight; mipmaps = 1; - if ((glt->flags & TEXF_MIPMAP) && !(glt->tilewidth == 1 && glt->tilewidth == 1)) + if ((glt->flags & TEXF_MIPMAP) && !(glt->tilewidth == 1 && glt->tileheight == 1)) { for (mip = 1;mip < 16;mip++) { diff --git a/prvm_edict.c b/prvm_edict.c index c4687b50..6dc2a6e8 100644 --- a/prvm_edict.c +++ b/prvm_edict.c @@ -1606,7 +1606,7 @@ static void PRVM_PO_UnparseString(char *out, const char *in, size_t outsize) *out++ = '\\'; *out++ = '0' + ((*in & 0700) >> 6); *out++ = '0' + ((*in & 0070) >> 3); - *out++ = '0' + ((*in & 0007)); + *out++ = '0' + (*in & 0007) ; outsize -= 4; } }