Skip to content

Commit

Permalink
Merge
Browse files Browse the repository at this point in the history
  • Loading branch information
restylianos committed Jun 14, 2020
1 parent a386d5e commit 78c7714
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 7 deletions.
Binary file removed game.bin
Binary file not shown.
Binary file removed server.bin
Binary file not shown.
5 changes: 4 additions & 1 deletion server/srv_interact.c
Original file line number Diff line number Diff line change
Expand Up @@ -225,8 +225,10 @@ char *on_load_map(int level)
return buffer;
}


char *servside_constr_save_filename(int name_array[3])
{
/*
char *buffer = (char *)calloc(sizeof(char), SOCK_BUFF_SZ);
const char base[] = "./saves/multi/";
const char file_extension[] = ".rpg\0";
Expand All @@ -253,4 +255,5 @@ char *servside_constr_save_filename(int name_array[3])
strcat(buffer)
return buffer;
}
*/
}
8 changes: 7 additions & 1 deletion src/events_handler.c
Original file line number Diff line number Diff line change
Expand Up @@ -373,8 +373,13 @@ int decode_on_player_update_stats(player_t players_arr[], char *buffer_to_decode
for (int i = 0; i < 3; i++)
{
if(players_arr[i].isDead != TRUE) map_set(map, PSYMBOL, players_arr[i].y, players_arr[i].x);

if(players_arr[i].prev_x != players_arr[i].x || players_arr[i].prev_y != players_arr[i].y){
map_set(map, MAP_P_SYMBOL,players_arr[i].prev_y, players_arr[i].prev_x);
if(players_arr[i].isDead==1){
map_set(map, MAP_P_SYMBOL,players_arr[i].y, players_arr[i].x);
break;
}
}
players_arr[i].prev_x = players_arr[i].x;
players_arr[i].prev_y = players_arr[i].y;
Expand All @@ -396,8 +401,9 @@ int decode_on_player_death(map_t *map,player_t players_arr[], char *buffer_to_de
{
token = strtok(NULL, NET_DELIM);
//get the second number which is 1 -> force player to die
players_arr[i].isDead = atoi(token); //kill player
players_arr[i].isDead = 1; //kill player
map_set(map,MAP_P_SYMBOL,players_arr[i].y, players_arr[i].x);
map_set(map, MAP_P_SYMBOL,players_arr[i].prev_y, players_arr[i].prev_x);
break;
}
}
Expand Down
8 changes: 5 additions & 3 deletions src/mode_handle.c
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,7 @@ void *multi_game_handler(void *args)
update_objects(&game->map, game->mons_arr, game->chest_arr);
to_print_multi(&game->map, game->players, game->mons_arr, game->chest_arr, game->client->uid);

usleep(700000);
usleep(500000);
fflush(stderr);
fflush(stdin);
fflush(stdout);
Expand All @@ -411,8 +411,10 @@ void *multi_game_handler(void *args)
game->chest_arr = (chest_t *)calloc(sizeof(chest_t), game->map.level);
load_map(&game->map, game->mons_arr, game->chest_arr, game->boss_arr);
update_objects(&game->map, game->mons_arr, game->chest_arr);
game->players[game->client->uid].x = 18 + (game->client->uid);
game->players[game->client->uid].y = 48;
for(i=0;i<3;i++){
game->players[i].x = 18 + i;
game->players[i].y = 48;
}
}

return NULL;
Expand Down
4 changes: 2 additions & 2 deletions src/monster.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
void init_monster(monster_t *monster, int id, int x1, int y1)
{
monster->is_boss = 0;
monster->attack = 100;
monster->health = 20;
monster->attack = 10;
monster->health = 30;
monster->armor = 10;
monster->accuracy = 40;
monster->x = x1;
Expand Down

0 comments on commit 78c7714

Please sign in to comment.