This addresses some of the desync causes:
* `vehicle_create_car` was using `scenario_rand` when it shouldn't have
* ghost elements affected grass growth
* ghost elements affecting peep logic[1]
It also adds some desync debug facilities, enabled at compile time.
It also reverts part of change introduced in
https://github.com/OpenRCT2/OpenRCT2/pull/5185,
namely reorder of desync check vs call to `ProcessGameCommandQueue();`
[1] It is not ideal to have this check in multiple locations, it is prone
to human error. We already have `map_remove_provisional_elements`,
but it is possible it does not work as well as it should. This needs
further investigation.
This commit expands tabs to spaces (ts=4) in all the files under src/
and test/.
Until now we had two wildly different code styles with C using tabs and
new C++ using spaces. It is painful to maintain as none of the commonly
used tools support this kind of setup and in reality is needless, as we
can simply convert all the sources to spaces and have opened PRs do the
same, where needed.
Additionally, trailing whitespace has been removed.
* Implement guard function for decrementing guest counts
* Implement separate functions for incr/decr of peep count globals
* assert() on attempt to increment guest counts over UINT16_MAX
* Increase network version
This is a minor improvement to #5424.
The zone edge detection is expanded to also check the diagonal neighbouring tiles so that the fix in #5242 also works for tiles on an internal corner of a patrol zone.
Wide path flags in patrol zones can divide the paths with an uncrossable boundary. Ignore wide flags on the patrol zone edges to provide doorways for mechanics through these boundaries without otherwise affecting the path finding heuristic.
Fixes#5414.
Requires new network version.
This bug is caused by inconsistent use of peep->interactionRideIndex. The primary use of this value is to record when a peep has decided to go on the ride at the queue entrance so they remember that decision when entering each queue path tile - without this they would re-decide whether to go on the ride each time they walk into a new ride queue tile.
This is also important for making the peeps walk up and back out of the queue when the ride is closed.
This value is also set when a peep decides not to go on a ride (though the reason why is not clear to me), but is not reset/changed on interaction with other tile types (e.g. shops, no entry signs, etc) causing peeps who bounce back on a ride queue entrance to walk up and down the queue.
Fixes#3499
Requires new network version.
This is a continuation of
https://github.com/OpenRCT2/OpenRCT2/pull/5094.
While the previous PR cured some desyncs, the real issue remained –
logic of the game considers ghost elements. This change fixes it, to
some extent.
The problem here is we already remove ghosts when interacting over
network (e.g. `footpath_provisional_remove` in `footpath_place_real`),
but this happens only when such a game command is executed in OpenRCT2.
Whenever SV6 gets imported, path map elements already have had edges
calculated for them, neighbours being ghost or not, and we don't update
it. OpenRCT2/OpenRCT2#5094 is one, naïve, way to solve, the other option
would be to recalculate all the paths whenever we load SV6.
The consideration of tall rides was probably not working properly as it was doing a straight comparrison of a flags variable.
This instead removes it as it already checks if the ride has ratings anyway. I've also added a status check so that guests do not attempt to walk to a ride far away that isn't open.
Dependent on the path layout it is possible for peeps to get stuck in backtracking cycles between two or more path tiles - each such tile is a turn around point because from that tile, the reachable tile on the search boundary that is closest to the peep destination is in the direction the peep came from.
When storing/updating the pathfind_histroy, remove the direction the peep came from (in addition to the chosen direction) from the directions left to try to prevent such backtracking.