get rid of goto statements

This commit is contained in:
jeefo 2016-04-04 10:51:52 +03:00
commit de1e9b68e2
4 changed files with 152 additions and 122 deletions

View file

@ -968,9 +968,19 @@ void Bot::SwitchChatterIcon (bool show)
for (int i = 0; i < engine.MaxClients (); i++)
{
if (!(g_clients[i].flags & CF_USED) || (g_clients[i].ent->v.flags & FL_FAKECLIENT) || g_clients[i].team != m_team)
Client &client = g_clients[i];
if ((show && !(client.flags & CF_CHATTER)) || (!show && (client.flags & CF_CHATTER)))
continue;
if (!(client.flags & CF_USED) || (client.ent->v.flags & FL_FAKECLIENT) || client.team != m_team)
continue;
if (show)
client.flags |= CF_CHATTER;
else
client.flags &= ~CF_CHATTER;
MESSAGE_BEGIN (MSG_ONE, engine.FindMessageId (NETMSG_BOTVOICE), NULL, g_clients[i].ent); // begin message
WRITE_BYTE (show); // switch on/off
WRITE_BYTE (GetIndex ());