Remove --no-delay option

This wasn't consistently honored and only affected unit animations.
This commit is contained in:
Charles Dang 2024-11-11 23:06:13 -05:00
parent 34c1c0f61c
commit c5cb0f104f
7 changed files with 7 additions and 27 deletions

View file

@ -105,7 +105,6 @@ commandline_options::commandline_options(const std::vector<std::string>& args)
, max_fps()
, noaddons(false)
, nocache(false)
, nodelay(false)
, nogui(false)
, nobanner(false)
, nomusic(false)
@ -192,7 +191,6 @@ commandline_options::commandline_options(const std::vector<std::string>& args)
("load,l", po::value<std::string>(), "loads the save <arg> from the standard save game directory. When launching the map editor via -e, the map <arg> is loaded, relative to the current directory. If it is a directory, the editor will start with a load map dialog opened there.")
("noaddons", "disables the loading of all add-ons.")
("nocache", "disables caching of game data.")
("nodelay", "runs the game without any delays.")
("nomusic", "runs the game without music.")
("nosound", "runs the game without sounds and music.")
("password", po::value<std::string>(), "uses <password> when connecting to a server, ignoring other preferences.")
@ -397,8 +395,6 @@ commandline_options::commandline_options(const std::vector<std::string>& args)
noaddons = true;
if(vm.count("nocache"))
nocache = true;
if(vm.count("nodelay"))
nodelay = true;
if(vm.count("nomusic"))
nomusic = true;
if(vm.count("noreplaycheck"))

View file

@ -142,8 +142,6 @@ public:
bool noaddons;
/** True if --nocache was given on the command line. Disables cache usage. */
bool nocache;
/** True if --nodelay was given on the command line. */
bool nodelay;
/** True if --nogui was given on the command line. Disables GUI. */
bool nogui;
/** True if --nobanner was given on the command line. Disables startup banner. */

View file

@ -88,7 +88,6 @@ bool
ignore_replay_errors = false,
mp_debug = false,
exit_at_end = false,
no_delay = false,
disable_autosave = false,
no_addons = false;

View file

@ -59,7 +59,7 @@ namespace game_config
extern const int gold_carryover_percentage;
extern bool debug_lua, strict_lua, editor, ignore_replay_errors, mp_debug,
exit_at_end, no_delay, disable_autosave, no_addons;
exit_at_end, disable_autosave, no_addons;
extern bool allow_insecure;

View file

@ -23,7 +23,7 @@
#include "exceptions.hpp" // for error
#include "filesystem.hpp" // for get_user_data_dir, etc
#include "game_classification.hpp" // for game_classification, etc
#include "game_config.hpp" // for path, no_delay, revision, etc
#include "game_config.hpp" // for path, revision, etc
#include "game_config_manager.hpp" // for game_config_manager
#include "game_initialization/multiplayer.hpp" // for start_client, etc
#include "game_initialization/playcampaign.hpp" // for play_game, etc
@ -168,8 +168,6 @@ game_launcher::game_launcher(const commandline_options& cmdline_opts)
}
if(cmdline_opts_.new_widgets)
gui2::new_widgets = true;
if(cmdline_opts_.nodelay)
game_config::no_delay = true;
if(cmdline_opts_.nomusic)
no_music = true;
if(cmdline_opts_.nosound)
@ -299,7 +297,6 @@ bool game_launcher::init_video()
// Other functions don't require a window at all.
video::init(video::fake::no_window);
}
game_config::no_delay = true;
return true;
}

View file

@ -58,7 +58,6 @@ BOOST_AUTO_TEST_CASE (test_empty_options)
BOOST_CHECK(!co.multiplayer_turns);
BOOST_CHECK(!co.max_fps);
BOOST_CHECK(!co.nocache);
BOOST_CHECK(!co.nodelay);
BOOST_CHECK(!co.nogui);
BOOST_CHECK(!co.nomusic);
BOOST_CHECK(!co.nosound);
@ -130,7 +129,6 @@ BOOST_AUTO_TEST_CASE (test_default_options)
BOOST_CHECK(!co.multiplayer_turns);
BOOST_CHECK(!co.max_fps);
BOOST_CHECK(!co.nocache);
BOOST_CHECK(!co.nodelay);
BOOST_CHECK(!co.nogui);
BOOST_CHECK(!co.nomusic);
BOOST_CHECK(!co.nosound);
@ -196,7 +194,6 @@ BOOST_AUTO_TEST_CASE (test_full_options)
"--multiplayer",
"--new-widgets",
"--nocache",
"--nodelay",
"--nomusic",
"--nosound",
"--nogui",
@ -279,7 +276,6 @@ BOOST_AUTO_TEST_CASE (test_full_options)
BOOST_CHECK(co.multiplayer_turns && *co.multiplayer_turns == "42");
BOOST_CHECK(co.max_fps && *co.max_fps == 100);
BOOST_CHECK(co.nocache);
BOOST_CHECK(co.nodelay);
BOOST_CHECK(co.nogui);
BOOST_CHECK(co.nomusic);
BOOST_CHECK(co.nosound);
@ -346,7 +342,6 @@ BOOST_AUTO_TEST_CASE (test_positional_options)
BOOST_CHECK(!co.multiplayer_turns);
BOOST_CHECK(!co.max_fps);
BOOST_CHECK(!co.nocache);
BOOST_CHECK(!co.nodelay);
BOOST_CHECK(!co.nogui);
BOOST_CHECK(!co.nomusic);
BOOST_CHECK(!co.nosound);

View file

@ -1420,18 +1420,15 @@ void unit_animator::wait_until(const std::chrono::milliseconds& animation_time)
auto end_tick = animated_units_[0].my_unit->anim_comp().get_animation()->time_to_tick(animation_time);
while(steady_clock::now() < end_tick - std::min(std::chrono::floor<std::chrono::milliseconds>(20ms / speed), 20ms)) {
if(!game_config::no_delay) {
auto rest = std::chrono::floor<std::chrono::milliseconds>((animation_time - get_animation_time()) * speed);
std::this_thread::sleep_for(std::clamp(rest, 0ms, 10ms));
}
auto rest = std::chrono::floor<std::chrono::milliseconds>((animation_time - get_animation_time()) * speed);
std::this_thread::sleep_for(std::clamp(rest, 0ms, 10ms));
resources::controller->play_slice();
end_tick = animated_units_[0].my_unit->anim_comp().get_animation()->time_to_tick(animation_time);
}
if(!game_config::no_delay) {
auto rest = std::max<steady_clock::duration>(0ms, end_tick - steady_clock::now() + 5ms);
std::this_thread::sleep_for(rest);
}
auto rest = std::max<steady_clock::duration>(0ms, end_tick - steady_clock::now() + 5ms);
std::this_thread::sleep_for(rest);
new_animation_frame();
animated_units_[0].my_unit->anim_comp().get_animation()->set_max_animation_time(0ms);
@ -1439,8 +1436,6 @@ void unit_animator::wait_until(const std::chrono::milliseconds& animation_time)
void unit_animator::wait_for_end() const
{
if(game_config::no_delay) return;
bool finished = false;
while(!finished) {
resources::controller->play_slice();