CON: Fix checkavailweapon command.

git-svn-id: https://svn.eduke32.com/eduke32@6408 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
hendricks266 2017-07-30 21:23:51 +00:00
parent fe10e46778
commit bb13b0db85

View file

@ -4280,22 +4280,23 @@ finish_qsprintf:
case CON_CHECKAVAILWEAPON:
case CON_CHECKAVAILINVEN:
{
insptr++;
tw = (*insptr != g_thisActorVarID) ? Gv_GetVarX(*insptr) : vm.playerNum;
insptr++;
size_t const playerNum = (*insptr++ != g_thisActorVarID) ? Gv_GetVarX(*insptr) : vm.playerNum;
if (EDUKE32_PREDICT_FALSE((unsigned)tw >= (unsigned)g_mostConcurrentPlayers))
if (EDUKE32_PREDICT_FALSE((unsigned)playerNum >= (unsigned)g_mostConcurrentPlayers))
{
CON_ERRPRINTF("invalid player %d\n", tw);
CON_ERRPRINTF("invalid player %d\n", (int)playerNum);
continue;
}
if (tw == CON_CHECKAVAILWEAPON)
P_CheckWeapon(g_player[tw].ps);
P_CheckWeapon(g_player[playerNum].ps);
else
P_SelectNextInvItem(g_player[tw].ps);
P_SelectNextInvItem(g_player[playerNum].ps);
continue;
}
case CON_GETPLAYERANGLE:
insptr++;