Add behavior to prevent AI from entering intersections when they are blocked. #628
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.
In reference to #627 .
Currently, if a road convoy sees an intersection on its route, it will enter that intersection regardless of whether it can actually leave that intersection - if the next spot after the intersection is occupied, this frequently leads to gridlock that can only be stopped by very careful route design. This is not only aggravating but also contrary to the rules of the road in most countries.
For instance, this route where a bus goes A->B->C->D->A is crippled by a single bus entering the intersection:
The rule added here checks for if:
If there is, the convoy will wait for that tile to be clear.
As far as I can tell, it works fine, but in cases where a tile becomes occupied in between a convoy entering an intersection and it reaching the end, there is still a possibility of a convoy ending up blocked in an intersection. Other than that, this should solve most cases of gridlock from arising.