projects
/
pyrisk.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
0c4319c
)
Added adjacency checking to Engine.attack_and_fortify.
author
W. Trevor King
<wking@drexel.edu>
Fri, 26 Mar 2010 04:19:41 +0000
(
00:19
-0400)
committer
W. Trevor King
<wking@drexel.edu>
Fri, 26 Mar 2010 04:19:41 +0000
(
00:19
-0400)
risk/base.py
patch
|
blob
|
history
diff --git
a/risk/base.py
b/risk/base.py
index e1ea6224a8b23529cb2a8b57d18f6c4eb1c68d72..9fdda2630e28ed9670a4eff1cf7999051ea10f31 100644
(file)
--- a/
risk/base.py
+++ b/
risk/base.py
@@
-620,6
+620,9
@@
class Engine (ID_CmpMixin):
source_name,target_name,armies = action
source = self.world.territory_by_name(source_name)
target = self.world.territory_by_name(target_name)
+ if not source.borders(target):
+ raise PlayerError('Cannot reach %s from %s to %s'
+ % (target, source, mode))
if mode == 'attack':
tplayer = target.player
capture = self.attack(source, target, armies)