Skip to content

Commit

Permalink
2022.3.2
Browse files Browse the repository at this point in the history
  • Loading branch information
JordanMullerEntelect committed Aug 14, 2022
1 parent 83a66a7 commit 3ee308a
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 6 deletions.
1 change: 1 addition & 0 deletions game-engine/Domain/Models/Position.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ public override bool Equals(object obj)
{
if (ReferenceEquals(null, obj)) return false;
if (ReferenceEquals(this, obj)) return true;
if (obj.GetType() != typeof(Position) || obj.GetType() != typeof(Land)) return false;
return Equals((Position) obj);
}

Expand Down
2 changes: 1 addition & 1 deletion game-engine/Engine/.gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# - deploy

variables:
ENGINE_VERSION: 2022.3.1
ENGINE_VERSION: 2022.3.2
# DOCKER_REGISTRY: NOT_SET
# REGION: $AWS_DEFAULT_REGION

Expand Down
1 change: 1 addition & 0 deletions game-engine/Engine/Interfaces/IWorldStateService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,5 +38,6 @@ public interface IWorldStateService
Node NodeByPosition(Position position);
ScoutTower GetScoutTowerByRegion(Position position);
ScoutTower CreateScoutTower(int i, int j);
ISet<Position> ScoutTowerPositionsInUse { get; }
}
}
7 changes: 6 additions & 1 deletion game-engine/Engine/Services/TerritoryService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -105,14 +105,19 @@ private void RemoveAvailableNodeWhereBuildingIsPlaced(BotObject bot, AvailableNo
private void AddBuildingTerritory(BotObject bot, BuildingObject building)
{
var buildingTerritory = GetPositionsInBuildingRadius(building);
var newBuildingTerritory = buildingTerritory.Where(position => !claimedTerritory.Contains(position)).ToList();
var newBuildingTerritory = buildingTerritory.Where(PositionIsClaimable).ToList();

// creating new available nodes here just before creating the new land since it requires the worldStateService having all the available and resource nodes
CreateAvailableNodes(bot, newBuildingTerritory);

newBuildingTerritory.ForEach(position => CreateNewLand(bot, position));
}

private bool PositionIsClaimable(Position position)
{
return !(claimedTerritory.Contains(position) || worldStateService.ScoutTowerPositionsInUse.Contains(position));
}

private Land CreateNewLand(BotObject bot, Position position)
{
var containedNode = worldStateService.NodeByPosition(position);
Expand Down
4 changes: 2 additions & 2 deletions game-engine/Engine/Services/WorldStateService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public class WorldStateService : IWorldStateService
private readonly ISet<Position> woodPositionsInUse = new HashSet<Position>();
private readonly ISet<Position> stonePositionsInUse = new HashSet<Position>();
private readonly ISet<Position> goldPositionsInUse = new HashSet<Position>();
private readonly ISet<Position> scoutTowersPositionsInUse = new HashSet<Position>();
public ISet<Position> ScoutTowerPositionsInUse { get; } = new HashSet<Position>();

private readonly Dictionary<Position, Node> NodesByPosition = new Dictionary<Position, Node>();

Expand Down Expand Up @@ -307,7 +307,7 @@ public ScoutTower CreateScoutTower(int i, int j)
int lowerY = j * regionSize;
int upperY = (j + 1) * regionSize;

var newScoutTower = new ScoutTower(GenerateRandomPosition(lowerX, upperX, lowerY, upperY, scoutTowersPositionsInUse, 1,
var newScoutTower = new ScoutTower(GenerateRandomPosition(lowerX, upperX, lowerY, upperY, ScoutTowerPositionsInUse, 1,
false, true))
{
Id = Guid.NewGuid(),
Expand Down
2 changes: 1 addition & 1 deletion game-engine/GameRunner/.gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# - deploy

variables:
RUNNER_VERSION: 2022.3.1
RUNNER_VERSION: 2022.3.2
# DOCKER_REGISTRY: NOT_SET
# REGION: $AWS_DEFAULT_REGION

Expand Down
2 changes: 1 addition & 1 deletion game-engine/Logger/.gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# - deploy

variables:
LOGGER_VERSION: 2022.3.1
LOGGER_VERSION: 2022.3.2
# DOCKER_REGISTRY: NOT_SET
# REGION: $AWS_DEFAULT_REGION

Expand Down

0 comments on commit 3ee308a

Please sign in to comment.