/*! Call when a race has just been won \author jfpatry \date Created: 2000-09-24 \date Modified: 2000-09-24 */ void update_for_won_race( void ) { race_data_t *race_data; check_assertion( g_game.practicing == False, "Tried to update for won race in practice mode" ); race_data = (race_data_t*)get_list_elem_data( cur_elem ); if ( last_completed_race == NULL || compare_race_positions( cup_data, last_completed_race, cur_elem ) > 0 ) { last_completed_race = cur_elem; if ( cur_elem == get_list_tail( race_list ) ) { cup_complete = True; if ( !set_last_completed_cup( plyr->name, g_game.current_event, g_game.difficulty, g_game.current_cup ) ) { print_warning( IMPORTANT_WARNING, "Couldn't save cup completion" ); } else { print_debug( DEBUG_GAME_LOGIC, "Cup %s completed", g_game.current_cup ); } } } }
/*! Returns true iff the current race is completed \author jfpatry \date Created: 2000-09-24 \date Modified: 2000-09-24 */ static bool_t is_current_race_completed( void ) { check_assertion( cur_elem != NULL, "current race is null" ); if ( last_completed_race == NULL ) { return False; } if ( compare_race_positions( cup_data, cur_elem, last_completed_race ) >= 0 ) { return True; } return False; }
/*! Returns true iff the current race is the first incomplete race \author jfpatry \date Created: 2000-09-24 \date Modified: 2000-09-24 */ static bool_t is_current_race_first_incomplete( void ) { check_assertion( cur_elem != NULL, "current race is null" ); if ( last_completed_race == NULL ) { if ( cur_elem == get_list_head( race_list ) ) { return True; } else { return False; } } if ( compare_race_positions( cup_data, last_completed_race, cur_elem ) == 1 ) { return True; } return False; }