-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Fix/warship freezing no path #4151
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
Merged
evanpelle
merged 6 commits into
openfrontio:main
from
Katokoda:fix/warship-freezing-no-path
Jun 5, 2026
+38
−0
Merged
Changes from 4 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
7692be2
Fix warship freezing when PatrolTile's proximity is unreachable from …
Katokoda a7f46ef
Add a test verifying that warship rejects new PatrolTile when in a di…
Katokoda bbfced6
Move the new warship test within the Warship-Description as pointed o…
Katokoda 56f91de
Merge branch 'main' into fix/warship-freezing-no-path
Katokoda 926675d
Removes redundant test of warship being on water as recommended by evan
Katokoda e889f7d
Merge branch 'fix/warship-freezing-no-path' of github.com:Katokoda/Op…
Katokoda File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we need this check, since a warship should always be in a water component because it must always be on a water tile?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Without it, the variable newPatrolTileWaterComponent is of type (number | null); which triggers an error in:
if (!mg.hasWaterComponent(warship.tile(), newPatrolTileWaterComponent)).I could have a test within the loop as does src/core/execution/WarshipExecution.ts :
but it seems less clear, doesn't let me put a warning in there and may be less performant because the test is within each iteration.
However, I am entirely new to Typescript, maybe there is a better way to simply indicate "we know this can't be null".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You could do:
newPatrolTileWaterComponent! to force it to true.
Another option is to throw an error to crash the game if the watercomponent is null, since that should never happen.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did the !-trick. It seem to have the same effect (would crash the game) but I do not have the control over the error.