diff options
author | Bardur Arantsson <bardur@scientician.net> | 2014-12-16 18:51:06 +0100 |
---|---|---|
committer | Bardur Arantsson <bardur@scientician.net> | 2014-12-16 18:54:55 +0100 |
commit | 4d351b8d07c25415d5848e9486eb5cb52f02d72e (patch) | |
tree | 0b8045630e146eaa870280e2d3e7f13e50499ad2 /src/modules.cc | |
parent | ff252acf7f2f38e33017e82881c95825b54c7cee (diff) |
Replace usleep with C++11 this_thread::sleep_for()
Also remove TERM_XTRA_DELAY. The terminal abstraction should
not be used for providing general platform independence. As a
side effect this reintroduces support for "delay" on SDL, not
sure if that's a good idea or not.
Diffstat (limited to 'src/modules.cc')
-rw-r--r-- | src/modules.cc | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/modules.cc b/src/modules.cc index b152fa0b..2e16adbc 100644 --- a/src/modules.cc +++ b/src/modules.cc @@ -9,6 +9,12 @@ #include "angband.h" #include "hooks.h" +#include <chrono> +#include <thread> + +using std::this_thread::sleep_for; +using std::chrono::milliseconds; + static void module_reset_dir_aux(char **dir, cptr new_path) { char buf[1024]; @@ -311,7 +317,7 @@ static bool_ dleft(byte c, cptr str, int y, int o) time = time + 1; if (time >= 4) { - Term_xtra(TERM_XTRA_DELAY, 1); + sleep_for(milliseconds(1)); time = 0; } Term_redraw_section(a - 1, y, a, y); @@ -344,7 +350,7 @@ static bool_ dright(byte c, cptr str, int y, int o) Term_putch(a, y, c, str[i-1]); time = time + 1; if (time >= 4) { - Term_xtra(TERM_XTRA_DELAY, 1); + sleep_for(milliseconds(1)); time = 0; } Term_redraw_section(a, y, a + 1, y); |