Restore --max-fps
@gfgtdf explained in IRC that it's often used to slow Wesnoth down (instead of speeding it up, as I had assumed). This should also allow unit tests to compile again.
This commit is contained in:
parent
4e4d7b5277
commit
dc5e8b36ea
7 changed files with 35 additions and 3 deletions
|
@ -55,8 +55,6 @@ Version 1.13.8+dev:
|
|||
* Miscellaneous and Bug Fixes:
|
||||
* Add --report/-R command line switch for printing the same report from the
|
||||
Game Version dialog's clipboard function to stdout.
|
||||
* Removed the --max-fps command line switch. The new FPS cap implementation
|
||||
queries the screen refresh rate instead.
|
||||
* WFL Engine
|
||||
* Add owner key to terrain space callable, for villages
|
||||
* Location formulas in [tunnel] now have a teleport_unit variable
|
||||
|
|
|
@ -97,6 +97,7 @@ commandline_options::commandline_options (const std::vector<std::string>& args)
|
|||
multiplayer_scenario(),
|
||||
multiplayer_side(),
|
||||
multiplayer_turns(),
|
||||
max_fps(),
|
||||
noaddons(false),
|
||||
nocache(false),
|
||||
nodelay(false),
|
||||
|
@ -213,6 +214,7 @@ commandline_options::commandline_options (const std::vector<std::string>& args)
|
|||
display_opts.add_options()
|
||||
("fps", "displays the number of frames per second the game is currently running at, in a corner of the screen.")
|
||||
("fullscreen,f", "runs the game in full screen mode.")
|
||||
("max-fps", po::value<int>(), "the maximum fps the game tries to run at. Values should be between 1 and 1000, the default is 50.")
|
||||
("new-widgets", "there is a new WIP widget toolkit this switch enables the new toolkit (VERY EXPERIMENTAL don't file bug reports since most are known). Parts of the library are deemed stable and will work without this switch.")
|
||||
("resolution,r", po::value<std::string>(), "sets the screen resolution. <arg> should have format XxY. Example: --resolution 800x600")
|
||||
("windowed,w", "runs the game in windowed mode.")
|
||||
|
@ -366,6 +368,8 @@ commandline_options::commandline_options (const std::vector<std::string>& args)
|
|||
log_precise_timestamps = true;
|
||||
if (vm.count("log-strict"))
|
||||
parse_log_strictness(vm["log-strict"].as<std::string>());
|
||||
if (vm.count("max-fps"))
|
||||
max_fps = vm["max-fps"].as<int>();
|
||||
if (vm.count("mp-test"))
|
||||
mptest = true;
|
||||
if (vm.count("multiplayer"))
|
||||
|
|
|
@ -125,6 +125,8 @@ public:
|
|||
boost::optional<std::vector<std::pair<unsigned int, std::string> > > multiplayer_side;
|
||||
/// Non-empty if --turns was given on the command line. Dependent on --multiplayer.
|
||||
boost::optional<std::string> multiplayer_turns;
|
||||
/// Max FPS specified by --max-fps option.
|
||||
boost::optional<int> max_fps;
|
||||
/// True if --noaddons was given on the command line. Disables the loading of all add-ons.
|
||||
bool noaddons;
|
||||
/// True if --nocache was given on the command line. Disables cache usage.
|
||||
|
|
|
@ -1673,7 +1673,10 @@ void display::draw_init()
|
|||
|
||||
void display::draw_wrap(bool update, bool force)
|
||||
{
|
||||
static const int time_between_draws = 1000 / screen_.current_refresh_rate();
|
||||
static int time_between_draws = preferences::draw_delay();
|
||||
if(time_between_draws == 0) {
|
||||
time_between_draws = 1000 / screen_.current_refresh_rate();
|
||||
}
|
||||
|
||||
if(redrawMinimap_) {
|
||||
redrawMinimap_ = false;
|
||||
|
|
|
@ -55,6 +55,7 @@
|
|||
#include "game_initialization/singleplayer.hpp" // for sp_create_mode
|
||||
#include "statistics.hpp"
|
||||
#include "tstring.hpp" // for operator==, operator!=
|
||||
#include "utils/general.hpp" // for clamp
|
||||
#include "video.hpp" // for CVideo
|
||||
#include "wesnothd_connection_error.hpp"
|
||||
#include "wml_exception.hpp" // for wml_exception
|
||||
|
@ -186,6 +187,15 @@ game_launcher::game_launcher(const commandline_options& cmdline_opts, const char
|
|||
video().set_fullscreen(true);
|
||||
if (cmdline_opts_.load)
|
||||
load_data_.reset(new savegame::load_game_metadata{ *cmdline_opts_.load });
|
||||
if (cmdline_opts_.max_fps) {
|
||||
int fps = utils::clamp(*cmdline_opts_.max_fps, 1, 1000);
|
||||
fps = 1000 / fps;
|
||||
// increase the delay to avoid going above the maximum
|
||||
if(1000 % fps != 0) {
|
||||
++fps;
|
||||
}
|
||||
preferences::set_draw_delay(fps);
|
||||
}
|
||||
if (cmdline_opts_.nogui || cmdline_opts_.headless_unit_test) {
|
||||
no_sound = true;
|
||||
preferences::disable_preferences_save();
|
||||
|
|
|
@ -49,6 +49,8 @@ bool no_preferences_save = false;
|
|||
|
||||
bool fps = false;
|
||||
|
||||
int draw_delay_ = 0;
|
||||
|
||||
config prefs;
|
||||
}
|
||||
|
||||
|
@ -977,6 +979,16 @@ void set_show_fps(bool value)
|
|||
fps = value;
|
||||
}
|
||||
|
||||
int draw_delay()
|
||||
{
|
||||
return draw_delay_;
|
||||
}
|
||||
|
||||
void set_draw_delay(int value)
|
||||
{
|
||||
draw_delay_ = value;
|
||||
}
|
||||
|
||||
bool use_color_cursors()
|
||||
{
|
||||
return get("color_cursors", true);
|
||||
|
|
|
@ -236,6 +236,9 @@ namespace preferences {
|
|||
*/
|
||||
int mouse_scroll_threshold();
|
||||
|
||||
int draw_delay();
|
||||
void set_draw_delay(int value);
|
||||
|
||||
bool animate_map();
|
||||
void set_animate_map(bool value);
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue