made some changes

This commit is contained in:
Anselme 2015-01-17 01:14:56 +01:00
parent 695f9e79a0
commit 7d4ff9021e
5 changed files with 40 additions and 15 deletions

4
main.c
View File

@ -93,6 +93,10 @@ int getNear(int dir){
return map[coord.x][coord.y].type;
}
int getInventory(){
return current_dude->inventory;
}
void spawnDudes(){
int i;
t_dude new_dude;

View File

@ -7,7 +7,7 @@ typedef struct{
int plop; // custom info
} t_data;
t_action orange_update(void* my_info, void* com_data, int success){
t_action orange_update(void* my_info, t_com* communication_data, int success){
t_data* data = (t_data*)my_info;
t_action action;

View File

@ -40,7 +40,7 @@ int dist(t_coord coord, int x, int y){
return abs(coord.x-x) + abs(coord.y-y);
}
t_action purple_update(void* my_info, void* com_data, int success){
t_action purple_update(void* my_info, t_com* com_data, int success){
t_data* data = (t_data*)my_info;
t_action action;
int i, type;

43
team.h
View File

@ -1,14 +1,35 @@
#ifndef TEAM_H
#define TEAM_H
#define LIBRARY_SIZE 128
#define DUDE_MEMORY 128
#define WRITE 0
#define READ 4
// coordinates structure
typedef struct{
int x;
int y;
} t_coord;
// Directions
enum{
NORTH, SOUTH, EAST, WEST
};
// communication
#define LIBRARY_SIZE 128
#define DUDE_MEMORY 128
enum{
BOOK_1,
BOOK_2,
BOOK_3,
BOOK_4
};
typedef struct{
int flag;
char data[32];
} t_com;
// Tile types
enum{
BEDROCK, GRASS, TREE, BERRIES, ROCK, IRON_ORE, // nature
@ -19,25 +40,21 @@ enum{
// Action types
enum{
MOVE, ATTACK, PICK, PUT, WORK, WAIT, COMMUNICATE
MOVE,
ATTACK,
PICK,
PUT,
WORK,
WAIT,
COMMUNICATE
};
typedef struct{
int x;
int y;
} t_coord;
typedef struct{
int type;
int dir;
void* data;
} t_action;
typedef struct{
int dest;
void* message;
} t_communication;
int getInventory();
int getNear(int dir);

View File

@ -6,6 +6,10 @@ typedef struct{
int ok;
} t_move;
typedef struct{
int dmg;
} t_attack;
t_move* clearMoves[MAX_DUDES*NB_TEAMS];
int nb_clear = 0;
t_move* occupiedMoves[MAX_DUDES*NB_TEAMS];