Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[✅API BACK-COMPAT] Fixed TileCondition functionality #177

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

nbness2
Copy link

@nbness2 nbness2 commented Nov 13, 2019

Problem: TileCondition (used by QueueTask.waitTile(Tile) does not work correctly.

Symptom: Tile properties that are used in Tile.sameAs(Tile) are val thus cannot be changed. When a Tile was passed to TileCondition as src. It seems as though the intention was for src to update as a reference the properties update, but the properties will never update (because they are val), thus rendering TileCondition useless.

Solution: TileCondition now takes Pawn and Tile (TileCondition(Pawn, Tile)), and since Pawn.tile is a var it means that it changes as Pawn.tile changes, and it allows TileCondition to work as expected.

QueueTask.waitTile(tile: Tile) has been changed to QueueTask.waitTile(tile: Tile, pawn: Pawn = ctx as Pawn) to keep backwards compatibility and preserve previous functionality while also giving the developer a bit more control over which Pawn they want to reach the tile before continuing the logic.

Problem: `TileCondition` (used by `QueueTask.waitTile(Tile)` does not work correctly.

Symptom: `Tile` properties that are used in `Tile.sameAs(Tile)` are `val` thus cannot be changed. When a tile was passed to `TileCondition` as `src`. It seems as though the intention was for `src` to update as a reference the properties update, but the properties will never update, thus rendering `TileCondition` useless.

Solution: `TileCondition` now takes `Pawn` and `Tile`, and since `Pawn.tile` is a `var` it means that it changes as `Pawn.tile` changes, and it allows `TileCondition` to work as expected. `QueueTask.waitTile(tile: Tile)` has been changed to `QueueTask.waitTile(tile: Tile, pawn: Pawn = ctx as Pawn)`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant