Skip to content

Commit

Permalink
Merge pull request #79 from mkapusnik/randomize-team-positioning
Browse files Browse the repository at this point in the history
More random player positioning
  • Loading branch information
odanek committed Mar 30, 2018
2 parents 35dbbfa + 82a2371 commit 5652510
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions source/gamemodes/TeamDeathMatch.cpp
Expand Up @@ -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()));
Expand Down

0 comments on commit 5652510

Please sign in to comment.