NET_HANDLE(ENT_CLIENT_NAGGER, bool isnew)
{
make_pure(this);
- int i, j, b, f;
int nags = ReadByte(); // NAGS NAGS NAGS NAGS NAGS NAGS NADZ NAGS NAGS NAGS
strcpy(vote_called_vote, ReadString());
}
- if(nags & 1)
- {
- for(j = 0; j < maxclients; ++j)
- if(playerslots[j])
- playerslots[j].ready = true;
- for(i = 1; i <= maxclients; i += 8)
- {
- f = ReadByte();
- for(j = i-1, b = BIT(0); b < BIT(8); b <<= 1, ++j)
- if (!(f & b))
- if(playerslots[j])
- playerslots[j].ready = false;
- }
- }
+ if(nags & BIT(0))
+ for(int i = 0; i < maxclients;)
+ for(int f = ReadByte(), b = 0; b < 8 && i < maxclients; ++b, ++i)
+ if(playerslots[i])
+ playerslots[i].ready = f & BIT(b);
return = true;
// Nagger for players to know status of voting
bool Nagger_SendEntity(entity this, entity to, float sendflags)
{
- int nags, i, f, b;
- entity e;
+ int nags = 0;
WriteHeader(MSG_ENTITY, ENT_CLIENT_NAGGER);
// bits:
// 64 = vote counts
// 128 = vote string
- nags = 0;
- if (readycount)
+ if (warmup_stage)
{
- nags |= BIT(0);
- if (to.ready == 0) nags |= BIT(1);
+ if (readycount)
+ {
+ nags |= BIT(0);
+ if (!to.ready) nags |= BIT(1);
+ }
+ nags |= BIT(4);
}
+
if (vote_called)
{
nags |= BIT(2);
if (to.vote_selection == 0) nags |= BIT(3);
+ nags |= sendflags & BIT(6);
+ nags |= sendflags & BIT(7);
}
- if (warmup_stage) nags |= BIT(4);
-
- if (sendflags & BIT(6)) nags |= BIT(6);
-
- if (sendflags & BIT(7)) nags |= BIT(7);
-
- if (!(nags & 4)) // no vote called? send no string
- nags &= ~(BIT(6) | BIT(7));
WriteByte(MSG_ENTITY, nags);
if (nags & BIT(7)) WriteString(MSG_ENTITY, vote_called_display);
- if (nags & 1)
+ if (nags & BIT(0))
{
- for (i = 1; i <= maxclients; i += 8)
+ for (int i = 1; i <= maxclients;)
{
- for (f = 0, e = edict_num(i), b = BIT(0); b < BIT(8); b <<= 1, e = nextent(e))
- if (e.ready)
- f |= b;
+ int f = 0;
+ for (int b = 0; b < 8 && i <= maxclients; ++b, ++i)
+ if (edict_num(i).ready)
+ f |= BIT(b);
WriteByte(MSG_ENTITY, f);
}
}