Merge branch 'master' of https://git.tagachop.fr/epicsparrow/PixelWars
Conflicts: orange.c
This commit is contained in:
commit
dd480fe352
4
main.c
4
main.c
@ -93,6 +93,10 @@ int getNear(int dir){
|
|||||||
return map[coord.x][coord.y].type;
|
return map[coord.x][coord.y].type;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int getInventory(){
|
||||||
|
return current_dude->inventory;
|
||||||
|
}
|
||||||
|
|
||||||
void spawnDudes(){
|
void spawnDudes(){
|
||||||
int i;
|
int i;
|
||||||
t_dude new_dude;
|
t_dude new_dude;
|
||||||
|
3
orange.c
3
orange.c
@ -44,8 +44,9 @@ void check_action_success(t_info_data*, int);
|
|||||||
void search_job(t_action*, t_info_data*, int);
|
void search_job(t_action*, t_info_data*, int);
|
||||||
void gather_res(t_action*, t_info_data*, int);
|
void gather_res(t_action*, t_info_data*, int);
|
||||||
|
|
||||||
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_info_data* data = (t_info_data*)my_info;
|
t_info_data* data = (t_info_data*)my_info;
|
||||||
|
//t_data* data = (t_data*)my_info;
|
||||||
t_action action;
|
t_action action;
|
||||||
|
|
||||||
check_action_success(data,success);
|
check_action_success(data,success);
|
||||||
|
2
purple.c
2
purple.c
@ -40,7 +40,7 @@ int dist(t_coord coord, int x, int y){
|
|||||||
return abs(coord.x-x) + abs(coord.y-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_data* data = (t_data*)my_info;
|
||||||
t_action action;
|
t_action action;
|
||||||
int i, type;
|
int i, type;
|
||||||
|
43
team.h
43
team.h
@ -1,14 +1,35 @@
|
|||||||
#ifndef TEAM_H
|
#ifndef TEAM_H
|
||||||
#define TEAM_H
|
#define TEAM_H
|
||||||
|
|
||||||
#define LIBRARY_SIZE 128
|
#define WRITE 0
|
||||||
#define DUDE_MEMORY 128
|
#define READ 4
|
||||||
|
|
||||||
|
// coordinates structure
|
||||||
|
typedef struct{
|
||||||
|
int x;
|
||||||
|
int y;
|
||||||
|
} t_coord;
|
||||||
|
|
||||||
// Directions
|
// Directions
|
||||||
enum{
|
enum{
|
||||||
NORTH, SOUTH, EAST, WEST
|
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
|
// Tile types
|
||||||
enum{
|
enum{
|
||||||
BEDROCK, GRASS, TREE, BERRIES, ROCK, IRON_ORE, // nature
|
BEDROCK, GRASS, TREE, BERRIES, ROCK, IRON_ORE, // nature
|
||||||
@ -19,25 +40,21 @@ enum{
|
|||||||
|
|
||||||
// Action types
|
// Action types
|
||||||
enum{
|
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{
|
typedef struct{
|
||||||
int type;
|
int type;
|
||||||
int dir;
|
int dir;
|
||||||
void* data;
|
void* data;
|
||||||
} t_action;
|
} t_action;
|
||||||
|
|
||||||
typedef struct{
|
|
||||||
int dest;
|
|
||||||
void* message;
|
|
||||||
} t_communication;
|
|
||||||
|
|
||||||
int getInventory();
|
int getInventory();
|
||||||
|
|
||||||
int getNear(int dir);
|
int getNear(int dir);
|
||||||
|
4
tools.c
4
tools.c
@ -6,6 +6,10 @@ typedef struct{
|
|||||||
int ok;
|
int ok;
|
||||||
} t_move;
|
} t_move;
|
||||||
|
|
||||||
|
typedef struct{
|
||||||
|
int dmg;
|
||||||
|
} t_attack;
|
||||||
|
|
||||||
t_move* clearMoves[MAX_DUDES*NB_TEAMS];
|
t_move* clearMoves[MAX_DUDES*NB_TEAMS];
|
||||||
int nb_clear = 0;
|
int nb_clear = 0;
|
||||||
t_move* occupiedMoves[MAX_DUDES*NB_TEAMS];
|
t_move* occupiedMoves[MAX_DUDES*NB_TEAMS];
|
||||||
|
Loading…
x
Reference in New Issue
Block a user