From 0757344bdf05b95a56c7994e78fe6f656bfd107c Mon Sep 17 00:00:00 2001 From: hz Date: Tue, 19 May 2026 15:24:46 -0500 Subject: [PATCH] fixing enemy territory claim bug --- game/territory-autobattler/scenes/game/hex_grid_screen.gd | 2 +- .../LocationsApi/Services/UnitTrainingService.cs | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/game/territory-autobattler/scenes/game/hex_grid_screen.gd b/game/territory-autobattler/scenes/game/hex_grid_screen.gd index a4f911b..e99bd97 100644 --- a/game/territory-autobattler/scenes/game/hex_grid_screen.gd +++ b/game/territory-autobattler/scenes/game/hex_grid_screen.gd @@ -1082,7 +1082,7 @@ func _on_move_units_request_completed(result: int, response_code: int, _headers: _clear_selected_archers() coordinate_label.text = "Archer squad moved." - _refresh_player_state() + _load_visible_locations() func _claim_selected_tile() -> void: diff --git a/microservices/LocationsApi/Services/UnitTrainingService.cs b/microservices/LocationsApi/Services/UnitTrainingService.cs index 02f6dce..c6d7ed1 100644 --- a/microservices/LocationsApi/Services/UnitTrainingService.cs +++ b/microservices/LocationsApi/Services/UnitTrainingService.cs @@ -278,8 +278,14 @@ public class UnitTrainingService return; } + var emptyBuildingFilter = Builders.Filter.And( + Builders.Filter.Eq(x => x.Id, target.Id), + Builders.Filter.Or( + Builders.Filter.Eq(x => x.BuildingType, null), + Builders.Filter.Eq(x => x.BuildingType, ""))); + await _locations.UpdateOneAsync( - x => x.Id == target.Id && (x.BuildingType == null || x.BuildingType == ""), + emptyBuildingFilter, Builders.Update .Set(x => x.OwnerUsername, username) .Set(x => x.Kind, "Claimed")