1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2024-12-24 17:10:36 +00:00

arcm:: no longer crashes with divby0 on some incorrect strings

This commit is contained in:
Zeno Rogue 2018-12-06 13:01:23 +01:00
parent 2958564622
commit 1fe234fe75

View File

@ -1177,12 +1177,14 @@ string archimedean_tiling::world_size() {
}
anom *= 2 * denom, adenom *= nom;
int g = gcd(anom, adenom);
anom /= g; adenom /= g;
if(g != 0) {
anom /= g; adenom /= g;
}
if(adenom < 0) anom = -anom, adenom = -adenom;
string s;
bool hyp = (anom < 0);
if(hyp) anom = -anom;
if(adenom > 1)
if(adenom != 1)
s += its(anom) + "/" + its(adenom);
else
s += its(anom);