> numfollowers-1 -> >= numfollowers

This commit is contained in:
Sally Coolatta 2022-05-23 13:40:51 -04:00
parent d8b7967a22
commit 6e3c4dbc34
3 changed files with 11 additions and 11 deletions

View file

@ -1422,7 +1422,7 @@ static void SendNameAndColor(UINT8 n)
CV_StealthSet(&cv_followercolor[n], "Match"); // set it to "Match". I don't care about your stupidity! CV_StealthSet(&cv_followercolor[n], "Match"); // set it to "Match". I don't care about your stupidity!
// so like, this is sent before we even use anything like cvars or w/e so it's possible that follower is set to a pretty yikes value, so let's fix that before we send garbage that could crash the game: // so like, this is sent before we even use anything like cvars or w/e so it's possible that follower is set to a pretty yikes value, so let's fix that before we send garbage that could crash the game:
if (cv_follower[n].value > numfollowers-1 || cv_follower[n].value < -1) if (cv_follower[n].value >= numfollowers || cv_follower[n].value < -1)
CV_StealthSet(&cv_follower[n], "-1"); CV_StealthSet(&cv_follower[n], "-1");
if (!strcmp(cv_playername[n].string, player_names[playernum]) if (!strcmp(cv_playername[n].string, player_names[playernum])

View file

@ -201,7 +201,7 @@ void K_HandleFollower(player_t *player)
} }
// How about making sure our follower exists and is added before trying to spawn it n' all? // How about making sure our follower exists and is added before trying to spawn it n' all?
if (player->followerskin > numfollowers-1 || player->followerskin < -1) if (player->followerskin >= numfollowers || player->followerskin < -1)
{ {
//CONS_Printf("Follower skin invlaid. Setting to -1.\n"); //CONS_Printf("Follower skin invlaid. Setting to -1.\n");
player->followerskin = -1; player->followerskin = -1;

View file

@ -9683,7 +9683,7 @@ static void M_DrawSetupMultiPlayerMenu(void)
static void M_GetFollowerState(void) static void M_GetFollowerState(void)
{ {
if (setupm_fakefollower <= -1 || setupm_fakefollower > numfollowers-1) // yikes, there's none! if (setupm_fakefollower <= -1 || setupm_fakefollower >= numfollowers) // yikes, there's none!
return; return;
// ^ we don't actually need to set anything since it won't be displayed anyway. // ^ we don't actually need to set anything since it won't be displayed anyway.
@ -9831,13 +9831,13 @@ static void M_HandleSetupMultiPlayer(INT32 choice)
// check followers: // check followers:
if (setupm_fakefollower < -1) if (setupm_fakefollower < -1)
{ {
setupm_fakefollower = numfollowers-1; setupm_fakefollower = numfollowers;
M_GetFollowerState(); // update follower state M_GetFollowerState(); // update follower state
} }
if (setupm_fakefollower > numfollowers-1) if (setupm_fakefollower >= numfollowers)
{ {
setupm_fakefollower = -1; setupm_fakefollower = -1;
M_GetFollowerState(); // update follower state M_GetFollowerState(); // update follower state
} }
// check color // check color
@ -9879,7 +9879,7 @@ static void M_SetupMultiPlayer(INT32 choice)
setupm_fakefollower = atoi(setupm_cvfollower->string); // update fake follower value setupm_fakefollower = atoi(setupm_cvfollower->string); // update fake follower value
// yikes, we don't want none of that... // yikes, we don't want none of that...
if (setupm_fakefollower > numfollowers-1) if (setupm_fakefollower >= numfollowers)
setupm_fakefollower = -1; setupm_fakefollower = -1;
M_GetFollowerState(); // update follower state M_GetFollowerState(); // update follower state
@ -9922,7 +9922,7 @@ static void M_SetupMultiPlayer2(INT32 choice)
setupm_fakefollower = atoi(setupm_cvfollower->string); // update fake follower value setupm_fakefollower = atoi(setupm_cvfollower->string); // update fake follower value
// yikes, we don't want none of that... // yikes, we don't want none of that...
if (setupm_fakefollower > numfollowers-1) if (setupm_fakefollower >= numfollowers)
setupm_fakefollower = -1; setupm_fakefollower = -1;
M_GetFollowerState(); // update follower state M_GetFollowerState(); // update follower state
@ -9965,7 +9965,7 @@ static void M_SetupMultiPlayer3(INT32 choice)
setupm_fakefollower = atoi(setupm_cvfollower->string); // update fake follower value setupm_fakefollower = atoi(setupm_cvfollower->string); // update fake follower value
// yikes, we don't want none of that... // yikes, we don't want none of that...
if (setupm_fakefollower > numfollowers-1) if (setupm_fakefollower >= numfollowers)
setupm_fakefollower = -1; setupm_fakefollower = -1;
M_GetFollowerState(); // update follower state M_GetFollowerState(); // update follower state
@ -10008,7 +10008,7 @@ static void M_SetupMultiPlayer4(INT32 choice)
setupm_fakefollower = atoi(setupm_cvfollower->string); // update fake follower value setupm_fakefollower = atoi(setupm_cvfollower->string); // update fake follower value
// yikes, we don't want none of that... // yikes, we don't want none of that...
if (setupm_fakefollower > numfollowers-1) if (setupm_fakefollower >= numfollowers)
setupm_fakefollower = -1; setupm_fakefollower = -1;
M_GetFollowerState(); // update follower state M_GetFollowerState(); // update follower state