From 793f66ce5c1dfffc87683b5085ca127b6d9e3159 Mon Sep 17 00:00:00 2001 From: "Eric S. Raymond" Date: Wed, 16 Aug 2023 05:59:12 -0400 Subject: [PATCH] Fix code so collisions can actually happen. --- sst | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/sst b/sst index c11e661..b9d9a6a 100755 --- a/sst +++ b/sst @@ -163,9 +163,9 @@ class Coord: return Coord(self.i//other, self.j//other) def __mod__(self, other): return Coord(self.i % other, self.j % other) - def __rtruediv__(self, other): + def __rtruediv__(self, other): # pragma: no cover return Coord(self.i/other, self.j/other) - def __rfloordiv__(self, other): + def __rfloordiv__(self, other): # pragma: no cover return Coord(self.i//other, self.j//other) def roundtogrid(self): return Coord(int(round(self.i)), int(round(self.j))) @@ -240,7 +240,7 @@ class Quadrant: self.charted = False self.status = "secure" # Could be "secure", "distressed", "enslaved" def __str__(self): - return "" % self.__dict__ + return "" % self.__dict__ # pragma: no cover __repr__ = __str__ class Page: @@ -421,7 +421,7 @@ class Enemy: game.enemies.remove(self) return motion def __repr__(self): - return "<%s,%s.%f>" % (self.type, self.location, self.power) # pragma: no cover + return "<%s,%s,%f>" % (self.type, self.location, self.power) # pragma: no cover class Gamestate: def __init__(self): @@ -973,7 +973,7 @@ def movetholian(): elif game.tholian.location.i == QUADSIZE-1 and game.tholian.location.j == 0: tid.i = 0 tid.j = 0 - else: + else: # pragma: no cover # something is wrong! game.tholian.move(None) prout("***Internal error: Tholian in a bad spot.") @@ -1246,7 +1246,7 @@ def collision(rammed, enemy): proutn(_(" (original position)")) skip(1) deadkl(enemy.location, enemy.type, game.sector) - proutn("***" + crmshp() + " heavily damaged.") + prout("***" + crmshp() + " heavily damaged.") icas = rnd.integer(10, 30) prout(_("***Sickbay reports %d casualties") % icas) game.casual += icas @@ -3843,11 +3843,11 @@ def imove(icourse=None, noattack=False): stopegy = 50.0*icourse.distance/game.optime if iquad in ('T', 'K', 'C', 'S', 'R', '?'): for enemy in game.enemies: - if enemy.location == game.sector: + if enemy.location == h: collision(rammed=False, enemy=enemy) return True # This should not happen - prout(_("Which way did he go?")) + prout(_("Which way did he go?")) # pragma: no cover return False elif iquad == ' ': skip(1) @@ -5306,8 +5306,8 @@ def damagereport(): for i in range(NDEVICES): if damaged(i): if not jdam: - prout(_("\tDEVICE\t\t\t-REPAIR TIMES-")) - prout(_("\t\t\tIN FLIGHT\t\tDOCKED")) + prout(_("DEVICE REPAIR TIMES")) + prout(_(" IN FLIGHT DOCKED")) jdam = True prout(" %-26s\t%8.2f\t\t%8.2f" % (device[i], game.damage[i]+0.05, -- 2.31.1