Level traversal works better now, compass is accurate, and direction is maintained when you traverse.
This commit is contained in:
parent
b75a2b8c31
commit
14c7f660de
11 changed files with 35 additions and 16 deletions
4
map.cpp
4
map.cpp
|
@ -117,7 +117,7 @@ Point Map::center_camera(const Point &around, size_t view_x, size_t view_y) {
|
|||
* drunkenly gradually reaching the player, and dodging
|
||||
* in and out.
|
||||
*/
|
||||
bool Map::neighbors(Point &out, bool random) {
|
||||
bool Map::neighbors(Point &out, bool random, int direction) {
|
||||
Matrix &paths = $paths.$paths;
|
||||
bool zero_found = false;
|
||||
|
||||
|
@ -145,7 +145,7 @@ bool Map::neighbors(Point &out, bool random) {
|
|||
if(!inmap(dir.x, dir.y)) continue; //skip unpathable stuff
|
||||
int weight = cur - paths[dir.y][dir.x];
|
||||
|
||||
if(weight == 1) {
|
||||
if(weight == direction) {
|
||||
// no matter what we follow direct paths
|
||||
out = dir;
|
||||
return true;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue