From: Eric S. Raymond Date: Thu, 12 Oct 2006 22:04:27 +0000 (+0000) Subject: Another refactoring step. X-Git-Tag: 2.0~75 X-Git-Url: https://jxself.org/git/?a=commitdiff_plain;h=dd7d033574c718edac51442154c32af625e38bec;p=super-star-trek.git Another refactoring step. --- diff --git a/src/sst.py b/src/sst.py index f2b0bd0..bf72de5 100644 --- a/src/sst.py +++ b/src/sst.py @@ -1356,21 +1356,17 @@ def torpedo(origin, bearing, dispersion, number, nburst): if game.quad[bumpto.i][bumpto.j] == IHBLANK: prout(_(" buffeted into black hole.")) deadkl(w, iquad, bumpto) - return None if game.quad[bumpto.i][bumpto.j] != IHDOT: - # can't move into object prout(_(" damaged but not destroyed.")) - return None - proutn(_(" damaged--")) - enemy.kloc = bumpto - game.quad[w.i][w.j]=IHDOT - game.quad[bumpto.i][bumpto.j]=iquad - prout(_(" displaced by blast to Sector %s ") % bumpto) - for enemy in game.enemies: - enemy.kdist = enemy.kavgd = (game.sector-enemy.kloc).distance() - game.enemies.sort(lambda x, y: cmp(x.kdist, y.kdist)) + else: + prout(_(" damaged-- displaced by blast to Sector %s ")%bumpto) + enemy.kloc = bumpto + game.quad[w.i][w.j]=IHDOT + game.quad[bumpto.i][bumpto.j]=iquad + for enemy in game.enemies: + enemy.kdist = enemy.kavgd = (game.sector-enemy.kloc).distance() + game.enemies.sort(lambda x, y: cmp(x.kdist, y.kdist)) return None - break elif iquad == IHB: # Hit a base skip(1) prout(_("***STARBASE DESTROYED.."))