give do_replays return a better name

I forgot what my real intention with this change was, but i still think this is a good change, becasue now people don't have to look up the comments to see what do_replay returns.
So i committed it.
This commit is contained in:
gfgtdf 2014-04-08 00:33:31 +02:00
parent 22d17ba4dd
commit d1cd2e0b17
6 changed files with 17 additions and 11 deletions

View file

@ -512,7 +512,7 @@ void playmp_controller::play_network_turn(){
{
bool was_skipping = recorder.is_skipping();
recorder.set_skip(skip_replay_);
if(do_replay(current_side()))
if(do_replay(current_side()) == REPLAY_FOUND_END_TURN)
{
break;
}

View file

@ -618,7 +618,7 @@ void playsingle_controller::play_turn(bool save)
if (replaying_) {
LOG_NG << "doing replay " << player_number_ << "\n";
replaying_ = ::do_replay(player_number_);
replaying_ = ::do_replay(player_number_) == REPLAY_FOUND_END_TURN;
LOG_NG << "result of replay: " << (replaying_?"true":"false") << "\n";
} else {
// If a side is dead end the turn, but play at least side=1's

View file

@ -101,7 +101,7 @@ void turn_info::handle_turn(
//turn_end = do_replay(team_num_, &replay_);
//note, that this cunfion might call itself recursively: do_replay -> ... -> persist_var -> ... -> handle_generic_event -> sync_network -> handle_turn
recorder.add_config(t, replay::MARK_AS_SENT);
turn_end = do_replay(team_num_);
turn_end = do_replay(team_num_) == REPLAY_FOUND_END_TURN;
recorder.set_skip(was_skipping);
} else {

View file

@ -692,7 +692,7 @@ static void show_oos_error_error_function(const std::string& message, bool /*hea
replay::process_error(message);
}
bool do_replay(int side_num)
REPLAY_RETURN do_replay(int side_num)
{
log_scope("do replay");
@ -704,7 +704,7 @@ bool do_replay(int side_num)
return do_replay_handle(side_num);
}
bool do_replay_handle(int side_num)
REPLAY_RETURN do_replay_handle(int side_num)
{
//team &current_team = (*resources::teams)[side_num - 1];
@ -728,7 +728,7 @@ bool do_replay_handle(int side_num)
//if there is nothing more in the records
if(cfg == NULL) {
//replayer.set_skip(false);
return false;
return REPLAY_RETURN_AT_END;
}
config::all_children_itors ch_itors = cfg->all_children_range();
@ -815,7 +815,7 @@ bool do_replay_handle(int side_num)
verify(*resources::units, child);
}
return true;
return REPLAY_FOUND_END_TURN;
}
else if (const config &change = cfg->child("record_change_controller"))
{
@ -881,7 +881,7 @@ bool do_replay_handle(int side_num)
std::string child_name = cfg->all_children_range().first->key;
DBG_REPLAY << "got an dependent action name = " << child_name <<"\n";
get_replay_source().revert_action();
return false;
return REPLAY_FOUND_DEPENDENT;
}
else
{

View file

@ -154,11 +154,17 @@ replay& get_replay_source();
extern replay recorder;
enum REPLAY_RETURN
{
REPLAY_RETURN_AT_END,
REPLAY_FOUND_DEPENDENT,
REPLAY_FOUND_END_TURN
};
//replays up to one turn from the recorder object
//returns true if it got to the end of the turn without data running out
bool do_replay(int side_num);
REPLAY_RETURN do_replay(int side_num);
bool do_replay_handle(int side_num);
REPLAY_RETURN do_replay_handle(int side_num);
class replay_network_sender
{

View file

@ -444,7 +444,7 @@ void replay_controller::play_side(const unsigned int /*team_index*/, bool){
// if have reached the end we don't want to execute finish_side_turn and finish_turn
// becasue we might not have enough data to execute them (like advancements during turn_end for example)
// !has_end_turn == we reached the end of teh replay without finding and end turn tag.
has_end_turn = do_replay(player_number_);
has_end_turn = do_replay(player_number_) == REPLAY_FOUND_END_TURN;
if(!has_end_turn)
{
return;