mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2024-11-27 14:37:16 +00:00
racing in Nil
This commit is contained in:
parent
8d9511ae79
commit
5febec0843
19
racing.cpp
19
racing.cpp
@ -272,7 +272,15 @@ void find_track(cell *start, int sign, int len) {
|
||||
forCellEx(c1, c) if(!bad(c1, c) && !parent.count(c1)) {
|
||||
parent[c1] = c;
|
||||
int id;
|
||||
if(sol)
|
||||
if(nil) {
|
||||
switch(sign) {
|
||||
case 1: id = c1->master->zebraval - start->master->zebraval; break;
|
||||
case 2: id = start->master->emeraldval - c1->master->emeraldval; break;
|
||||
case 3: id = start->master->zebraval - c1->master->zebraval; break;
|
||||
case 4: id = start->master->emeraldval - c1->master->emeraldval; break;
|
||||
}
|
||||
}
|
||||
else if(sol)
|
||||
id = (start->master->distance - c1->master->distance) * sign;
|
||||
else
|
||||
id = trackval(c1);
|
||||
@ -282,7 +290,7 @@ void find_track(cell *start, int sign, int len) {
|
||||
|
||||
if(euclid && (penrose || archimedean)) permanent_long_distances(goal);
|
||||
|
||||
if(sol) {
|
||||
if(sol || nil) {
|
||||
vector<cell*> p;
|
||||
while(goal != start) p.push_back(goal), goal = parent[goal];
|
||||
while(!p.empty()) track.push_back(p.back()), p.pop_back();
|
||||
@ -336,6 +344,13 @@ EX void generate_track() {
|
||||
find_track(track.back(), -1, LENGTH-2*(LENGTH/4));
|
||||
find_track(track.back(), 1, LENGTH/4);
|
||||
}
|
||||
else if(nil) {
|
||||
track.push_back(s);
|
||||
find_track(s, 1, LENGTH/4);
|
||||
find_track(track.back(), 2, LENGTH/4);
|
||||
find_track(track.back(), 3, LENGTH/4);
|
||||
find_track(track.back(), 4, LENGTH/4);
|
||||
}
|
||||
else try {
|
||||
find_track(s, 0, LENGTH);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user