]> git.tdb.fi Git - ext/subsurface.git/blobdiff - dive.h
Add weight system tracking
[ext/subsurface.git] / dive.h
diff --git a/dive.h b/dive.h
index ccb007dcbd5be6453fa94b1886d37f03f8d560c5..bfaa076b1eba08085a6329da989a230dd79d7e87 100644 (file)
--- a/dive.h
+++ b/dive.h
@@ -87,11 +87,29 @@ typedef struct {
        pressure_t start, end, sample_start, sample_end;
 } cylinder_t;
 
+typedef struct {
+       weight_t weight;
+       const char *description;        /* "integrated", "belt", "ankle" */
+} weightsystem_t;
+
+extern int cylinder_none(void *_data);
+extern int weightsystem_none(void *_data);
+
 extern int get_pressure_units(unsigned int mb, const char **units);
 extern double get_depth_units(unsigned int mm, int *frac, const char **units);
 extern double get_volume_units(unsigned int mm, int *frac, const char **units);
 extern double get_temp_units(unsigned int mm, const char **units);
 
+static inline double grams_to_lbs(int grams)
+{
+       return grams / 453.6;
+}
+
+static inline int lbs_to_grams(double lbs)
+{
+       return lbs * 453.6 + 0.5;
+}
+
 static inline double ml_to_cuft(int ml)
 {
        return ml / 28316.8466;
@@ -192,6 +210,7 @@ struct event {
 };
 
 #define MAX_CYLINDERS (8)
+#define MAX_WEIGHTSYSTEMS (4)
 
 struct dive {
        int number;
@@ -199,12 +218,14 @@ struct dive {
        char *location;
        char *notes;
        char *divemaster, *buddy;
+       int rating;
        double latitude, longitude;
        depth_t maxdepth, meandepth;
        duration_t duration, surfacetime;
        depth_t visibility;
        temperature_t airtemp, watertemp;
        cylinder_t cylinder[MAX_CYLINDERS];
+       weightsystem_t weightsystem[MAX_WEIGHTSYSTEMS];
        int sac, otu;
        struct event *events;
        int samples, alloc_samples;
@@ -313,5 +334,14 @@ const char *monthname(int mon);
 
 #define UTF8_DEGREE "\xc2\xb0"
 #define UTF8_SUBSCRIPT_2 "\xe2\x82\x82"
+#define UTF8_WHITESTAR "\xe2\x98\x86"
+#define UTF8_BLACKSTAR "\xe2\x98\x85"
+#define ZERO_STARS     UTF8_WHITESTAR UTF8_WHITESTAR UTF8_WHITESTAR UTF8_WHITESTAR UTF8_WHITESTAR
+#define ONE_STARS      UTF8_BLACKSTAR UTF8_WHITESTAR UTF8_WHITESTAR UTF8_WHITESTAR UTF8_WHITESTAR
+#define TWO_STARS      UTF8_BLACKSTAR UTF8_BLACKSTAR UTF8_WHITESTAR UTF8_WHITESTAR UTF8_WHITESTAR
+#define THREE_STARS    UTF8_BLACKSTAR UTF8_BLACKSTAR UTF8_BLACKSTAR UTF8_WHITESTAR UTF8_WHITESTAR
+#define FOUR_STARS     UTF8_BLACKSTAR UTF8_BLACKSTAR UTF8_BLACKSTAR UTF8_BLACKSTAR UTF8_WHITESTAR
+#define FIVE_STARS     UTF8_BLACKSTAR UTF8_BLACKSTAR UTF8_BLACKSTAR UTF8_BLACKSTAR UTF8_BLACKSTAR
+extern const char *star_strings[];
 
 #endif /* DIVE_H */