Abstract away the operations involving a sentinel value for coordinates.
[super-star-trek.git] / src / sst.h
index a397ed25633ad63db6a05fad108280b8c47ae0b6..a9bf781e546a588bcd558fdde1a99ff2441fb253 100644 (file)
--- a/src/sst.h
+++ b/src/sst.h
@@ -45,6 +45,8 @@ typedef struct {int x; int y;} coord;
 #define square(i)              ((i)*(i))
 #define same(c1, c2)           ((c1.x == c2.x) && (c1.y == c2.y))
 #define distance(c1, c2)       sqrt(square(c1.x - c2.x) + square(c1.y - c2.y))
 #define square(i)              ((i)*(i))
 #define same(c1, c2)           ((c1.x == c2.x) && (c1.y == c2.y))
 #define distance(c1, c2)       sqrt(square(c1.x - c2.x) + square(c1.y - c2.y))
+#define invalidate(w)          w.x = w.y = 0
+#define is_valid(w)            (w.x == 0 || w.y == 0)
 
 typedef struct {
     coord w;
 
 typedef struct {
     coord w;