diff --git a/server/Adjudication/Validation/Validator.cs b/server/Adjudication/Validation/Validator.cs index 57f9e63..423d427 100644 --- a/server/Adjudication/Validation/Validator.cs +++ b/server/Adjudication/Validation/Validator.cs @@ -63,8 +63,18 @@ private void ValidateConvoys() foreach (var convoy in convoys) { // TODO fix for convoying to/from land regions with child coasts - var convoysFromCoast = regions.First(r => r.Id == convoy.Midpoint.RegionId); - var convoysToCoast = regions.First(r => r.Id == convoy.Destination.RegionId); + var locationRegion = regions.First(r => r.Id == convoy.Location.RegionId); + var midpointRegion = regions.First(r => r.Id == convoy.Midpoint.RegionId); + var destinationRegion = regions.First(r => r.Id == convoy.Destination.RegionId); + + if (locationRegion.Type != RegionType.Sea + || midpointRegion.Type != RegionType.Coast + || destinationRegion.Type != RegionType.Coast) + { + convoy.Status = OrderStatus.Invalid; + continue; + } + var hasMatchingMove = world.Orders .OfType() .Any(m => m.Location == convoy.Midpoint && m.Destination == convoy.Destination); diff --git a/server/Repositories/GameRepository.cs b/server/Repositories/GameRepository.cs index 4cd7415..5e46f04 100644 --- a/server/Repositories/GameRepository.cs +++ b/server/Repositories/GameRepository.cs @@ -52,6 +52,7 @@ public async Task CreateSandboxGame() return game; } + // TODO allow re-joining sandbox game public async Task<(Game game, Nation player)> JoinGame(int id, Nation? player) { logger.LogInformation("Joining game {Id} as player {Player}", id, player);