mirror of https://github.com/OpenRCT2/OpenRCT2.git
Fix #2417 also fixed some surface pathfinding bugs.
Guests were ignoring fences when surface pathfinding even when there was an available exit. Missing &= 3 was causing the assert to trigger.
This commit is contained in:
parent
9426170918
commit
8eb313f852
|
@ -6589,7 +6589,7 @@ static int peep_interact_with_shop(rct_peep* peep, sint16 x, sint16 y, rct_map_e
|
|||
|
||||
/* rct2: 0x0069524E */
|
||||
static int peep_move_one_tile(uint8 direction, rct_peep* peep){
|
||||
assert(direction <= 7);
|
||||
assert(direction <= 3);
|
||||
sint16 x = peep->next_x;
|
||||
sint16 y = peep->next_y;
|
||||
x += TileDirectionDelta[direction].x;
|
||||
|
@ -6620,10 +6620,9 @@ static int guest_surface_path_finding(rct_peep* peep){
|
|||
if (!fence_in_the_way(x, y, z, z + 4, randDirection)){
|
||||
x += TileDirectionDelta[randDirection].x;
|
||||
y += TileDirectionDelta[randDirection].y;
|
||||
randDirection ^= (1 << 1);
|
||||
uint8 backwardsDirection = randDirection ^ (1 << 1);
|
||||
|
||||
if (!fence_in_the_way(x, y, z, z + 4, randDirection)){
|
||||
randDirection ^= (1 << 1);
|
||||
if (!fence_in_the_way(x, y, z, z + 4, backwardsDirection)){
|
||||
if (!map_surface_is_blocked(x, y)){
|
||||
return peep_move_one_tile(randDirection, peep);
|
||||
}
|
||||
|
@ -6637,13 +6636,14 @@ static int guest_surface_path_finding(rct_peep* peep){
|
|||
}
|
||||
randDirection &= 3;
|
||||
|
||||
x = peep->next_x;
|
||||
y = peep->next_y;
|
||||
if (!fence_in_the_way(x, y, z, z + 4, randDirection)){
|
||||
x += TileDirectionDelta[randDirection].x;
|
||||
y += TileDirectionDelta[randDirection].y;
|
||||
randDirection ^= (1 << 1);
|
||||
uint8 backwardsDirection = randDirection ^ (1 << 1);
|
||||
|
||||
if (!fence_in_the_way(x, y, z, z + 4, randDirection)){
|
||||
randDirection ^= (1 << 1);
|
||||
if (!fence_in_the_way(x, y, z, z + 4, backwardsDirection)){
|
||||
if (!map_surface_is_blocked(x, y)){
|
||||
return peep_move_one_tile(randDirection, peep);
|
||||
}
|
||||
|
@ -6653,13 +6653,14 @@ static int guest_surface_path_finding(rct_peep* peep){
|
|||
randDirection -= 2;
|
||||
randDirection &= 3;
|
||||
|
||||
x = peep->next_x;
|
||||
y = peep->next_y;
|
||||
if (!fence_in_the_way(x, y, z, z + 4, randDirection)){
|
||||
x += TileDirectionDelta[randDirection].x;
|
||||
y += TileDirectionDelta[randDirection].y;
|
||||
randDirection ^= (1 << 1);
|
||||
uint8 backwardsDirection = randDirection ^ (1 << 1);
|
||||
|
||||
if (!fence_in_the_way(x, y, z, z + 4, randDirection)){
|
||||
randDirection ^= (1 << 1);
|
||||
if (!fence_in_the_way(x, y, z, z + 4, backwardsDirection)){
|
||||
if (!map_surface_is_blocked(x, y)){
|
||||
return peep_move_one_tile(randDirection, peep);
|
||||
}
|
||||
|
@ -6670,6 +6671,7 @@ static int guest_surface_path_finding(rct_peep* peep){
|
|||
if (rand_backwards){
|
||||
randDirection += 2;
|
||||
}
|
||||
randDirection &= 3;
|
||||
return peep_move_one_tile(randDirection, peep);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue