projects
/
super-star-trek.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
e66c665
)
Improved internal sanity checking.
author
Eric S. Raymond
<esr@thyrsus.com>
Fri, 11 Aug 2023 13:34:08 +0000
(09:34 -0400)
committer
Eric S. Raymond
<esr@thyrsus.com>
Fri, 11 Aug 2023 13:34:08 +0000
(09:34 -0400)
sst.py
patch
|
blob
|
history
diff --git
a/sst.py
b/sst.py
index 4cf0270bae719d04e876e0122e7742bac66f4752..d25e3c6f9ba7bb319ee618d846494f420c075fe0 100755
(executable)
--- a/
sst.py
+++ b/
sst.py
@@
-142,9
+142,9
@@
class Coord:
self.i = x # Row
self.j = y # Column
def valid_quadrant(self):
self.i = x # Row
self.j = y # Column
def valid_quadrant(self):
- return
self.i >= 0 and self.i < GALSIZE and self.j >= 0 and self.j < GALSIZE
+ return
(self.i is not None) and (self.j is not None) and (self.i >= 0) and (self.i < GALSIZE) and (self.j >= 0) and (self.j < GALSIZE)
def valid_sector(self):
def valid_sector(self):
- return
self.i >= 0 and self.i < QUADSIZE and self.j >= 0 and self.j < QUADSIZE
+ return
(self.i is not None) and (self.j is not None) and (self.i >= 0) and (self.i < QUADSIZE) and (self.j >= 0) and (self.j < QUADSIZE)
def invalidate(self):
self.i = self.j = None
def __eq__(self, other):
def invalidate(self):
self.i = self.j = None
def __eq__(self, other):
@@
-3912,7
+3912,10
@@
def dock(verbose):
if game.inorbit:
prout(_("You must first leave standard orbit."))
return
if game.inorbit:
prout(_("You must first leave standard orbit."))
return
- if game.base is None or abs(game.sector.i-game.base.i) > 1 or abs(game.sector.j-game.base.j) > 1:
+ if game.base is None or not game.base.valid_sector():
+ prout(_("No starbase available for docking in this quadrant."))
+ return
+ if (abs(game.sector.i-game.base.i) > 1) or (abs(game.sector.j-game.base.j) > 1):
prout(crmshp() + _(" not adjacent to base."))
return
if game.iscloaked:
prout(crmshp() + _(" not adjacent to base."))
return
if game.iscloaked: