summaryrefslogtreecommitdiff
path: root/src/flag.c
blob: 9201cacc50cc8d54ac259aaa926cc13a71ec067a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
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;
}