function InitializePath(source, goal) { this._pathfinder.InitializePath([source, 0xFF], goal); if (this._search_range != 0) { local source_x = AIMap.GetTileX(source); local source_y = AIMap.GetTileY(source); local goal_x = AIMap.GetTileX(goal); local goal_y = AIMap.GetTileY(goal); local N_x = source_x > goal_x ? goal_x : source_x; local N_y = source_y > goal_y ? goal_y : source_y; local S_x = source_x > goal_x ? source_x : goal_x; local S_y = source_y > goal_y ? source_y : goal_y; local min_freeform = AIMap.IsValidTile(0) ? 0 : 1; local max_freeform = min_freeform == 0 ? 3 : 2; this._min_x = N_x - this._search_range < min_freeform ? min_freeform : N_x - this._search_range; this._min_y = N_y - this._search_range < min_freeform ? min_freeform : N_y - this._search_range; this._max_x = S_x + this._search_range > AIMap.GetMapSizeX() - max_freeform ? AIMap.GetMapSizeX() - max_freeform : S_x + this._search_range; this._max_y = S_y + this._search_range > AIMap.GetMapSizeY() - max_freeform ? AIMap.GetMapSizeY() - max_freeform : S_y + this._search_range; } }