mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2025-02-23 06:20:09 +00:00
do not freeze if cannot find a correct start.heading_angle
This commit is contained in:
parent
495a308993
commit
649f3ed32b
@ -422,6 +422,8 @@ void level::init() {
|
||||
records[1].resize(qgoals, 0);
|
||||
current_score.resize(qgoals, 0);
|
||||
|
||||
int steps = 0;
|
||||
|
||||
/* start facing slightly to the right from the slope */
|
||||
for(auto b: {true, false}) while(true) {
|
||||
auto c = start;
|
||||
@ -430,8 +432,11 @@ void level::init() {
|
||||
dynamicval<bool> lop2(planning_mode, false);
|
||||
if(c.tick(this) == b) break;
|
||||
start.heading_angle -= degree;
|
||||
steps++; if(steps > 1080) break;
|
||||
}
|
||||
|
||||
if(steps > 1080) println(hlog, "warning: could not find a correct start.heading_angle");
|
||||
|
||||
if(flags & nrlOrder) {
|
||||
sort(triangles.begin(), triangles.end(), [this] (triangledata a, triangledata b) {
|
||||
return atan2(spin(120._deg)*(a.where - start.where)) < atan2(spin(120._deg)*(b.where - start.where));
|
||||
|
Loading…
x
Reference in New Issue
Block a user