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.
Both horizontal and vertical scrollbars had a malfunctioning widget: both the
right and bottom widgets weren't fired properly.
The bug was less noticeable for vertical scrollbars, as clicking the widget would
be treated as clicking empty space, which did not happen for the horizontal
scrollbar.
This patch fixes the underlying inconsistencies, making sure the widgets for
both types of scrollbars work -- when using either scrollbar, or when combined.
Currently the game window is always created with an OpenGL context which then means that opengl32.dll and other modules are loaded. The OpenGL window flag will now only be used if the config drawing engine is set to OpenGL. This now means that a restart of the game is required when switching to the OpenGL drawing engine for Windows.
#5104
Removed display of raw cut height value.
Changed display of cut height in METRIC/SI from 1DP to 2DP to display odd raw heights with accurate value.
Changed display of cut height in IMPERIAL to 1DP to display odd raw heights with accurate value.
The window size did not match the sizes given to window_create, causing
the window to think it was actually smaller, and as a result not clearing
the screen properly. This commit adds the WW and WH macros and uses them.
This commit also has a few formatting changes.
Paint clipping is a possible future feature to assist players building in cluttered areas of a park by controlling which map elements and sprites are rendered, providing a clearer view for construction, inspection, etc.
Only clip height is supported in this prototype.
Map elements are clipped according to the map element base height (meaning *all* scenery on that map element is currently clipped with it).
Sprites are clipped according to their z value being within the "sprite volume" of any non-clipped map element (which means below clip height + 2).
Control is only provided through the console in this prototype - use the command: set paint_clip_height _value_
To turn clipping off use the command: set paint_clip_height 255
Clip heights are limited to multiples of two to coincide with the native heights of map elements.
Command "get paint_clip_height" prints the clip height as a raw value as well as the equivalent height in ft and m as used when displaying heights in-game.
At this time only painting of the main viewport is affected. There is no change to any input control handling.
Cleaned up widget positions - looks like a proper interface now.
Remaining Issues:
- Window only displays correctly every second time it is opened;
- Clip height in Units (ft/m) is displayed without the decimal point;
- Scroll bar is not working;
- Decide how the View menu entry should work.
Paint clipping is a possible future feature to assist players building in cluttered areas of a park by controlling which map elements and sprites are rendered, providing a clearer view for construction, inspection, etc.
Only clip height is supported in this prototype.
Map elements are clipped according to the map element base height (meaning *all* scenery on that map element is currently clipped with it).
Sprites are clipped according to their z value being within the "sprite volume" of any non-clipped map element (which means below clip height + 2).
Control is only provided through the console in this prototype - use the command: set paint_clip_height _value_
To turn clipping off use the command: set paint_clip_height 255
Clip heights are limited to multiples of two to coincide with the native heights of map elements.
Command "get paint_clip_height" prints the clip height as a raw value as well as the equivalent height in ft and m as used when displaying heights in-game.
At this time only painting of the main viewport is affected. There is no change to any input control handling.
Ghost elements are notoriously a reason of network desyncs, because they
don't get transferred over network. They are meant to be local only and
disregarded by any logic, but it is not yet the case in many places.
Upon saving, we *remove* all the ghost elements (by calling
`scenario_fix_ghosts`), based on assumption they can only be caused by
local interaction. Testing has shown there are `sv6`s in the wild that
have elements marked as ghosts and this could lead to a situation where
we strip away parts of the park. This also causes network desyncs for
reason stated above.
As we strip elements with ghost flag from saves anyway, it should be
safe to assume none of our saves introduce ghosts and this issue is
limited to hacked parks only. One example of such park is [Cocopa
Bay](http://www.nedesigns.com/park/3473/cocopa-bay/).
This change removes the flag on all map elements while importing. This
is much less invasive than removing all ghost elements on importing, as
they may contain some actual data. This ~~fixes~~ hides the desync that
could be seen in the Cocopa Bay park.
As this doesn't change any in-game logic, no network version update is
necessary.
#5094
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.
Because of a comment on a diff in #4878 asking for clearer and more consistent type usage. What this PR changes:
No unsigned long long found
(signed) long long -> sint64
unsigned int -> uint32
(signed) int -> sint32
(signed) long -> sint32
unsigned short -> uint16
(signed) short -> sint16
unsigned char -> uint8
No signed chars found
plain char is implementation-defined, so I left those in.
This way the last remaining uses of int could be replaced with sint32 as
well. Before this change there was a circular dependancy which made the
types unknown in diagnostic.h.
When the filter caused no results to be shown in the list, it would try to realloc for 0 bytes which returns NULL. The error shown in the console was a minor bug, the more serious issue was the the original memory was freed but the list pointer not updated. Instead just check for 0 items, dispose the list and return.
This merge does several things:
* Changes all the code to be built as a static library, `libopenrct2.lib`
* Adds two new projects to produce `openrct2.dll` and `openrct2.exe`
* Adds a build step to create `openrct2.com`
This is to remove the test configurations and make building the test projects quicker and simpler.
It also distributes two very small shims, `openrct2.exe` and `openrct2.com` which are a GUI windows app and console app respectively. This simplifies the experience of using openrct2 on the command line as .com has higher precedence. `--console` is therefore no longer necessary.
`libopenrct2.lib` will probably be the beginning of several static libraries which make up the game as we will split up the UI from the core logic and possibly more.
This was found during the rct1 vehicle import branch. When importing it would load all vehicles into this list only to find that each car was treated as a seperate train.
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.