diff --git a/hooks/RoleManager.cpp b/hooks/RoleManager.cpp index b7210641..47dabbfb 100644 --- a/hooks/RoleManager.cpp +++ b/hooks/RoleManager.cpp @@ -11,7 +11,7 @@ void dRoleManager_SelectRoles(RoleManager* __this, MethodInfo* method) { std::vector assignedPlayers; auto allPlayers = GetAllPlayerControl(); - auto roleRates = RoleRates((*Game::pGameOptionsData)->fields.RoleOptions); + auto roleRates = RoleRates((*Game::pGameOptionsData)->fields); AssignPreChosenRoles(roleRates, assignedPlayers); AssignRoles(roleRates.ShapeshifterCount, roleRates.ShapeshifterChance, RoleTypes__Enum::Shapeshifter, allPlayers, assignedPlayers); @@ -45,12 +45,14 @@ void AssignPreChosenRoles(RoleRates& roleRates, std::vector& assignedPl if (roleRates.ShapeshifterCount == 0) continue; roleRates.ShapeshifterCount--; + roleRates.ImposterCount--; } else if (trueRole == RoleTypes__Enum::Impostor) { if (roleRates.ImposterCount == 0) continue; roleRates.ImposterCount--; + roleRates.ShapeshifterCount--; } else if (trueRole == RoleTypes__Enum::Scientist) { diff --git a/user/utility.cpp b/user/utility.cpp index 03e87273..184ffaa2 100644 --- a/user/utility.cpp +++ b/user/utility.cpp @@ -15,8 +15,9 @@ int randi(int lo, int hi) { return lo + i; } -RoleRates::RoleRates(RoleOptionsData* roleOptions) { - auto roleRates = roleOptions->fields.roleRates; +RoleRates::RoleRates(GameOptionsData__Fields gameOptionsDataFields) { + this->ImposterCount = gameOptionsDataFields.NumImpostors; + auto roleRates = gameOptionsDataFields.RoleOptions->fields.roleRates; if (roleRates->fields.count != 0) { auto vectors = roleRates->fields.entries[0].vector; for (auto iVector = 0; iVector < 32; iVector++) diff --git a/user/utility.h b/user/utility.h index ab3e1839..af39dcf5 100644 --- a/user/utility.h +++ b/user/utility.h @@ -38,7 +38,7 @@ class RoleRates { int EngineerCount = 0; int EngineerChance = 0; int MaxCrewmates = 15; - RoleRates(RoleOptionsData* roleOptions); + RoleRates(GameOptionsData__Fields gameOptionsDataFields); }; class PlayerSelection {