1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2025-07-02 09:52:49 +00:00

changed //EX to #if HDR; removed #if EX

This commit is contained in:
Zeno Rogue 2019-08-09 19:03:29 +02:00
parent 24a2e6178a
commit 85e9e7cd11
3 changed files with 21 additions and 11 deletions

View File

@ -6,7 +6,7 @@
namespace hr { namespace hr {
EX namespace binary { EX namespace binary {
#if EX CAP_BT #if CAP_BT
enum bindir { enum bindir {
bd_right = 0, bd_right = 0,

View File

@ -20,6 +20,7 @@ void mark_file() {
bool do_endif; bool do_endif;
bool in_hdr;
void gen(string s) { void gen(string s) {
which_file = s; which_file = s;
@ -28,16 +29,18 @@ void gen(string s) {
while(getline(in, s)) { while(getline(in, s)) {
while(s != "" && s[0] == ' ') s = s.substr(1); while(s != "" && s[0] == ' ') s = s.substr(1);
while(s.back() == 10 || s.back() == 13) s = s.substr(0, s.size() - 1); while(s.back() == 10 || s.back() == 13) s = s.substr(0, s.size() - 1);
if(s.substr(0, 7) == "#if EX ") { if(in_hdr) {
cout << ind() << s << "\n"; if(s == "#endif" && in_hdr) {
do_endif = true; in_hdr = false;
} }
if(s.substr(0, 4) == "//EX") { else cout << ind() << s << "\n";
auto t = s.substr(4); continue;
while(t != "" && t[0] == ' ') t = t.substr(1); }
cout << ind() << t << "\n"; if(s == "#if HDR") {
in_hdr = true;
} }
if(s.substr(0, 4) == "EX }") { if(s.substr(0, 4) == "EX }") {
mark_file();
cout << ind() << "}\n"; cout << ind() << "}\n";
indent -= 2; indent -= 2;
} }
@ -49,6 +52,7 @@ void gen(string s) {
indent += 2; indent += 2;
} }
else { else {
mark_file();
for(int i=0;; i++) { for(int i=0;; i++) {
if(i == int(t.size())) { cerr << "Error: unrecognizable EX: " << s << "\n"; } if(i == int(t.size())) { cerr << "Error: unrecognizable EX: " << s << "\n"; }
else if(t[i] == '{') { else if(t[i] == '{') {

View File

@ -9,7 +9,9 @@ EX namespace nisot {
typedef array<float, 3> ptlow; typedef array<float, 3> ptlow;
EX transmatrix local_perspective; EX transmatrix local_perspective;
//EX inline bool local_perspective_used() { return nonisotropic; } #if HDR
inline bool local_perspective_used() { return nonisotropic; }
#endif
EX bool geodesic_movement = true; EX bool geodesic_movement = true;
@ -443,7 +445,9 @@ EX namespace nilv {
hyperpoint mvec_to_point(mvec m) { return hpxy3(m[0], m[1], m[2]); } hyperpoint mvec_to_point(mvec m) { return hpxy3(m[0], m[1], m[2]); }
//EX static const int nilv_S7 = 8; #if HDR
static const int nilv_S7 = 8;
#endif
array<mvec, nilv_S7> movevectors = {{ mvec(-1,0,0), mvec(-1,0,1), mvec(0,-1,0), mvec(0,0,-1), mvec(1,0,0), mvec(1,0,-1), mvec(0,1,0), mvec(0,0,1) }}; array<mvec, nilv_S7> movevectors = {{ mvec(-1,0,0), mvec(-1,0,1), mvec(0,-1,0), mvec(0,0,-1), mvec(1,0,0), mvec(1,0,-1), mvec(0,1,0), mvec(0,0,1) }};
@ -546,7 +550,9 @@ EX namespace nisot {
return true; return true;
} }
//EX enum iePrecision { iLazy, iTable }; #if HDR
enum iePrecision { iLazy, iTable };
#endif
EX hyperpoint inverse_exp(const hyperpoint h, iePrecision p) { EX hyperpoint inverse_exp(const hyperpoint h, iePrecision p) {
if(sol) return solv::get_inverse_exp(h, p == iLazy); if(sol) return solv::get_inverse_exp(h, p == iLazy);