Code review

This commit is contained in:
Laserlicht committed 2024-05-02 20:15:34 +02:00
1 parent b9c4a56360
commit 37d9e862c2
3 files changed
+11 -15

No files matched your search

+3 -7
View File
@@ -380,13 +380,9 @@ void ApplyOnServerNetPackVisitor::visitLobbyPvPAction(LobbyPvPAction & pack)
{
std::vector<FactionID> allowedTowns;
VLC->townh->forEach([pack, &allowedTowns](const Faction *entity, bool &stop){
if(!entity->hasTown())
return;
if(std::find(pack.bannedTowns.begin(), pack.bannedTowns.end(), entity->getId()) == pack.bannedTowns.end()) {
allowedTowns.push_back(entity->getId());
}
});
for (auto const & factionID : VLC->townh->getDefaultAllowed())
if(std::find(pack.bannedTowns.begin(), pack.bannedTowns.end(), factionID) == pack.bannedTowns.end())
allowedTowns.push_back(factionID);
std::vector<FactionID> randomFaction1;
std::sample(allowedTowns.begin(), allowedTowns.end(), std::back_inserter(randomFaction1), 1, std::mt19937{std::random_device{}()});