1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2024-12-20 23:50:27 +00:00

prevent a crash when entering '(0,0)' in Archimedean

This commit is contained in:
Zeno Rogue 2022-03-27 20:44:45 +02:00
parent 8489550aed
commit 36c71eb583

View File

@ -1439,6 +1439,10 @@ EX void show() {
void archimedean_tiling::get_nom_denom(int& anom, int& adenom) { void archimedean_tiling::get_nom_denom(int& anom, int& adenom) {
int nom = 2 - N, denom = 2; int nom = 2 - N, denom = 2;
for(int f: faces) { for(int f: faces) {
if(f == 0) {
/* prevent a crash */
anom = 1; adenom = 1; return;
}
int g = gcd(denom, f); int g = gcd(denom, f);
nom = (nom * f + denom) / g; nom = (nom * f + denom) / g;
denom = denom / g * f; denom = denom / g * f;