mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2025-02-02 04:09:16 +00:00
throw hr_exceptions not strings
This commit is contained in:
parent
8fc92f2e83
commit
953e17722d
@ -53,7 +53,7 @@ coord coord::addmove(int d) {
|
||||
case 9: return down().shift(1, 2);
|
||||
case 10: return shift(-1, 0);
|
||||
case 11: return shift(0, -1);
|
||||
default: throw "error";
|
||||
default: throw hr_exception("error");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -526,7 +526,7 @@ EX namespace bt {
|
||||
case bd_up_right:
|
||||
return xpush(-log(2)) * parabolic(1);
|
||||
default:
|
||||
throw "unknown direction";
|
||||
throw hr_exception("unknown direction");
|
||||
}
|
||||
else if(use_direct_for(dir))
|
||||
return cgi.direct_tmatrix[dir];
|
||||
|
@ -1207,7 +1207,7 @@ EX namespace gp {
|
||||
return cw.at;
|
||||
}
|
||||
}
|
||||
throw "unimplemented";
|
||||
throw hr_exception("unimplemented");
|
||||
}
|
||||
|
||||
transmatrix adj(cell *c, int d) override {
|
||||
|
@ -373,7 +373,7 @@ EX namespace sn {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
default: throw "not solnihv";
|
||||
default: throw hr_exception("not solnihv");
|
||||
}
|
||||
}
|
||||
|
||||
@ -452,7 +452,7 @@ EX namespace sn {
|
||||
case gSol: up = 2; down = 6; break;
|
||||
case gSolN: up = 4; down = 7; break;
|
||||
case gNIH: up = 4; down = 4; break;
|
||||
default: throw "not nihsolv";
|
||||
default: throw hr_exception("not nihsolv");
|
||||
}
|
||||
|
||||
while(h1->distance > h2->distance) front = front * adj(h1, down), h1 = h1->cmove(down);
|
||||
@ -526,7 +526,7 @@ EX namespace sn {
|
||||
0
|
||||
);
|
||||
default:
|
||||
throw "christoffel not in solnihv";
|
||||
throw hr_exception("christoffel not in solnihv");
|
||||
}
|
||||
}
|
||||
|
||||
@ -690,7 +690,7 @@ EX namespace sn {
|
||||
case gSol: return solt;
|
||||
case gNIH: return niht;
|
||||
case gSolN: return sont;
|
||||
default: throw "not solnih";
|
||||
default: throw hr_exception("not solnih");
|
||||
}
|
||||
}
|
||||
|
||||
|
2
reg3.cpp
2
reg3.cpp
@ -1197,7 +1197,7 @@ EX namespace reg3 {
|
||||
res = at;
|
||||
}
|
||||
|
||||
if(!res) throw "res missing";
|
||||
if(!res) throw hr_exception("res missing");
|
||||
|
||||
if(res->move(d2)) println(hlog, "res conflict");
|
||||
|
||||
|
8
util.cpp
8
util.cpp
@ -666,14 +666,14 @@ EX string compress_string(string s) {
|
||||
strm.opaque = Z_NULL;
|
||||
println(hlog, "pre init");
|
||||
auto ret = deflateInit(&strm, 9);
|
||||
if(ret != Z_OK) throw "z-error";
|
||||
if(ret != Z_OK) throw hr_exception("z-error");
|
||||
println(hlog, "init ok");
|
||||
strm.avail_in = isize(s);
|
||||
strm.next_in = (Bytef*) &s[0];
|
||||
vector<char> buf(1000000, 0);
|
||||
strm.avail_out = 1000000;
|
||||
strm.next_out = (Bytef*) &buf[0];
|
||||
if(deflate(&strm, Z_FINISH) != Z_STREAM_END) throw "z-error-2";
|
||||
if(deflate(&strm, Z_FINISH) != Z_STREAM_END) throw hr_exception("z-error-2");
|
||||
println(hlog, "deflate ok");
|
||||
string out(&buf[0], (char*)(strm.next_out) - &buf[0]);
|
||||
println(hlog, isize(s), " -> ", isize(out));
|
||||
@ -686,13 +686,13 @@ EX string decompress_string(string s) {
|
||||
strm.zfree = Z_NULL;
|
||||
strm.opaque = Z_NULL;
|
||||
auto ret = inflateInit(&strm);
|
||||
if(ret != Z_OK) throw "z-error";
|
||||
if(ret != Z_OK) throw hr_exception("z-error");
|
||||
strm.avail_in = isize(s);
|
||||
strm.next_in = (Bytef*) &s[0];
|
||||
vector<char> buf(1000000, 0);
|
||||
strm.avail_out = 1000000;
|
||||
strm.next_out = (Bytef*) &buf[0];
|
||||
if(inflate(&strm, Z_FINISH) != Z_STREAM_END) throw "z-error-2";
|
||||
if(inflate(&strm, Z_FINISH) != Z_STREAM_END) throw hr_exception("z-error-2");
|
||||
string out(&buf[0], (char*)(strm.next_out) - &buf[0]);
|
||||
println(hlog, isize(s), " -> ", isize(out));
|
||||
return out;
|
||||
|
Loading…
Reference in New Issue
Block a user