diff options
-rw-r--r-- | display.h | 4 | ||||
-rw-r--r-- | dive.h | 7 |
2 files changed, 9 insertions, 2 deletions
@@ -6,12 +6,12 @@ #include <cairo.h> extern int selected_dive; +#define current_dive (get_dive(selected_dive)) + extern GtkWidget *dive_profile_frame(void); extern GtkWidget *dive_info_frame(void); extern GtkWidget *create_dive_list(void); extern void update_dive_info(struct dive *dive); extern void repaint_dive(void); -#define current_dive (dive_table.dives[selected_dive]) - #endif @@ -121,6 +121,13 @@ struct dive_table { extern struct dive_table dive_table; +static inline struct dive *get_dive(unsigned int nr) +{ + if (nr >= dive_table.nr) + return NULL; + return dive_table.dives[nr]; +} + extern void parse_xml_init(void); extern void parse_xml_file(const char *filename); |