removed most references of gamestatus::turn()...

...in play_controller and subclasses
This commit is contained in:
Eugen Jiresch 2009-06-10 09:32:58 +00:00
parent 96bae44ec1
commit 0bb8487da3
4 changed files with 23 additions and 23 deletions

View file

@ -391,7 +391,7 @@ void play_controller::fire_prestart(bool execute){
update_locker lock_display(gui_->video());
game_events::fire("prestart");
// prestart event may modify start turn with WML, reflect any changes.
start_turn_ = status_.turn();
start_turn_ = turn_;
}
}
@ -399,10 +399,10 @@ void play_controller::fire_start(bool execute){
if(execute) {
game_events::fire("start");
// start event may modify start turn with WML, reflect any changes.
start_turn_ = status_.turn();
start_turn_ = turn_;
gamestate_.set_variable("turn_number", str_cast<size_t>(start_turn_));
} else {
previous_turn_ = status_.turn();
previous_turn_ = turn_;
}
}
@ -453,16 +453,16 @@ void play_controller::do_init_side(const unsigned int team_index){
team& current_team = teams_[team_index];
bool real_side_change = true;
if (!loading_game_ || int(team_index) + 1 != first_player_ || status_.turn() > start_turn_) {
if (status_.turn() != previous_turn_)
if (!loading_game_ || int(team_index) + 1 != first_player_ || turn_ > start_turn_) {
if (turn_ != previous_turn_)
{
std::stringstream event_stream;
event_stream << status_.turn();
event_stream << turn_;
const std::string turn_num = event_stream.str();
game_events::fire("turn " + turn_num);
game_events::fire("new turn");
previous_turn_ = status_.turn();
previous_turn_ = turn_;
}
// Fire side turn event only if real side change occurs,
// not counting changes from void to a side
@ -476,9 +476,9 @@ void play_controller::do_init_side(const unsigned int team_index){
// Healing/income happen if it's not the first turn of processing,
// or if we are loading a game, and this is not the player it started with.
bool turn_refresh =
(status_.turn() > start_turn_ ||
(turn_ > start_turn_ ||
(loading_game_ && int(team_index) + 1 != first_player_))
&& (status_.turn() > 1);
&& (turn_ > 1);
if(turn_refresh) {
@ -506,7 +506,7 @@ void play_controller::do_init_side(const unsigned int team_index){
}
const time_of_day &tod = status_.get_time_of_day();
current_team.set_time_of_day(int(status_.turn()), tod);
current_team.set_time_of_day(int(turn_), tod);
if (int(team_index) + 1 == first_player_)
sound::play_sound(tod.sounds, sound::SOUND_SOURCES);
@ -593,7 +593,7 @@ void play_controller::finish_side_turn(){
void play_controller::finish_turn(){
std::stringstream event_stream;
event_stream << status_.turn();
event_stream << turn_;
{
LOG_NG << "turn event..." << (recorder.is_skipping() ? "skipping" : "no skip") << "\n";
@ -901,7 +901,7 @@ void play_controller::expand_autosaves(std::vector<std::string>& items)
items.erase(items.begin() + i);
std::vector<std::string> newitems;
std::vector<std::string> newsaves;
for (unsigned int turn = status_.turn(); turn != 0; turn--) {
for (unsigned int turn = turn_; turn != 0; turn--) {
std::string name = gamestate_.classification().label + "-" + _("Auto-Save") + lexical_cast<std::string>(turn);
if (savegame_manager::save_game_exists(name, preferences::compress_saves())) {
if(preferences::compress_saves()) {

View file

@ -355,7 +355,7 @@ void playmp_controller::linger(upload_log& log)
} catch (game::load_game_exception&) {
LOG_NG << "caught load-game-exception" << std::endl;
// this should not happen, the option to load a game is disabled
log.quit(status_.turn());
log.quit(turn_);
throw;
} catch (end_level_exception&) {
// thrown if the host ends the scenario and let us advance
@ -490,7 +490,7 @@ void playmp_controller::play_network_turn(){
}
if(have_data) {
if (skip_replay_ && replay_last_turn_ <= status_.turn()){
if (skip_replay_ && replay_last_turn_ <= turn_){
skip_replay_ = false;
}
try{

View file

@ -332,7 +332,7 @@ LEVEL_RESULT playsingle_controller::play_scenario(
} catch(game::load_game_exception&) {
// Loading a new game is effectively a quit.
log.quit(status_.turn());
log.quit(turn_);
throw;
} catch(end_level_exception& end_level) {
ai_testing::log_game_end();
@ -374,11 +374,11 @@ LEVEL_RESULT playsingle_controller::play_scenario(
}
if(end_level.result == QUIT) {
log.quit(status_.turn());
log.quit(turn_);
return end_level.result;
} else if(end_level.result == DEFEAT) {
gamestate_.classification().completion = "defeat";
log.defeat(status_.turn());
log.defeat(turn_);
try {
game_events::fire("defeat");
} catch(end_level_exception&) {
@ -418,7 +418,7 @@ LEVEL_RESULT playsingle_controller::play_scenario(
sound::play_music_once(victory_music);
}
if (first_human_team_ != -1)
log.victory(status_.turn(), teams_[first_human_team_].gold());
log.victory(turn_, teams_[first_human_team_].gold());
const bool has_next_scenario = !gamestate_.classification().next_scenario.empty() &&
gamestate_.classification().next_scenario != "null";
@ -459,7 +459,7 @@ LEVEL_RESULT playsingle_controller::play_scenario(
const int finishing_bonus_per_turn =
map_.villages().size() * game_config::village_income +
game_config::base_income;
const int turns_left = std::max<int>(0,status_.number_of_turns() - status_.turn());
const int turns_left = std::max<int>(0,status_.number_of_turns() - turn_);
const int finishing_bonus = (end_level.gold_bonus && (turns_left > -1)) ?
(finishing_bonus_per_turn * turns_left) : 0;
@ -531,10 +531,10 @@ void playsingle_controller::play_turn(bool save)
gui_->invalidate_game_status();
events::raise_draw_event();
LOG_NG << "turn: " << status_.turn() << "\n";
LOG_NG << "turn: " << turn_ << "\n";
if(non_interactive())
std::cout << "Turn " << status_.turn() << ":" << std::endl;
std::cout << "Turn " << turn_ << ":" << std::endl;
for (player_number_ = first_player_; player_number_ <= int(teams_.size()); ++player_number_)
@ -783,7 +783,7 @@ void playsingle_controller::linger(upload_log& log)
}
} catch(game::load_game_exception&) {
// Loading a new game is effectively a quit.
log.quit(status_.turn());
log.quit(turn_);
throw;
}

View file

@ -320,7 +320,7 @@ void replay_controller::play_side(const unsigned int /*team_index*/, bool){
return;
}
DBG_REPLAY << "Status turn number: " << status_.turn() << "\n";
DBG_REPLAY << "Status turn number: " << turn_ << "\n";
DBG_REPLAY << "Replay_Controller turn number: " << current_turn_ << "\n";
DBG_REPLAY << "Player number: " << player_number_ << "\n";