mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2024-12-18 15:00:26 +00:00
increased MAX_EDGE
This commit is contained in:
parent
e14ac8b321
commit
be2ac7654a
@ -63,7 +63,7 @@ void archimedean_tiling::prepare() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if(isize(faces) > MAX_EDGE/2) {
|
if(isize(faces) > MAX_EDGE/2) {
|
||||||
errormsg = XLAT("currently no more than %1 faces in vertex", its(MAX_EDGE));
|
errormsg = XLAT("currently no more than %1 faces in vertex", its(MAX_EDGE/2));
|
||||||
errors++;
|
errors++;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -583,7 +583,7 @@ hrmap *new_map() { return new hrmap_archimedean; }
|
|||||||
|
|
||||||
heptagon *build_child(heptspin p, pair<int, int> adj) {
|
heptagon *build_child(heptspin p, pair<int, int> adj) {
|
||||||
indenter ind;
|
indenter ind;
|
||||||
auto h = buildHeptagon1(tailored_alloc<heptagon> (isize(current.adjacent[adj.first])), p.at, p.spin, hstate(1), 0);
|
auto h = buildHeptagon1(tailored_alloc<heptagon> (isize(current.adjacent[adj.first])), p.at, p.spin, hstate(1), 0, adj.first);
|
||||||
SDEBUG( printf("NEW %p.%d ~ %p.0\n", p.at, p.spin, h); )
|
SDEBUG( printf("NEW %p.%d ~ %p.0\n", p.at, p.spin, h); )
|
||||||
id_of(h) = adj.first;
|
id_of(h) = adj.first;
|
||||||
parent_index_of(h) = adj.second;
|
parent_index_of(h) = adj.second;
|
||||||
|
@ -62,9 +62,10 @@ hstate transition(hstate s, int dir) {
|
|||||||
#define COMPUTE -1000000
|
#define COMPUTE -1000000
|
||||||
|
|
||||||
// create a new heptagon
|
// create a new heptagon
|
||||||
heptagon *buildHeptagon1(heptagon *h, heptagon *parent, int d, hstate s, int pard = 0, int fixdistance = COMPUTE) {
|
heptagon *buildHeptagon1(heptagon *h, heptagon *parent, int d, hstate s, int pard = 0, int zv = 0) {
|
||||||
h->alt = NULL;
|
h->alt = NULL;
|
||||||
h->s = s;
|
h->s = s;
|
||||||
|
h->zebraval = zv;
|
||||||
h->c.connect(pard, parent, d, false);
|
h->c.connect(pard, parent, d, false);
|
||||||
h->cdata = NULL;
|
h->cdata = NULL;
|
||||||
return h;
|
return h;
|
||||||
|
51
hyper.h
51
hyper.h
@ -338,10 +338,10 @@ struct gcell {
|
|||||||
cpdist : 8; // current/minimum player distance
|
cpdist : 8; // current/minimum player distance
|
||||||
|
|
||||||
unsigned
|
unsigned
|
||||||
mondir : 4, // monster direction, for multi-tile monsters and graphics
|
mondir : 8, // monster direction, for multi-tile monsters and graphics
|
||||||
bardir : 4, // barrier direction
|
bardir : 8, // barrier direction
|
||||||
stuntime : 4, // stun time left (for Palace Guards and Skeletons)
|
stuntime : 8, // stun time left (for Palace Guards and Skeletons)
|
||||||
hitpoints : 4; // hitpoints left (for Palace Guards, also reused as cpid for mirrors)
|
hitpoints : 8; // hitpoints left (for Palace Guards, also reused as cpid for mirrors)
|
||||||
|
|
||||||
unsigned landflags : 8; // extra flags for land
|
unsigned landflags : 8; // extra flags for land
|
||||||
#else
|
#else
|
||||||
@ -398,11 +398,11 @@ struct gcell {
|
|||||||
|
|
||||||
#define fval LHU.fi.fieldval
|
#define fval LHU.fi.fieldval
|
||||||
|
|
||||||
#define NODIR 14
|
#define NODIR 126
|
||||||
#define NOBARRIERS 15
|
#define NOBARRIERS 127
|
||||||
#define MODFIXER 10090080
|
#define MODFIXER (2*10090080*17)
|
||||||
|
|
||||||
#define MAX_EDGE 14
|
#define MAX_EDGE 18
|
||||||
|
|
||||||
template<class T> struct walker;
|
template<class T> struct walker;
|
||||||
|
|
||||||
@ -414,26 +414,19 @@ template<class T> struct connection_table {
|
|||||||
// less than MAX_EDGE neighbors (see tailored_alloc),
|
// less than MAX_EDGE neighbors (see tailored_alloc),
|
||||||
// the order of fields matters.
|
// the order of fields matters.
|
||||||
|
|
||||||
unsigned char spintable[6];
|
T* move_table[MAX_EDGE + (MAX_EDGE + sizeof(char*) - 1) / sizeof(char*)];
|
||||||
unsigned short mirrortable;
|
|
||||||
T* move_table[MAX_EDGE];
|
|
||||||
unsigned char spintable_extra[2];
|
|
||||||
|
|
||||||
|
unsigned char *spintable() { return (unsigned char*) (&move_table[full()->degree()]); }
|
||||||
|
|
||||||
T* full() { T* x = (T*) this; return (T*)((char*)this - ((char*)(&(x->c)) - (char*)x)); }
|
T* full() { T* x = (T*) this; return (T*)((char*)this - ((char*)(&(x->c)) - (char*)x)); }
|
||||||
unsigned char& get_spinchar(int d) {
|
|
||||||
if(d < 12) return spintable[d>>1];
|
|
||||||
else return spintable_extra[(d-12)>>1];
|
|
||||||
}
|
|
||||||
void setspin(int d, int spin, bool mirror) {
|
void setspin(int d, int spin, bool mirror) {
|
||||||
unsigned char& c = get_spinchar(d);
|
unsigned char& c = spintable() [d];
|
||||||
c &= ~(15 << ((d&1) << 2));
|
c = spin;
|
||||||
c |= spin << ((d&1) << 2);
|
if(mirror) c |= 128;
|
||||||
if(mirror) mirrortable |= (1 << d);
|
|
||||||
else mirrortable &=~ (1 << d);
|
|
||||||
}
|
}
|
||||||
// we are spin(i)-th neighbor of move[i]
|
// we are spin(i)-th neighbor of move[i]
|
||||||
int spin(int d) { return (get_spinchar(d) >> ((d&1)<<2)) & 15; }
|
int spin(int d) { return spintable() [d] & 127; }
|
||||||
bool mirror(int d) { return (mirrortable >> d) & 1; }
|
bool mirror(int d) { return spintable() [d] & 128; }
|
||||||
int fix(int d) { return (d + MODFIXER) % full()->degree(); }
|
int fix(int d) { return (d + MODFIXER) % full()->degree(); }
|
||||||
T*& modmove(int i) { return move(fix(i)); }
|
T*& modmove(int i) { return move(fix(i)); }
|
||||||
T*& move(int i) { return move_table[i]; }
|
T*& move(int i) { return move_table[i]; }
|
||||||
@ -463,14 +456,12 @@ template<class T> T* tailored_alloc(int degree) {
|
|||||||
const T* sample = (T*) °ree;
|
const T* sample = (T*) °ree;
|
||||||
T* result;
|
T* result;
|
||||||
#ifndef NO_TAILORED_ALLOC
|
#ifndef NO_TAILORED_ALLOC
|
||||||
if(degree <= 12) {
|
int b = (char*)&sample->c.move_table[degree] + degree - (char*) sample;
|
||||||
int b = (char*)&sample->c.move_table[degree] - (char*) sample;
|
result = (T*) new char[b];
|
||||||
result = (T*) new char[b];
|
new (result) T();
|
||||||
new (result) T();
|
#else
|
||||||
}
|
result = new T;
|
||||||
else
|
|
||||||
#endif
|
#endif
|
||||||
result = new T;
|
|
||||||
for(int i=0; i<degree; i++) result->c.move_table[i] = NULL;
|
for(int i=0; i<degree; i++) result->c.move_table[i] = NULL;
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user