Fix: Improperly reversed function CBasePlayer::ParseAutoBuyString

This commit is contained in:
s1lentq 2015-12-18 22:32:50 +06:00
parent bfa30daadb
commit 6b05ce2c89

View File

@ -5482,22 +5482,22 @@ void CBasePlayer::__MAKE_VHOOK(Spawn)(void)
SetScoreboardAttributes(); SetScoreboardAttributes();
MESSAGE_BEGIN(MSG_ALL, gmsgTeamInfo); MESSAGE_BEGIN(MSG_ALL, gmsgTeamInfo);
WRITE_BYTE(entindex()); WRITE_BYTE(entindex());
switch (m_iTeam) switch (m_iTeam)
{ {
case CT: case CT:
WRITE_STRING("CT"); WRITE_STRING("CT");
break; break;
case TERRORIST: case TERRORIST:
WRITE_STRING("TERRORIST"); WRITE_STRING("TERRORIST");
break; break;
case SPECTATOR: case SPECTATOR:
WRITE_STRING("SPECTATOR"); WRITE_STRING("SPECTATOR");
break; break;
default: default:
WRITE_STRING("UNASSIGNED"); WRITE_STRING("UNASSIGNED");
break; break;
} }
MESSAGE_END(); MESSAGE_END();
UpdateLocation(true); UpdateLocation(true);
@ -7673,22 +7673,22 @@ void CBasePlayer::SwitchTeam(void)
} }
MESSAGE_BEGIN(MSG_ALL, gmsgTeamInfo); MESSAGE_BEGIN(MSG_ALL, gmsgTeamInfo);
WRITE_BYTE(entindex()); WRITE_BYTE(entindex());
switch (m_iTeam) switch (m_iTeam)
{ {
case CT: case CT:
WRITE_STRING("CT"); WRITE_STRING("CT");
break; break;
case TERRORIST: case TERRORIST:
WRITE_STRING("TERRORIST"); WRITE_STRING("TERRORIST");
break; break;
case SPECTATOR: case SPECTATOR:
WRITE_STRING("SPECTATOR"); WRITE_STRING("SPECTATOR");
break; break;
default: default:
WRITE_STRING("UNASSIGNED"); WRITE_STRING("UNASSIGNED");
break; break;
} }
MESSAGE_END(); MESSAGE_END();
if (TheBots != NULL) if (TheBots != NULL)
@ -9022,28 +9022,24 @@ void CBasePlayer::ParseAutoBuyString(const char *string, bool &boughtPrimary, bo
{ {
int i = 0; int i = 0;
while (*c && (*c != ' ') && i < sizeof(command)) while (*c && (*c != ' ') && i < sizeof(command) - 1)
{ {
command[i] = *c; command[i++] = *c++;
++c;
++i;
} }
if (*c == ' ') if (*c == ' ')
++c; ++c;
command[i] = 0; command[i] = '\0';
i = 0; i = 0;
while (command[i] != 0) while (command[i] != '\0')
{ {
if (command[i] == ' ') if (command[++i] == ' ')
{ {
command[i] = 0; command[i] = '\0';
break; break;
} }
++i;
} }
if (!Q_strlen(command)) if (!Q_strlen(command))