Skip to content

Commit

Permalink
Merge branch 'development'
Browse files Browse the repository at this point in the history
  • Loading branch information
KSneijders committed Jan 1, 2024
2 parents d9190da + a8593a4 commit c5587ba
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 2 deletions.
10 changes: 10 additions & 0 deletions AoE2ScenarioRms/util/grid_map_factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

from AoE2ScenarioParser.datasets.players import PlayerId
from AoE2ScenarioParser.datasets.terrains import TerrainId
from AoE2ScenarioParser.objects.support.area import Area
from AoE2ScenarioParser.objects.support.tile import Tile
from AoE2ScenarioParser.scenarios.aoe2_de_scenario import AoE2DEScenario

Expand All @@ -23,6 +24,7 @@ def select(
object_marks: ObjectMark = None,
terrain_ids: List[TerrainId] = None,
object_consts: Dict[int, int] = None,
area: Area = None
) -> GridMap:
return GridMapFactory.mark(
scenario=scenario,
Expand All @@ -31,6 +33,7 @@ def select(
object_marks=object_marks,
terrain_ids=terrain_ids,
object_consts=object_consts,
area=area,
)

@staticmethod
Expand All @@ -40,6 +43,7 @@ def block(
object_marks: ObjectMark = None,
terrain_ids: List[TerrainId] = None,
object_consts: Dict[int, int] = None,
area: Area = None
) -> GridMap:
return GridMapFactory.mark(
scenario=scenario,
Expand All @@ -48,6 +52,7 @@ def block(
object_marks=object_marks,
terrain_ids=terrain_ids,
object_consts=object_consts,
area=area,
)

@staticmethod
Expand All @@ -58,6 +63,7 @@ def mark(
object_marks: ObjectMark = None,
terrain_ids: List[TerrainId] = None,
object_consts: Dict[int, int] = None,
area: Area = None
) -> GridMap:
starting_state = TileLevel.NONE if block_marked_tiles else TileLevel.TERRAIN
set_marked_state = TileLevel.TERRAIN if block_marked_tiles else TileLevel.NONE
Expand All @@ -78,6 +84,10 @@ def mark(
if t.terrain_id in terrain_ids:
marked_tiles.add(Tile(*t.xy))

# Mark all tiles selected by an area
if isinstance(area, Area):
marked_tiles.update(area.to_coords())

# Mark all shores
requested_water_but_not_shore = TerrainMark.WATER in terrain_marks and TerrainMark.SHORE not in terrain_marks
if TerrainMark.SHORE in terrain_marks or requested_water_but_not_shore:
Expand Down
2 changes: 1 addition & 1 deletion AoE2ScenarioRms/version.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
""" Expose version """

__version__ = "0.2.5" # << Also change `/pyproject.toml`
__version__ = "0.2.6" # << Also change `/pyproject.toml`
VERSION = __version__.split(".")
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

---

## 0.2.6 - 2023-April-16

### Added

- Added support for an `Area` object in the `GridMapFactory`

---

## 0.2.5 - 2023-April-16

> `0.2.2`, `0.2.3`, `0.2.4` & `0.2.5` were just release tests
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"

[project]
name = "AoE2ScenarioRms"
version = "0.2.5" # << Also change `AoE2ScenarioRms/version.py`
version = "0.2.6" # << Also change `AoE2ScenarioRms/version.py`
authors = [
{ name = "Kerwin Sneijders", email = "[email protected]" },
]
Expand Down

0 comments on commit c5587ba

Please sign in to comment.