From 82a2371ea94f62cddebeba7b87cb956b337794c8 Mon Sep 17 00:00:00 2001 From: Michal Kapusnik Date: Thu, 29 Mar 2018 00:42:22 +0200 Subject: [PATCH] More random player positioning --- source/gamemodes/TeamDeathMatch.cpp | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/source/gamemodes/TeamDeathMatch.cpp b/source/gamemodes/TeamDeathMatch.cpp index ad037fbd..4bdb3c1e 100644 --- a/source/gamemodes/TeamDeathMatch.cpp +++ b/source/gamemodes/TeamDeathMatch.cpp @@ -72,11 +72,8 @@ namespace Duel6 { Int32 ammo = Math::random(ammoRange.first, ammoRange.second); Int32 playerTeam = (playerIndex + randomizer) % teamsCount; - Int32 playerTeamIndex = playerIndex / teamsCount; - - bool direction = Math::random(2) != 0; - Int32 lowerBound = layerSpan * playerTeam; - Int32 index = lowerBound + midpoint + (direction ? playerTeamIndex : -playerTeamIndex) % midpoint; + Int32 playerTeamIndex = Math::random(layerSpan); + Int32 index = (layerSpan * playerTeam) + playerTeamIndex % layerSpan; Level::StartingPosition position = startingPositions[index]; player.startRound(world, position.first, position.second, ammo, Weapon::getRandomEnabled(game.getSettings()));