Skip to content

Commit

Permalink
Manual merge from BitCrackers#568
Browse files Browse the repository at this point in the history
BitCrackers#568

Manually merging because github doesn't let me cherry pick on the website
  • Loading branch information
cpguy5089 authored Oct 14, 2023
1 parent 516e9de commit 5791228
Showing 1 changed file with 21 additions and 4 deletions.
25 changes: 21 additions & 4 deletions gui/tabs/host_tab.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,16 +42,33 @@ namespace HostTab {
State.scientists_amount = (int)GetRoleCount(RoleType::Scientist);
State.shapeshifters_amount = (int)GetRoleCount(RoleType::Shapeshifter);
State.impostors_amount = (int)GetRoleCount(RoleType::Impostor);
State.crewmates_amount = (int)GetRoleCount(RoleType::Crewmate);
if (State.impostors_amount + State.shapeshifters_amount > maxImposterAmount)
{
if(State.assignedRoles[index] == RoleType::Shapeshifter)
State.assignedRoles[index] = RoleType::Engineer;
State.assignedRoles[index] = RoleType::Random; //Set to random to avoid bugs.
else if(State.assignedRoles[index] == RoleType::Impostor)
State.assignedRoles[index] = RoleType::Random;
State.shapeshifters_amount = (int)GetRoleCount(RoleType::Shapeshifter);
State.impostors_amount = (int)GetRoleCount(RoleType::Impostor);
//State.shapeshifters_amount = (int)GetRoleCount(RoleType::Shapeshifter);
//State.impostors_amount = (int)GetRoleCount(RoleType::Impostor);
}

if (State.assignedRoles[index] == RoleType::Engineer || State.assignedRoles[index] == RoleType::Scientist || State.assignedRoles[index] == RoleType::Crewmate) {
if (State.engineers_amount + State.scientists_amount + State.crewmates_amount >= (int)playerAmount)
State.assignedRoles[index] = RoleType::Random;
} //Some may set all players to non imps. This hangs the game on beginning. Leave space to Random so we have imps.

if (options.GetGameMode() == GameModes__Enum::HideNSeek)
{
if (State.assignedRoles[index] == RoleType::Shapeshifter)
State.assignedRoles[index] = RoleType::Random;
else if (State.assignedRoles[index] == RoleType::Scientist)
State.assignedRoles[index] = RoleType::Engineer;
else if (State.assignedRoles[index] == RoleType::Crewmate)
State.assignedRoles[index] = RoleType::Engineer;
} //Assign other roles in hidenseek causes game bug.
//These are organized. Do not change the order unless you find it necessary.

if (!IsInGame()) {
SetRoleAmount(RoleTypes__Enum::Engineer, State.engineers_amount);
SetRoleAmount(RoleTypes__Enum::Scientist, State.scientists_amount);
Expand Down Expand Up @@ -96,4 +113,4 @@ namespace HostTab {
{
return std::count_if(State.assignedRoles.cbegin(), State.assignedRoles.cend(), [role](RoleType i) {return i == role; });
}
}
}

0 comments on commit 5791228

Please sign in to comment.