1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2024-11-23 21:07:17 +00:00

shstream:: initialize from a string

This commit is contained in:
Zeno Rogue 2020-01-26 01:19:05 +01:00
parent b58138cd94
commit 62990a765e

View File

@ -133,7 +133,7 @@ struct fhstream : hstream {
struct shstream : hstream {
string s;
int pos;
shstream() { pos = 0; }
shstream(const string& t = "") : s(t) { pos = 0; }
virtual void write_char(char c) { s += c; }
virtual char read_char() { if(pos == isize(s)) throw hstream_exception(); return s[pos++]; }
};