/** * \brief Create the level. */ void rp::level_generator::create_level() { bear::universe::position_type pos(get_top_left()); bool previous_is_slope(false); unsigned int last_paint = 0; for(unsigned int i = 0; i != 100; i++ ) { const double selector = (double)rand() / RAND_MAX; if ( ( ( selector < 0.9 ) && previous_is_slope ) || ( ( selector < 0.5 ) && ! previous_is_slope ) ) { previous_is_slope = true; add_slope(pos); } else { previous_is_slope = false; add_ground(pos); } create_target(pos); if ( ( ((double)rand() / RAND_MAX) < 0.1 ) && ( i - last_paint > 50 ) ) { last_paint = i; create_bonus(pos); } } } // rp::level_generator::create_level()
void add_new_bonus(const char* text, int value) { player_data_t *plyr = get_player_data( local_player() ); if(!bonus_list) { bonus_list = create_bonus(text,value); plyr->bonus_tricks+=value; return; } plyr->bonus_tricks+=value; bonus_data_t * bonus = bonus_list; bonus_list = create_bonus(text, value); bonus_list->next = bonus; bonus->previous = bonus_list; }