From: Eric S. Raymond Date: Thu, 5 Oct 2006 08:36:54 +0000 (+0000) Subject: Eliminate iqhere global in order to get rid of spurious Python warning. X-Git-Tag: 2.0~157 X-Git-Url: https://jxself.org/git/?a=commitdiff_plain;h=dc314dbf1be24f015f4e4cb33cd7c21ffa7eae7e;p=super-star-trek.git Eliminate iqhere global in order to get rid of spurious Python warning. Where we need this flag, we now deduce it from the location of the Thing. --- diff --git a/src/sst.py b/src/sst.py index 5655c7e..3f78e23 100644 --- a/src/sst.py +++ b/src/sst.py @@ -1587,7 +1587,7 @@ def attack(torps_ok): 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 @@ -1737,8 +1737,8 @@ def deadkl(w, type, mv): 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 @@ -6103,7 +6103,7 @@ def setup(needprompt): 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) @@ -6262,8 +6262,7 @@ def newqad(shutup): game.landed = False game.ientesc = False game.ithere = False - global iqhere, iqengry - iqhere = False + global iqengry iqengry = False game.iseenit = False if game.iscate: @@ -6343,8 +6342,6 @@ def newqad(shutup): 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) @@ -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. :-( - if game.nenhere-iqhere-game.ithere < 2: + if game.nenhere-(thing==game.quadrant)-game.ithere < 2: return while True: sw = False @@ -6936,11 +6933,11 @@ def debugme(): 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() - iqhere = iqengry = False + iqengry = False game = gamestate() idebug = 0