From: Eric S. Raymond Date: Fri, 13 Oct 2006 16:54:21 +0000 (+0000) Subject: Subsume more trig into the course object. X-Git-Tag: 2.0~67 X-Git-Url: https://jxself.org/git/?p=super-star-trek.git;a=commitdiff_plain;h=be7e74dd52f86dce219b3ef1236214caffda7d75 Subsume more trig into the course object. --- 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