bool game_launcher::goto_multiplayer() { if(jump_to_multiplayer_){ jump_to_multiplayer_ = false; if(play_multiplayer(MP_CONNECT)){ ; }else{ return false; } } return true; }
int main (int argc, char* argv[]) { if (argc > 1) args_handle (argc, argv); if(tron.user_name[0] == 0) { char *tmp = getlogin(); if(tmp == NULL) { ifitron_abort("No username provided and attempts to fetch it automatically, failed.\n"); } strcpy(tron.user_name, tmp); } if(get_server_mode() == 2) { while(TRUE) { int result = play_multiplayer(); if(result == -1) break; } engine_exit(); ifitron_exit(); } if(client_host_addr != NULL) { //Connect to the server int sd = connect_to_server(); if(sd == -1) { ifitron_abort("Couldn't connect to the server.\n"); }else{ set_client_socket_descriptor(sd); } } engine_init (); engine_show_main_menu (); ifitron_init (); while (TRUE) { if (tron.is_alive == FALSE) ifitron_game_over (); engine_get_game_input(); player_update(get_tron()); player_increase_size (get_tron(), 1); player_increase_score (get_tron(), game.level); if (tron.score % 50 == 0 && game.level < 9) game.level++; if (player_hit_self(get_tron()) == TRUE || player_hit_borders(get_tron()) == TRUE) tron.is_alive = FALSE; engine_show_screen (); } return 0; }