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 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51
| // Definition structure.
typedef struct Point Point;
typedef struct Mouv Mouv;
typedef struct Unit Unit;
// Strucutre
struct Point
{
short int unsigned x;
short int unsigned y;
};
struct Mouv
{
char vue;// Orientation
Point deb;// Depart
Point go;// Destination
char pas;// Etape du mouvement accomplit
};
struct Unit
{
short int unsigned user_id;
short int unsigned type;
Mouv mouv;
short int unsigned vie_act;
char action;
};
// Initialisation :
void init_unit(short int unsigned user_id, short int unsigned type,
short int unsigned posi_x, short int unsigned posi_y,
Unit* unit_return){
unit_return =malloc( sizeof(short int unsigned)*3
+sizeof(char)*3
+sizeof(short int unsigned)*4
);
*unit_return.user_id =user_id;// ERR Ici
/*
unit_return->type =type;
unit_return->vue =VUE_NULL;
unit_return->deb.x =posi_x;
unit_return->deb.y =posi_y;
unit_return->go.x =posi_x;
unit_return->go.y =posi_y;
unit_return->pas =0;
unit_return->vie_act =1;// Vie Max a faire
unit_return->action =ACT_WAIT;
*/
printf("%p --> %s\n",unit_return,unit_return);
return;
} |
Partager