* Fixes forceskin causing desynchronisations, baby! Checks only when attempting to send.

* Makes the forceskin print more consistent with the skin print.

* Disabled the printing of availabilities.
This commit is contained in:
toasterbabe 2017-03-18 00:41:40 +00:00
parent 0060caaf1a
commit 87ba3411a4
3 changed files with 12 additions and 7 deletions

View File

@ -1361,6 +1361,16 @@ static void CV_SetCVar(consvar_t *var, const char *value, boolean stealth)
return;
}
if (var == &cv_forceskin)
{
INT32 skin = R_SkinAvailable(value);
if ((stricmp(value, "None")) && ((skin == -1) || !R_SkinUnlock(-1, skin)))
{
CONS_Printf("Please provide a valid skin name (\"None\" disables).\n");
return;
}
}
// Only add to netcmd buffer if in a netgame, otherwise, just change it.
if (netgame || multiplayer)
{
@ -1407,12 +1417,8 @@ static void CV_SetValueMaybeStealth(consvar_t *var, INT32 value, boolean stealth
if (var == &cv_forceskin) // Special handling.
{
if ((server || adminplayer == consoleplayer) && ((value < 0) || (value >= numskins) || !(R_SkinUnlock(-1, cv_forceskin.value))))
{
CONS_Printf("Please provide a valid skin name (\"None\" disables).\n");
if ((value < 0) || (value >= numskins))
sprintf(val, "None");
value = -1;
}
else
sprintf(val, "%s", skins[value].name);
}

View File

@ -4056,7 +4056,7 @@ static void ForceSkin_OnChange(void)
CONS_Printf("The server has lifted the forced skin restrictions.\n");
else
{
CONS_Printf("The server is restricting all players to skin \"%s\".\n",skins[cv_forceskin.value].realname);
CONS_Printf("The server is restricting all players to skin \"%s\".\n",skins[cv_forceskin.value].name);
ForceAllSkins(cv_forceskin.value);
}
}

View File

@ -2622,7 +2622,6 @@ void SetPlayerSkinByNum(INT32 playernum, INT32 skinnum)
player_t *player = &players[playernum];
skin_t *skin = &skins[skinnum];
UINT8 newcolor = 0;
CONS_Printf("%d - %d\n", playernum, player->availabilities);
if (skinnum >= 0 && skinnum < numskins && R_SkinUnlock(playernum, skinnum)) // Make sure it exists!
{