Ejemplo n.º 1
0
void tod_manager::set_turn(const int num, const bool increase_limit_if_needed)
{
	const int new_turn = std::max<int>(num, 1);
	LOG_NG << "changing current turn number from " << turn_ << " to " << new_turn << '\n';
	// Correct ToD
	set_new_current_times(new_turn);

	if(increase_limit_if_needed && (new_turn > num_turns_) && num_turns_ != -1) {
		set_number_of_turns(new_turn);
	}
	turn_ = new_turn;
	resources::gamedata->get_variable("turn_number") = new_turn;
}
Ejemplo n.º 2
0
void tod_manager::set_turn(const int num, game_data* vars, const bool increase_limit_if_needed)
{
	has_tod_bonus_changed_ = false;
	const int new_turn = std::max<int>(num, 1);
	LOG_NG << "changing current turn number from " << turn_ << " to " << new_turn << '\n';
	// Correct ToD
	set_new_current_times(new_turn);

	if(increase_limit_if_needed && (new_turn > num_turns_) && num_turns_ != -1) {
		set_number_of_turns(new_turn);
	}
	turn_ = new_turn;
	if (vars)
		vars->get_variable("turn_number") = new_turn;
}
Ejemplo n.º 3
0
void tod_manager::set_turn(unsigned int num)
{
	const unsigned int old_num = turn_;
	// Correct ToD
	int current_time = (currentTime_ + num - old_num) % times_.size();
	if (current_time < 0) {
		current_time += times_.size();
	}
	set_time_of_day(current_time);

	if(static_cast<int>(num) > num_turns_ && num_turns_ != -1) {
		set_number_of_turns(num);
	}
	turn_ = num;

	LOG_NG << "changed current turn number from " << old_num << " to " << num << '\n';
}
Ejemplo n.º 4
0
void tod_manager::set_number_of_turns_by_wml(int num)
{
	set_number_of_turns(num);
	update_server_information();
}