summaryrefslogtreecommitdiff
path: root/src/flag.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/flag.c')
-rw-r--r--src/flag.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/flag.c b/src/flag.c
new file mode 100644
index 0000000..9201cac
--- /dev/null
+++ b/src/flag.c
@@ -0,0 +1,26 @@
+/*
+** flag.c for in /home/gayot_o/prog/minesweeper
+**
+** Made by olivier gayot
+** Login <gayot_o@epitech.net>
+**
+** Started on Sun Apr 22 19:02:49 2012 olivier gayot
+** Last update Sun Apr 22 19:02:49 2012 olivier gayot
+*/
+
+#include "minesweeper.h"
+
+int flag(map_t *map, int *selection) {
+ case_t *case_ = &map->tab[*selection / BLOCK_W][*selection % BLOCK_W];
+
+ if (!case_->hidden)
+ return 0;
+ case_->flagged = (case_->flagged) ? false : true;
+ if (case_->flagged)
+ ++g_flags;
+ else
+ --g_flags;
+ dsp_ribbon_flags();
+ show_map(map);
+ return 0;
+}