static void quit () { player_destroy (); notifier_destroy (); hotkeys_destroy (); gtk_main_quit (); }
static void ai_agent_destroy(agent_t * self) { ai_agent_t * ai_self = (ai_agent_t*) self; if (ai_self->player) player_destroy(ai_self->player); ai_self->evaluator->destroy(ai_self->evaluator); free(self); }
void kick_latecomers(int nb_player, struct Player P[], int latecomers[]) { for (int i = 0; i < nb_player; i++) { if (latecomers[i]) { player_destroy(&P[i]); fprintf(stderr, "Player %u timed out", P[i].id); } } }
static void update_player(t_player *player, double *tdt) { fds c; double dt; (void)tdt; if (!player) return ; c = player->client; dt = time_d(player->foodlt); player->foodlt = time_(); player->foodt -= (dt / (((double)delay_life / get_delay()) * get_time())); player->food = (uint)abs(player->foodt); if (player->foodt <= 0) c ? (void)net_close_msg(c, "mort") : (void)player_destroy(player); else if (player->foodt > 0) timer_helper(((player->foodt * delay_life) * (get_time() / get_delay()))); }
void play(void) { Player *player = NULL; StarSystem *sys = NULL; set_seed(); putchar('\n'); player = player_create(); sys = starsys_create(); LINE(80, '-'); player_move_toSystem(player, sys); while (!player->wantToExit) { cmd_get(player); } player_destroy(player); }
/** * Frees all memory used by a player object. */ void player_free(struct player *p) { player_destroy(p); free(p); }
static void ai_agent_win(agent_t * self, int score, int distance) { ai_agent_t * ai_self = (ai_agent_t*) self; ai_self->action = ACTION_RESTART; player_destroy(ai_self->player); ai_self->player = NULL; }