1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2025-07-17 16:32:50 +00:00

field pattern on Euclidean does torus instead of crashing

This commit is contained in:
Zeno Rogue 2017-12-03 16:12:20 +01:00
parent c5324ff2f5
commit f2af1d63f6
2 changed files with 10 additions and 2 deletions

View File

@ -992,6 +992,14 @@ namespace mapeditor {
case 'H': case 'H':
return towerval(c); return towerval(c);
case 'F': { case 'F': {
if(euclid) {
using namespace torusconfig;
eucoord cx, cy;
decodeMaster(c->master, cx, cy);
int cd = cx * dx + cy * dy;
cd %= qty; if(cd<0) cd += qty;
return cd;
}
pair<int, bool> p = fieldpattern::fieldval(c); pair<int, bool> p = fieldpattern::fieldval(c);
return 10*p.first + (p.second?6:7); return 10*p.first + (p.second?6:7);
} }
@ -1023,7 +1031,7 @@ namespace mapeditor {
if(drawcell == cwt.c) return vid.cs.charid; if(drawcell == cwt.c) return vid.cs.charid;
if(drawcell->monst) return drawcell->monst; if(drawcell->monst) return drawcell->monst;
if(drawcell->item) return drawcell->item; if(drawcell->item) return drawcell->item;
return subpattern(drawcell); return subpattern(drawcell) % (USERSHAPEIDS);
} }
int subpatternShape(int i) { int subpatternShape(int i) {

View File

@ -971,7 +971,7 @@ hpcshape
#define USERLAYERS 32 #define USERLAYERS 32
#define USERSHAPEGROUPS 8 #define USERSHAPEGROUPS 8
#define USERSHAPEIDS 256 #define USERSHAPEIDS 4096
struct usershapelayer { struct usershapelayer {
vector<hyperpoint> list; vector<hyperpoint> list;