From a19dcdc48ec1ad2711dbd6a050e9dfa6c7df778f Mon Sep 17 00:00:00 2001 From: helixhorned Date: Mon, 13 Aug 2012 18:25:28 +0000 Subject: [PATCH] Correct premap.c's clearfrags(). The story: Duke3D 1.5 source had "short frags[MAXPLAYERS][MAXPLAYERS]" and "clearbufbyte(&frags[0][0],(MAXPLAYERS*MAXPLAYERS)<<1,0L);". In r1625, g_player[].frags[MAXPLAYERS] was changed from an array of int32_t to one of uint8_t, but the clearing code ("clearbufbyte(&g_player[i].frags[0],MAXPLAYERS<<1,0L);") stayed. In r2201, I rewrote clearfrags() under the assumption that it really is supposed to clear stuff beyond .frags[]. The moral: 1. Write clean code. 2. Use sizeof. 3. Write clean code! git-svn-id: https://svn.eduke32.com/eduke32@2878 1a8010ca-5511-0410-912e-c29ae57300e0 --- polymer/eduke32/source/premap.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/polymer/eduke32/source/premap.c b/polymer/eduke32/source/premap.c index d4a984139..caa2eb395 100644 --- a/polymer/eduke32/source/premap.c +++ b/polymer/eduke32/source/premap.c @@ -1727,13 +1727,7 @@ static inline void clearfrags(void) playerdata_t *p = &g_player[i]; p->ps->frag = p->ps->fraggedself = 0; - - if (i == 0) - continue; - - Bmemset(p->frags, 0, sizeof(g_player[i].frags)); - Bmemset(p->wchoice, 0, sizeof(g_player[i].wchoice)); - p->vote = p->gotvote = p->pingcnt = p->playerquitflag = 0; + Bmemset(p->frags, 0, sizeof(p->frags)); } }