From 42f4537dc643982a9d144484db856a24c3dceeb5 Mon Sep 17 00:00:00 2001 From: Aldin Duraki Date: Tue, 2 Jun 2020 11:01:15 +0200 Subject: [PATCH] Fixed scope issue on collected playerMoves --- GoldWars/GoldWars/RoundCalculatorService.swift | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/GoldWars/GoldWars/RoundCalculatorService.swift b/GoldWars/GoldWars/RoundCalculatorService.swift index 3fb1688..fc57f96 100644 --- a/GoldWars/GoldWars/RoundCalculatorService.swift +++ b/GoldWars/GoldWars/RoundCalculatorService.swift @@ -35,7 +35,7 @@ class RoundCalculatorService { var baseSpecificMoves = collectBaseSpecificMoves() // TODO: Refactor to a less complex way - for (baseId, var playerMovesByBase) in baseSpecificMoves { + for (baseId, playerMovesByBase) in baseSpecificMoves { let targetBase = currentSnapshotModel?.baseEntites.filter { $0.baseId == baseId }[0] let possiblyOwnershipMoves = playerMovesByBase.filter { $0.key == targetBase?.ownership} @@ -50,10 +50,10 @@ class RoundCalculatorService { } } } - playerMovesByBase.removeValue(forKey: playerName) + baseSpecificMoves[baseId]!.removeValue(forKey: playerName) } - for (_, playerMoves) in playerMovesByBase { + for playerMoves in baseSpecificMoves[baseId]!.values { for playerMove in playerMoves { for base in currentSnapshotModel!.baseEntites { if base.baseId == playerMove.fromBase {