mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2026-01-25 07:44:38 +01:00
Slightly refactor staff_can_ignore_wide_flag()
This should also take care of some compilers failing.
This commit is contained in:
committed by
Michał Janiszewski
parent
68516fc2bb
commit
9d04593734
@@ -674,7 +674,7 @@ sint32 staff_is_location_on_patrol_edge(rct_peep * mechanic, sint32 x, sint32 y)
|
||||
return onZoneEdge;
|
||||
}
|
||||
|
||||
sint32 staff_can_ignore_wide_flag(rct_peep * staff, sint32 x, sint32 y, uint8 z, rct_tile_element * path)
|
||||
bool staff_can_ignore_wide_flag(rct_peep * staff, sint32 x, sint32 y, uint8 z, rct_tile_element * path)
|
||||
{
|
||||
/* Wide flags can potentially wall off parts of a staff patrol zone
|
||||
* for the heuristic search.
|
||||
@@ -686,7 +686,7 @@ sint32 staff_can_ignore_wide_flag(rct_peep * staff, sint32 x, sint32 y, uint8 z,
|
||||
* Basic points of interest are:
|
||||
* - how many such tiles there are;
|
||||
* - whether there are connected paths on those tiles;
|
||||
* - whether the conected paths have the wide flag set.
|
||||
* - whether the connected paths have the wide flag set.
|
||||
* If there are no such tiles, the path is a concave corner of
|
||||
* the patrol zone and the wide flag can be ignored.
|
||||
* If there is one such tile, the path is on a straight side of the
|
||||
@@ -698,11 +698,11 @@ sint32 staff_can_ignore_wide_flag(rct_peep * staff, sint32 x, sint32 y, uint8 z,
|
||||
* ignored. */
|
||||
|
||||
if (staff->type != PEEP_TYPE_STAFF)
|
||||
return 0;
|
||||
return false;
|
||||
|
||||
if (!staff_is_location_on_patrol_edge(staff, x, y))
|
||||
{
|
||||
return 0;
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Check the connected adjacent paths that are also inside the patrol
|
||||
@@ -778,22 +778,16 @@ sint32 staff_can_ignore_wide_flag(rct_peep * staff, sint32 x, sint32 y, uint8 z,
|
||||
switch (total)
|
||||
{
|
||||
case 0: /* Concave corner */
|
||||
return 1;
|
||||
break;
|
||||
return true;
|
||||
case 1: /* Straight side */
|
||||
case 2: /* Convex corner */
|
||||
if (pathcount <= total - 1 || widecount == total)
|
||||
{
|
||||
return 1;
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -106,7 +106,7 @@ uint16 hire_new_staff_member(uint8 staffType);
|
||||
void staff_update_greyed_patrol_areas();
|
||||
sint32 staff_is_location_in_patrol(rct_peep * mechanic, sint32 x, sint32 y);
|
||||
sint32 staff_is_location_on_patrol_edge(rct_peep * mechanic, sint32 x, sint32 y);
|
||||
sint32 staff_can_ignore_wide_flag(rct_peep * mechanic, sint32 x, sint32 y, uint8 z, rct_tile_element * path);
|
||||
bool staff_can_ignore_wide_flag(rct_peep * mechanic, sint32 x, sint32 y, uint8 z, rct_tile_element * path);
|
||||
sint32 staff_path_finding(rct_peep * peep);
|
||||
void staff_reset_stats();
|
||||
bool staff_is_patrol_area_set(sint32 staffIndex, sint32 x, sint32 y);
|
||||
|
||||
Reference in New Issue
Block a user