Infrastructure for simple Wesnoth benchmarking
This commit is contained in:
parent
080ae41464
commit
3b8eea5136
5 changed files with 15 additions and 3 deletions
|
@ -2186,7 +2186,7 @@ void display::non_turbo_delay() const
|
|||
|
||||
void display::delay(unsigned int milliseconds) const
|
||||
{
|
||||
if (!screen_.faked())
|
||||
if (!game_config::no_delay)
|
||||
SDL_Delay(milliseconds);
|
||||
}
|
||||
|
||||
|
|
|
@ -204,6 +204,8 @@ game_controller::game_controller(int argc, char** argv)
|
|||
} else if(val == "--debug" || val == "-d") {
|
||||
game_config::debug = true;
|
||||
game_config::mp_debug = true;
|
||||
} else if(val == "--no-delay") {
|
||||
game_config::no_delay = true;
|
||||
} else if (val.substr(0, 6) == "--log-") {
|
||||
} else if(val == "--nosound") {
|
||||
preferences::set_sound(false);
|
||||
|
@ -264,6 +266,7 @@ bool game_controller::init_video()
|
|||
return false;
|
||||
}
|
||||
video_.make_fake();
|
||||
game_config::no_delay = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -492,6 +495,10 @@ bool game_controller::play_multiplayer_mode()
|
|||
std::cerr << "unrecognized option: '" << name << "'\n";
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
if (val == "--exit-at-end") {
|
||||
game_config::exit_at_end = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1573,6 +1580,7 @@ int play_game(int argc, char** argv)
|
|||
<< " -t, --test runs the game in a small test scenario.\n"
|
||||
<< " -v, --version prints the game's version number and exits.\n"
|
||||
<< " -w, --windowed runs the game in windowed mode.\n"
|
||||
<< " --no-delay run the game without any delays.\n"
|
||||
<< " --multiplayer runs a multiplayer game. There are additional\n"
|
||||
<< " options that can be used as explained below:\n"
|
||||
<< " --algorithm<number>=value selects a non-standard algorithm to be used by the\n"
|
||||
|
@ -1587,6 +1595,7 @@ int play_game(int argc, char** argv)
|
|||
<< " --side<number>=value selects a faction of the current era for this side\n"
|
||||
<< " by id.\n"
|
||||
<< " --turns=value sets the number of turns. The default is \"50\".\n"
|
||||
<< " --exit-at-end exit Wesnoth at end of scenario.\n"
|
||||
;
|
||||
return 0;
|
||||
} else if(val == "--version" || val == "-v") {
|
||||
|
|
|
@ -30,7 +30,7 @@ namespace game_config
|
|||
int kill_experience = 8;
|
||||
int leadership_bonus = 25;
|
||||
const std::string version = VERSION;
|
||||
bool debug = false, editor = false, ignore_replay_errors = false, mp_debug = false;
|
||||
bool debug = false, editor = false, ignore_replay_errors = false, mp_debug = false, exit_at_end = false, no_delay = false;
|
||||
|
||||
std::string game_icon = "wesnoth-icon.png", game_title, game_logo, title_music, anonymous_music,
|
||||
victory_music, defeat_music;
|
||||
|
|
|
@ -33,7 +33,7 @@ namespace game_config
|
|||
extern int leadership_bonus;
|
||||
extern const std::string version;
|
||||
|
||||
extern bool debug, editor, ignore_replay_errors, mp_debug;
|
||||
extern bool debug, editor, ignore_replay_errors, mp_debug, exit_at_end, no_delay;
|
||||
|
||||
extern std::string path;
|
||||
|
||||
|
|
|
@ -195,6 +195,9 @@ LEVEL_RESULT playsingle_controller::play_scenario(const std::vector<config*>& st
|
|||
throw;
|
||||
} catch(end_level_exception& end_level) {
|
||||
bool obs = team_manager_.is_observer();
|
||||
if (game_config::exit_at_end) {
|
||||
exit(0);
|
||||
}
|
||||
if (end_level.result == DEFEAT || end_level.result == VICTORY) {
|
||||
// if we're a player, and the result is victory/defeat, then send a message to notify
|
||||
// the server of the reason for the game ending
|
||||
|
|
Loading…
Add table
Reference in a new issue