From 28f5b04b83b329a8b40472486d279f9abbfa4295 Mon Sep 17 00:00:00 2001 From: Zeno Rogue Date: Wed, 22 May 2019 01:14:11 +0200 Subject: [PATCH] get_vernum() --- config.cpp | 2 +- hyper.h | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/config.cpp b/config.cpp index 9d731c58..5d9155b3 100644 --- a/config.cpp +++ b/config.cpp @@ -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; diff --git a/hyper.h b/hyper.h index 0ba14006..e542d813 100644 --- a/hyper.h +++ b/hyper.h @@ -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 void write(const T& t) { hwrite(*this, t); } template 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(); }