removed gamestatus.number_of_turns()...
...references from game_events.cpp and play_controller classes
This commit is contained in:
parent
2b64624a21
commit
063df523d5
4 changed files with 6 additions and 4 deletions
|
@ -1024,7 +1024,7 @@ WML_HANDLER_FUNCTION(modify_turns, /*event_info*/, cfg)
|
|||
const unsigned int current_turn_number = rsrc.controller->turn();
|
||||
const int new_turn_number = lexical_cast_default<int>(current, current_turn_number);
|
||||
const unsigned int new_turn_number_u = static_cast<unsigned int>(new_turn_number);
|
||||
if(new_turn_number_u < current_turn_number || (new_turn_number > rsrc.status_ptr->number_of_turns() && rsrc.status_ptr->number_of_turns() != -1)) {
|
||||
if(new_turn_number_u < current_turn_number || (new_turn_number > rsrc.controller->number_of_turns() && rsrc.controller->number_of_turns() != -1)) {
|
||||
ERR_NG << "attempted to change current turn number to one out of range (" << new_turn_number << ") or less than current turn\n";
|
||||
} else if(new_turn_number_u != current_turn_number) {
|
||||
rsrc.status_ptr->set_turn(new_turn_number_u);
|
||||
|
|
|
@ -293,7 +293,7 @@ LEVEL_RESULT playsingle_controller::play_scenario(
|
|||
// Log before prestart events: they do weird things.
|
||||
if (first_human_team_ != -1) {
|
||||
log.start(gamestate_, teams_[first_human_team_], first_human_team_ + 1, units_,
|
||||
loading_game_ ? gamestate_.get_variable("turn_number") : "", status_.number_of_turns());
|
||||
loading_game_ ? gamestate_.get_variable("turn_number") : "", number_of_turns());
|
||||
}
|
||||
|
||||
fire_prestart(!loading_game_);
|
||||
|
@ -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() - turn_);
|
||||
const int turns_left = std::max<int>(0, number_of_turns() - turn_);
|
||||
const int finishing_bonus = (end_level.gold_bonus && (turns_left > -1)) ?
|
||||
(finishing_bonus_per_turn * turns_left) : 0;
|
||||
|
||||
|
|
|
@ -59,6 +59,7 @@ replay_controller::replay_controller(const config& level,
|
|||
gamestate_start_(state_of_game),
|
||||
status_start_(level, num_turns, &state_of_game),
|
||||
units_start_(),
|
||||
numTurns_start_(numTurns_),
|
||||
current_turn_(1),
|
||||
delay_(0),
|
||||
is_playing_(false),
|
||||
|
@ -164,7 +165,7 @@ void replay_controller::reset_replay(){
|
|||
player_number_ = 1;
|
||||
current_turn_ = 1;
|
||||
turn_ = start_turn_;
|
||||
numTurns_ = status_start_.number_of_turns();
|
||||
numTurns_ = numTurns_start_;
|
||||
recorder.start_replay();
|
||||
units_ = units_start_;
|
||||
status_ = status_start_;
|
||||
|
|
|
@ -64,6 +64,7 @@ private:
|
|||
game_state gamestate_start_;
|
||||
gamestatus status_start_;
|
||||
unit_map units_start_;
|
||||
int numTurns_start_;
|
||||
|
||||
unsigned int current_turn_;
|
||||
int delay_;
|
||||
|
|
Loading…
Add table
Reference in a new issue