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
This commit is contained in:
helixhorned 2012-08-13 18:25:28 +00:00
parent 4dca439d8f
commit a19dcdc48e

View file

@ -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));
}
}