Old revision #pmfujrgil | New revision #prqsbwaty | ||
---|---|---|---|
19 | this._max_x = S_x + this._search_range > AIMap.GetMapSizeX() - max_freeform ? AIMap.GetMapSizeX() - max_freeform : S_x + this._search_range; | 19 | this._max_x = S_x + this._search_range > AIMap.GetMapSizeX() - max_freeform ? AIMap.GetMapSizeX() - max_freeform : S_x + this._search_range; |
20 | this._max_y = S_y + this._search_range > AIMap.GetMapSizeY() - max_freeform ? AIMap.GetMapSizeY() - max_freeform : S_y + this._search_range; | 20 | this._max_y = S_y + this._search_range > AIMap.GetMapSizeY() - max_freeform ? AIMap.GetMapSizeY() - max_freeform : S_y + this._search_range; |
21 | } | 21 | } |
22 | } | 22 | } |
23 | |||
24 | function Road::_IsInsideRangeEfficient(self, cur_tile, | ||
25 | _AIMap = AIMap) | ||
26 | { | ||
27 | if (!self._search_range) return true; | ||
28 | local cur_tile_x = _AIMap.GetTileX(cur_tile); | ||
29 | local cur_tile_y = _AIMap.GetTileY(cur_tile); | ||
30 | return cur_tile_x >= self._min_x && cur_tile_x <= self._max_x && cur_tile_y >= self._min_y && cur_tile_y <= self._max_y; | ||
31 | } |