Eliminate iqhere global in order to get rid of spurious Python warning.
authorEric S. Raymond <esr@thyrsus.com>
Thu, 5 Oct 2006 08:36:54 +0000 (08:36 +0000)
committerEric S. Raymond <esr@thyrsus.com>
Thu, 5 Oct 2006 08:36:54 +0000 (08:36 +0000)
Where we need this flag, we now deduce it from the location of the Thing.

src/sst.py

index 5655c7e09c96f494b34e202c7767794863603e7a..3f78e233d47ea7047d40c5cd11cb9943ae6cf4ac 100644 (file)
@@ -1587,7 +1587,7 @@ def attack(torps_ok):
        moveklings()
 
     # if no enemies remain after movement, we're done 
        moveklings()
 
     # if no enemies remain after movement, we're done 
-    if game.nenhere==0 or (game.nenhere==1 and iqhere and not iqengry):
+    if game.nenhere==0 or (game.nenhere==1 and thing == game.quadrant and not iqengry):
        return
 
     # set up partial hits if attack happens during shield status change 
        return
 
     # set up partial hits if attack happens during shield status change 
@@ -1737,8 +1737,8 @@ def deadkl(w, type, mv):
        game.ithere = False
     elif type == IHQUEST:
        # Killed a Thingy
        game.ithere = False
     elif type == IHQUEST:
        # Killed a Thingy
-        global iqhere, iqengry
-       iqhere = iqengry = False
+        global iqengry
+       iqengry = False
        invalidate(thing)
     else:
        # Some type of a Klingon 
        invalidate(thing)
     else:
        # Some type of a Klingon 
@@ -6103,7 +6103,7 @@ def setup(needprompt):
        prout(_("  YOU'LL NEED IT."))
     waitfor()
     newqad(False)
        prout(_("  YOU'LL NEED IT."))
     waitfor()
     newqad(False)
-    if game.nenhere - iqhere-game.ithere:
+    if game.nenhere - (thing == game.quadrant) - game.ithere:
        game.shldup = True
     if game.neutz:     # bad luck to start in a Romulan Neutral Zone
        attack(False)
        game.shldup = True
     if game.neutz:     # bad luck to start in a Romulan Neutral Zone
        attack(False)
@@ -6262,8 +6262,7 @@ def newqad(shutup):
     game.landed = False
     game.ientesc = False
     game.ithere = False
     game.landed = False
     game.ientesc = False
     game.ithere = False
-    global iqhere, iqengry
-    iqhere = False
+    global iqengry
     iqengry = False
     game.iseenit = False
     if game.iscate:
     iqengry = False
     game.iseenit = False
     if game.iscate:
@@ -6343,8 +6342,6 @@ def newqad(shutup):
            w = dropin(IHQUEST)
            thing = randplace(GALSIZE)
            game.nenhere += 1
            w = dropin(IHQUEST)
            thing = randplace(GALSIZE)
            game.nenhere += 1
-            global iqhere
-           iqhere = True
            game.ks[game.nenhere] = w
            game.kdist[game.nenhere] = game.kavgd[game.nenhere] = \
                distance(game.sector, w)
            game.ks[game.nenhere] = w
            game.kdist[game.nenhere] = game.kavgd[game.nenhere] = \
                distance(game.sector, w)
@@ -6401,7 +6398,7 @@ def newqad(shutup):
 def sortklings():
     # sort Klingons by distance from us 
     # The author liked bubble sort. So we will use it. :-(
 def sortklings():
     # sort Klingons by distance from us 
     # The author liked bubble sort. So we will use it. :-(
-    if game.nenhere-iqhere-game.ithere < 2:
+    if game.nenhere-(thing==game.quadrant)-game.ithere < 2:
        return
     while True:
        sw = False
        return
     while True:
        sw = False
@@ -6936,11 +6933,11 @@ def debugme():
        atover(True)
 
 if __name__ == '__main__':
        atover(True)
 
 if __name__ == '__main__':
-    global line, thing, game, idebug, iqhere, iqengry
+    global line, thing, game, idebug, iqengry
     game = citem = aaitem = inqueue = None
     line = ''
     thing = coord()
     game = citem = aaitem = inqueue = None
     line = ''
     thing = coord()
-    iqhere = iqengry = False
+    iqengry = False
     game = gamestate()
     idebug = 0
 
     game = gamestate()
     idebug = 0