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 (from parent 1:
59e9f24
)
Refactor - use getcoord() in course setting.
author
Eric S. Raymond
<esr@thyrsus.com>
Sun, 13 Aug 2023 09:40:39 +0000
(
05:40
-0400)
committer
Eric S. Raymond
<esr@thyrsus.com>
Sun, 13 Aug 2023 09:40:39 +0000
(
05:40
-0400)
sst
patch
|
blob
|
history
diff --git
a/sst
b/sst
index 94bc397b2c0f8e5df713a84398b8098e03c80dc6..7cbccffa28dd4efe463357015b2200d01b692fc6 100755
(executable)
--- a/
sst
+++ b/
sst
@@
-4009,39
+4009,35
@@
def getcourse(isprobe):
scanner.chew()
iprompt = True
key = scanner.nexttok()
scanner.chew()
iprompt = True
key = scanner.nexttok()
- if key != "IHREAL":
- huh()
- raise TrekError
- xi = int(round(scanner.real))-1
- key = scanner.nexttok()
- if key != "IHREAL":
- huh()
+ scanner.push(scanner.token) # Something IHREAL or IHALPHA awaits us
+ first = scanner.getcoord()
+ if first is None:
raise TrekError
raise TrekError
- xj = int(round(scanner.real))-1
- key = scanner.nexttok()
- if key == "IHREAL":
- # both quadrant and sector specified
- xk = int(round(scanner.real))-1
- key = scanner.nexttok()
- if key != "IHREAL":
- huh()
+ scanner.nexttok()
+ if scanner.type == "IHEOL":
+ second = None
+ else:
+ scanner.push(scanner.token)
+ second = scanner.getcoord()
+ if second is None:
raise TrekError
raise TrekError
- xl = int(round(scanner.real))-1
- dquad.i = xi
- dquad.j = xj
- dsect.i = xk
- dsect.j = xl
+ scanner.chew()
+ if second is not None:
+ dquad.i = first.i
+ dquad.j = first.j
+ dsect.i = second.i
+ dsect.j = second.j
else:
# only one pair of numbers was specified
if isprobe:
# only quadrant specified -- go to center of dest quad
else:
# only one pair of numbers was specified
if isprobe:
# only quadrant specified -- go to center of dest quad
- dquad.i =
x
i
- dquad.j =
x
j
- dsect.j = dsect.i =
4
# preserves 1-origin behavior
+ dquad.i =
first.
i
+ dquad.j =
first.
j
+ dsect.j = dsect.i =
(QUADSIZE/2)-1
# preserves 1-origin behavior
else:
# only sector specified
else:
# only sector specified
- dsect.i =
x
i
- dsect.j =
x
j
+ dsect.i =
first.
i
+ dsect.j =
first.
j
itemp = "normal"
if not dquad.valid_quadrant() or not dsect.valid_sector():
huh()
itemp = "normal"
if not dquad.valid_quadrant() or not dsect.valid_sector():
huh()
@@
-6539,7
+6535,7
@@
class sstscanner:
# Get a token from the user
self.real = 0.0
self.token = ''
# Get a token from the user
self.real = 0.0
self.token = ''
- # Fill the token quue if nothing here
+ # Fill the token qu
e
ue if nothing here
while not self.inqueue:
sline = cgetline()
if curwnd==prompt_window:
while not self.inqueue:
sline = cgetline()
if curwnd==prompt_window: