#ifndef CELL_H
#define CELL_H

struct cell_link {
    struct cell *link;
    unsigned char tag;
};

struct cell {
    unsigned long no;
    unsigned long tag;
    unsigned char nb_links;
    struct cell_link *links;
    unsigned char nb_paths;
    struct cell_link *paths;
    unsigned char nb_walls;
    struct cell_link *walls;
};


struct cell_list {
    struct cell_list *prev;
    struct cell *curr;
    struct cell_list *next;
};

struct cell_option_force_link {
    unsigned long id_cell;
    unsigned long id_link;
    /* lien forcé à path = 0 ou wall = 1 : */
    unsigned char path_ou_wall;
};

typedef struct cell cell;
typedef struct cell_link cell_link;
typedef struct cell_list cell_list;
typedef struct cell_option_force_link cell_option_force_link;

extern void cell_print(cell * p);
extern void cell_deplacer_link_vers_paths(cell * p, int idx_link);
extern void cell_deplacer_link_vers_walls(cell * p, int idx_link);

/* Utilitaire : lorsqu'on veut que les liens de
   deux cellules qui sont reliées (c1 a un lien
   vers c2 *et* c2 a un lien vers c1)
   se transforment (en mur ou en chemin) : */
extern unsigned long cell_cell_deplacer_link_vers_walls(cell * c1,
                                                        cell * c2);
extern unsigned long cell_cell_deplacer_link_vers_paths(cell * c1,
                                                        cell * c2);

extern unsigned long cell_carre_deplacer_link_vers_paths(cell * c,
                                                         unsigned long
                                                         idx);
extern unsigned long cell_carre_deplacer_link_vers_walls(cell * c,
                                                         unsigned long
                                                         idx);
extern int cell_a_un_path_avec_no(struct cell *c, unsigned long no);

extern void print_laby(struct cell *tabcell, unsigned long total_cells,
                       unsigned long taille_x, unsigned long taille_y,
                       unsigned long taille_z);

#endif
/* CELL_H */
