aboutsummaryrefslogtreecommitdiff
path: root/diplomacy
diff options
context:
space:
mode:
Diffstat (limited to 'diplomacy')
-rw-r--r--diplomacy/engine/map.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/diplomacy/engine/map.py b/diplomacy/engine/map.py
index 2730168..db2ab5c 100644
--- a/diplomacy/engine/map.py
+++ b/diplomacy/engine/map.py
@@ -208,11 +208,13 @@ class Map():
self.error += [err.MAP_NO_FULL_NAME % place]
# Checking one-way adjacency
+ # Adjacencies between lower-case coast and water are supposed to be one-way
for loc in abuts:
if self.area_type(place) != 'SHUT' \
and self.area_type(loc) != 'SHUT' \
and not self.abuts('A', loc, '-', place) \
- and not self.abuts('F', loc, '-', place):
+ and not self.abuts('F', loc, '-', place) \
+ and not (place.islower() and self.area_type(loc) == 'WATER'):
self.error.append(err.MAP_ONE_WAY_ADJ % (place, loc))
# Validating home centers
@@ -1109,6 +1111,10 @@ class Map():
# pylint: disable=too-many-return-statements
unit_loc, other_loc = unit_loc.upper(), other_loc.upper()
+ # If the unit is not valid on the current location, returning 0
+ if not self.is_valid_unit(unit_type + ' ' + unit_loc):
+ return 0
+
# Removing coasts for support
# Otherwise, if army, not adjacent since army can't move, hold, or convoy on coasts
if '/' in other_loc: