zenorogue / hyperrogue

A SDL roguelike in a non-euclidean world
GNU General Public License v2.0
569 stars 72 forks source link

Mac Clang build failed: calling non-const 'peek' on const walker #294

Closed jruderman closed 3 years ago

jruderman commented 3 years ago

Trying to build from 5f1f10c79ffa2093d6629d2411749ce02a8b4d7e on macOS gives me this pair of errors in shortcut_found:

rulegen.cpp:322:39: error: 'this' argument to member function 'peek' has type 'const
      std::__1::__vector_base<hr::walker<hr::rulegen::tcell>, std::__1::allocator<hr::walker<hr::rulegen::tcell> >
      >::value_type' (aka 'const hr::walker<hr::rulegen::tcell>'), but function is not marked const
    pre.push_back(walkerdir[i]); at = walkers[i].peek();
                                      ^~~~~~~~~~
locations.cpp:272:7: note: 'peek' declared here
  T*& peek() { return at->move(spin); }
      ^
rulegen.cpp:332:41: error: 'this' argument to member function 'peek' has type 'const
      std::__1::__vector_base<hr::walker<hr::rulegen::tcell>, std::__1::allocator<hr::walker<hr::rulegen::tcell> >
      >::value_type' (aka 'const hr::walker<hr::rulegen::tcell>'), but function is not marked const
    post.push_back(walkerdir2[i]); at = walkers2[i].peek();
                                        ^~~~~~~~~~~
locations.cpp:272:7: note: 'peek' declared here
  T*& peek() { return at->move(spin); }
      ^

I guess this build error was introduced in 31d359d9089b116aa08356431bb52651ef65b1a1, which changed the code around these lines so that walkers and walkers2 are const references.

zenorogue commented 3 years ago

Should be fixed.