From be7e74dd52f86dce219b3ef1236214caffda7d75 Mon Sep 17 00:00:00 2001 From: "Eric S. Raymond" Date: Fri, 13 Oct 2006 16:54:21 +0000 Subject: [PATCH] Subsume more trig into the course object. --- src/sst.py | 26 ++++++-------------------- 1 file changed, 6 insertions(+), 20 deletions(-) diff --git a/src/sst.py b/src/sst.py index 3cfffb7..ddb1313 100644 --- a/src/sst.py +++ b/src/sst.py @@ -4069,26 +4069,12 @@ def warp(course, involuntary): if blooey or twarp: # If time warp or engine damage, check path # If it is obstructed, don't do warp or damage - angle = ((15.0-course.bearing)*0.5235998) - deltax = -math.sin(angle) - deltay = math.cos(angle) - if math.fabs(deltax) > math.fabs(deltay): - bigger = math.fabs(deltax) - else: - bigger = math.fabs(deltay) - deltax /= bigger - deltay /= bigger - n = 10.0 * course.distance * bigger +0.5 - x = game.sector.i - y = game.sector.j - for l in range(1, n+1): - x += deltax - ix = x + 0.5 - y += deltay - iy = y +0.5 - if not coord(ix, iy).valid_sector(): - break - if game.quad[ix][iy] != IHDOT: + for m in range(course.moves): + course.next() + w = course.sector() + if not w.valid_sector(): + break + if game.quad[w.x][w.y] != IHDOT: blooey = False twarp = False # Activate Warp Engines and pay the cost -- 2.31.1