Fixed walk_choices's type (#3353)
Fixes #3310 Replaced some still hardcoded values with their define constants. Added a function to check if a walk will be diagonal and fixed invalid calculation for it. Thanks to @DavidPS92
This commit is contained in:
@@ -56,7 +56,7 @@ static BHEAP_STRUCT_VAR(node_heap, g_open_set); // use static heap for all path
|
||||
/// @}
|
||||
|
||||
// Translates dx,dy into walking direction
|
||||
static const char walk_choices [3][3] =
|
||||
static enum directions walk_choices [3][3] =
|
||||
{
|
||||
{DIR_NORTHWEST,DIR_NORTH,DIR_NORTHEAST},
|
||||
{DIR_WEST,DIR_CENTER,DIR_EAST},
|
||||
@@ -510,3 +510,7 @@ int distance_client(int dx, int dy)
|
||||
|
||||
return ((int)temp_dist);
|
||||
}
|
||||
|
||||
bool direction_diagonal( enum directions direction ){
|
||||
return direction == DIR_NORTHWEST || direction == DIR_SOUTHWEST || direction == DIR_SOUTHEAST || direction == DIR_NORTHEAST;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user