Convert remaining uses of SDL_Delay to std::this_thread::sleep_for
There's one last usecase in controller_base which I intend to remove.
This commit is contained in:
parent
812c1e2e5e
commit
8b14612fbe
5 changed files with 15 additions and 10 deletions
|
@ -57,14 +57,13 @@
|
|||
#include <boost/process.hpp>
|
||||
#include <cstdlib> // for system
|
||||
#include <new>
|
||||
#include <thread>
|
||||
#include <utility> // for pair
|
||||
|
||||
|
||||
#ifdef DEBUG_WINDOW_LAYOUT_GRAPHS
|
||||
#include "gui/widgets/debug.hpp"
|
||||
#endif
|
||||
|
||||
|
||||
static lg::log_domain log_config("config");
|
||||
#define ERR_CONFIG LOG_STREAM(err, log_config)
|
||||
#define WRN_CONFIG LOG_STREAM(warn, log_config)
|
||||
|
@ -811,7 +810,8 @@ void game_launcher::start_wesnothd()
|
|||
#endif
|
||||
c.detach();
|
||||
// Give server a moment to start up
|
||||
SDL_Delay(50);
|
||||
using namespace std::chrono_literals;
|
||||
std::this_thread::sleep_for(50ms);
|
||||
return;
|
||||
}
|
||||
catch(const bp::process_error& e)
|
||||
|
|
|
@ -167,7 +167,8 @@ void playmp_controller::play_idle_loop()
|
|||
try {
|
||||
process_network_data();
|
||||
play_slice_catch();
|
||||
SDL_Delay(1);
|
||||
using namespace std::chrono_literals;
|
||||
std::this_thread::sleep_for(1ms); // TODO: why?
|
||||
} catch(...) {
|
||||
DBG_NG << "Caught exception while playing idle loop: " << utils::get_unknown_exception_type();
|
||||
throw;
|
||||
|
@ -183,7 +184,8 @@ void playmp_controller::wait_for_upload()
|
|||
gui2::dialogs::loading_screen::progress(loading_stage::next_scenario);
|
||||
while(!next_scenario_notified_ && !is_host()) {
|
||||
process_network_data();
|
||||
SDL_Delay(10);
|
||||
using namespace std::chrono_literals;
|
||||
std::this_thread::sleep_for(10ms);
|
||||
gui2::dialogs::loading_screen::spin();
|
||||
}
|
||||
});
|
||||
|
|
|
@ -50,6 +50,7 @@
|
|||
#include "wesnothd_connection_error.hpp"
|
||||
#include "whiteboard/manager.hpp"
|
||||
|
||||
#include <thread>
|
||||
|
||||
static lg::log_domain log_aitesting("ai/testing");
|
||||
#define LOG_AIT LOG_STREAM(info, log_aitesting)
|
||||
|
@ -480,7 +481,8 @@ void playsingle_controller::play_idle_loop()
|
|||
{
|
||||
while(!should_return_to_play_side()) {
|
||||
play_slice_catch();
|
||||
SDL_Delay(10);
|
||||
using namespace std::chrono_literals;
|
||||
std::this_thread::sleep_for(10ms);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -44,11 +44,11 @@
|
|||
#include <map>
|
||||
#include <sstream>
|
||||
#include <string>
|
||||
#include <thread>
|
||||
#include <utility>
|
||||
|
||||
#include <functional>
|
||||
#include <boost/range/adaptors.hpp>
|
||||
#include <SDL2/SDL.h>
|
||||
|
||||
#include "lua/wrapper_lauxlib.h"
|
||||
|
||||
|
@ -88,8 +88,7 @@ static int intf_describe_plugins(lua_State * L)
|
|||
|
||||
static int intf_delay(lua_State* L)
|
||||
{
|
||||
unsigned int delay = static_cast<unsigned int>(luaL_checkinteger(L, 1));
|
||||
SDL_Delay(delay);
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds{luaL_checkinteger(L, 1)});
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -36,6 +36,7 @@
|
|||
|
||||
#include <cassert>
|
||||
#include <sstream>
|
||||
#include <thread>
|
||||
|
||||
static lg::log_domain log_replay("replay");
|
||||
#define DBG_REPLAY LOG_STREAM(debug, log_replay)
|
||||
|
@ -320,7 +321,8 @@ config synced_context::ask_server_choice(const server_choice& sch)
|
|||
did_require = true;
|
||||
}
|
||||
|
||||
SDL_Delay(10);
|
||||
using namespace std::chrono_literals;
|
||||
std::this_thread::sleep_for(10ms);
|
||||
continue;
|
||||
|
||||
} else if(!is_replay_end) {
|
||||
|
|
Loading…
Add table
Reference in a new issue