1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2025-02-02 12:19:18 +00:00

get_vernum()

This commit is contained in:
Zeno Rogue 2019-05-22 01:14:11 +02:00
parent 6012cbc8e2
commit 28f5b04b83
2 changed files with 3 additions and 1 deletions

View File

@ -39,7 +39,7 @@ struct charstyle_old {
void hread(hstream& hs, charstyle& cs) {
// before 0xA61A there was no eyecolor
if(hs.vernum < 0xA61A) {
if(hs.get_vernum() < 0xA61A) {
charstyle_old cso;
hread_raw(hs, cso);
cs.charid = cso.charid;

View File

@ -4582,6 +4582,7 @@ struct hstream {
virtual void write_chars(const char* c, size_t q) { while(q--) write_char(*(c++)); }
virtual char read_char() = 0;
virtual void read_chars(char* c, size_t q) { while(q--) *(c++) = read_char(); }
virtual color_t get_vernum() { return VERNUM_HEX; }
template<class T> void write(const T& t) { hwrite(*this, t); }
template<class T> void read(T& t) { hread(*this, t); }
@ -4628,6 +4629,7 @@ struct hstream_exception : hr_exception { hstream_exception() {} };
struct fhstream : hstream {
color_t vernum;
virtual color_t get_vernum() override { return vernum; }
FILE *f;
virtual void write_char(char c) { write_chars(&c, 1); }
virtual void write_chars(const char* c, size_t i) { if(fwrite(c, i, 1, f) != 1) throw hstream_exception(); }