summaryrefslogtreecommitdiff
path: root/src/spells1.cc
diff options
context:
space:
mode:
authorBardur Arantsson <bardur@scientician.net>2014-12-16 18:51:06 +0100
committerBardur Arantsson <bardur@scientician.net>2014-12-16 18:54:55 +0100
commit4d351b8d07c25415d5848e9486eb5cb52f02d72e (patch)
tree0b8045630e146eaa870280e2d3e7f13e50499ad2 /src/spells1.cc
parentff252acf7f2f38e33017e82881c95825b54c7cee (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/spells1.cc')
-rw-r--r--src/spells1.cc13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/spells1.cc b/src/spells1.cc
index 1c53fa8e..0f5e83c9 100644
--- a/src/spells1.cc
+++ b/src/spells1.cc
@@ -11,9 +11,14 @@
*/
#include "angband.h"
-
#include "spell_type.h"
+#include <chrono>
+#include <thread>
+
+using std::this_thread::sleep_for;
+using std::chrono::milliseconds;
+
/* 1/x chance of reducing stats (for elemental attacks) */
#define HURT_CHANCE 32
@@ -8436,7 +8441,7 @@ bool_ project(int who, int rad, int y, int x, int dam, int typ, int flg)
print_rel(c, a, y, x);
move_cursor_relative(y, x);
if (fresh_before) Term_fresh();
- Term_xtra(TERM_XTRA_DELAY, msec);
+ sleep_for(milliseconds(msec));
lite_spot(y, x);
if (fresh_before) Term_fresh();
@@ -8462,7 +8467,7 @@ bool_ project(int who, int rad, int y, int x, int dam, int typ, int flg)
else if (visual)
{
/* Delay for consistency */
- Term_xtra(TERM_XTRA_DELAY, msec);
+ sleep_for(milliseconds(msec));
}
}
}
@@ -8580,7 +8585,7 @@ bool_ project(int who, int rad, int y, int x, int dam, int typ, int flg)
/* Delay (efficiently) */
if (visual || drawn)
{
- Term_xtra(TERM_XTRA_DELAY, msec);
+ sleep_for(milliseconds(msec));
}
}