mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2024-11-30 15:39:54 +00:00
racing:: check connectivity
This commit is contained in:
parent
d5ce7dc30b
commit
10b664097f
22
racing.cpp
22
racing.cpp
@ -165,6 +165,7 @@ void generate_track() {
|
|||||||
// for(cell *c:track) if(c->land != laMirror) c->bardir = NOBARRIERS;
|
// for(cell *c:track) if(c->land != laMirror) c->bardir = NOBARRIERS;
|
||||||
for(cell *c:track) setdist(c, 0, NULL);
|
for(cell *c:track) setdist(c, 0, NULL);
|
||||||
|
|
||||||
|
if(1) {
|
||||||
manual_celllister cl;
|
manual_celllister cl;
|
||||||
|
|
||||||
for(int i=0; i<isize(track); i++) {
|
for(int i=0; i<isize(track); i++) {
|
||||||
@ -195,12 +196,33 @@ void generate_track() {
|
|||||||
c->wall = waChasm;
|
c->wall = waChasm;
|
||||||
if(p.second >= win && p.first < TWIDTH) c->wall = hrand(2) ? waMirror : waCloud;
|
if(p.second >= win && p.first < TWIDTH) c->wall = hrand(2) ? waMirror : waCloud;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
int byat[256];
|
int byat[256];
|
||||||
for(int a=0; a<16; a++) byat[a] = 0;
|
for(int a=0; a<16; a++) byat[a] = 0;
|
||||||
for(auto s: trackstage) byat[s.second.first]++;
|
for(auto s: trackstage) byat[s.second.first]++;
|
||||||
for(int a=0; a<16; a++) printf("%d: %d\n", a, byat[a]);
|
for(int a=0; a<16; a++) printf("%d: %d\n", a, byat[a]);
|
||||||
|
|
||||||
|
if(1) {
|
||||||
|
manual_celllister cl;
|
||||||
|
cl.add(s);
|
||||||
|
bool goal = false;
|
||||||
|
for(int i=0; i<isize(cl.lst); i++) {
|
||||||
|
cell *c = cl.lst[i];
|
||||||
|
forCellEx(c2, c) {
|
||||||
|
if(among(c2->wall, waCloud, waMirror)) goal = true;
|
||||||
|
if(c2->wall == waIcewall || passable(c2, c, P_ISPLAYER))
|
||||||
|
cl.add(c2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(!goal) {
|
||||||
|
printf("error: goal unreachable\n");
|
||||||
|
stop_game();
|
||||||
|
start_game();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
for(cell *c: track) {
|
for(cell *c: track) {
|
||||||
int i = trackval(c) - celldist(c);
|
int i = trackval(c) - celldist(c);
|
||||||
|
Loading…
Reference in New Issue
Block a user