diff options
author | Bardur Arantsson <bardur@scientician.net> | 2017-05-02 19:20:57 +0200 |
---|---|---|
committer | Bardur Arantsson <bardur@scientician.net> | 2017-05-02 19:20:57 +0200 |
commit | 2bf6a6ce72bf3f2038cd383fb7c6d35679ef9341 (patch) | |
tree | a4f4e342be4003a914c6c90b4d2ac1aae0406373 | |
parent | 90a81c722fa22de210878f7cf708dcc13d2520b9 (diff) |
Add std::string overloads of c_put_str() and put_str()
-rw-r--r-- | src/util.cc | 22 | ||||
-rw-r--r-- | src/util.hpp | 2 |
2 files changed, 11 insertions, 13 deletions
diff --git a/src/util.cc b/src/util.cc index 027c6c80..ce791015 100644 --- a/src/util.cc +++ b/src/util.cc @@ -1976,29 +1976,25 @@ void cmsg_format(byte color, cptr fmt, ...) cmsg_print(color, buf); } - - -/* -* Display a string on the screen using an attribute. -* -* At the given location, using the given attribute, if allowed, -* add the given string. Do not clear the line. -*/ void c_put_str(byte attr, cptr str, int row, int col) { - /* Position cursor, Dump the attr/text */ Term_putstr(col, row, -1, attr, str); } -/* -* As above, but in "white" -*/ +void c_put_str(byte attr, std::string const &str, int row, int col) +{ + Term_putstr(col, row, -1, attr, str.c_str()); +} + void put_str(cptr str, int row, int col) { - /* Spawn */ Term_putstr(col, row, -1, TERM_WHITE, str); } +void put_str(std::string const &str, int row, int col) +{ + Term_putstr(col, row, -1, TERM_WHITE, str.c_str()); +} /* diff --git a/src/util.hpp b/src/util.hpp index 4c74ad10..cc896e69 100644 --- a/src/util.hpp +++ b/src/util.hpp @@ -41,7 +41,9 @@ extern void msg_format(cptr fmt, ...); extern void screen_save(void); extern void screen_load(void); extern void c_put_str(byte attr, cptr str, int row, int col); +extern void c_put_str(byte attr, std::string const &str, int row, int col); extern void put_str(cptr str, int row, int col); +extern void put_str(std::string const &s, int row, int col); extern void c_prt(byte attr, cptr str, int row, int col); extern void c_prt(byte attr, std::string const &s, int row, int col); extern void prt(std::string const &s, int row, int col); |