reg3:: Camelot

This commit is contained in:
Zeno Rogue 2020-01-28 12:43:53 +01:00
parent c556d21434
commit a5a9104abf
2 changed files with 13 additions and 8 deletions

View File

@ -271,13 +271,13 @@ EX heptagon *createAlternateMap(cell *c, int rad, hstate firststate, int special
alt->c7 = NULL;
alt->alt = alt;
if(reg3::in_rule()) {
reg3::link_structures(h, alt);
reg3::link_structures(h, alt, firststate);
if(alt->fiftyval == -1) return nullptr; /* unlinked */
}
h->alt = alt;
alt->cdata = (cdata*) h;
currentmap->link_alt(bf);
for(int d=rad; d>=0; d--) {
currentmap->generateAlts(cx[d]->master);
preventbarriers(cx[d]);
@ -1486,11 +1486,11 @@ EX void buildBigStuff(cell *c, cell *from) {
buildBarrier4(c, bd, 0, getNewLand(c->land), c->land); */
}
if((!chaosmode) && bearsCamelot(c->land) && is_master(c) && !bt::in() && !(hyperbolic && WDIM == 3) &&
if((!chaosmode) && bearsCamelot(c->land) && is_master(c) && !bt::in() && !(hyperbolic && WDIM == 3 && !reg3::in_rule()) &&
(quickfind(laCamelot) || peace::on || (hrand(I2000) < (c->land == laCrossroads4 ? 800 : 200) && horo_ok() &&
items[itEmerald] >= U5 && !tactic::on && !racing::on))) {
int rtr = newRoundTableRadius();
heptagon *alt = createAlternateMap(c, rtr+14, hsOrigin);
heptagon *alt = createAlternateMap(c, rtr+(hyperbolic && WDIM == 3 ? 11 : 14), hsOrigin);
if(alt) {
alt->emeraldval = rtr;
alt->fiftyval = c->land;
@ -1584,7 +1584,9 @@ EX bool openplains(cell *c) {
EX void buildCamelotWall(cell *c) {
if(S3 >= OINF) { c->wall = waRubble; return; }
if(WDIM == 3 && hyperbolic && c->master->fieldval == 0) return;
c->wall = waCamelot;
if(WDIM == 3 && hyperbolic) return;
for(int i=0; i<c->type; i++) {
cell *c2 = createMov(c, i);
if(c2->wall == waNone && (eubinary || (c2->master->alt && c->master->alt)) && celldistAlt(c2) > celldistAlt(c) && c2->monst == moNone)

View File

@ -1140,11 +1140,14 @@ EX hrmap *new_alt_map(heptagon *o) {
return new hrmap_reg3_rule_alt(o);
}
EX void link_structures(heptagon *h, heptagon *alt) {
alt->fieldval = h->fieldval;
alt->fiftyval = h->fiftyval;
vector<int> choices;
EX void link_structures(heptagon *h, heptagon *alt, hstate firststate) {
auto cm = (hrmap_reg3_rule*) currentmap;
alt->fieldval = h->fieldval;
if(firststate == hsOrigin) {
alt->fiftyval = cm->root[alt->fieldval];
return;
}
vector<int> choices;
for(auto p: cm->nonlooping_earlier_states)
if(p.first.first == h->fieldval)
choices.push_back(p.first.second);