Commit graph

13566 commits

Author SHA1 Message Date
nia
1f220f2d62 Simplify OS-specific FileStream code (#10270)
Define ftello/fseeko to ftello64/fseeko64 only on Linux,
these functions are Linux-specific extensions.

Define ftello/fseeko to _ftelli64/_fseeki64 on MSC.

Otherwise, just use the standardized ftello/fseeko, and avoid
duplicating code for different names of the same function.

This allows this code to be reused on e.g. NetBSD without piling
on additional #ifdefs for any other POSIX operating systems.
2019-12-19 18:34:31 +01:00
Tulio Leao
918624e090 Fix #10396: Function returning TileCoordsXYZD'z coord in a CoordsXYZD object (#10398) 2019-12-19 15:41:22 +01:00
Michael Steenbeek
6ede67d50a
Merge pull request #10371 from tupaschoal/coords-for-get-surface-element-at
Make map_get_surface_element_at only accept Coords objects
2019-12-19 13:24:17 +01:00
Tulio Leao
7e7b4029a9 Simplified conversions from TileCoordsXYZ to CoordsXY 2019-12-19 08:12:42 -03:00
Michael Steenbeek
f59f5d9b1f
Merge pull request #10375 from tupaschoal/coords-for-map-entrance-exit
Make map entrance/exit fetching functions use Coords objects
2019-12-19 11:39:37 +01:00
Duncan
08bf0a6807
Merge pull request #10391 from tupaschoal/mouse-diff-coords
Save mouse differential coords using ScreenCoordsXY
2019-12-19 08:02:32 +00:00
Tulio Leao
aea755bd70 Allow TileCoordsXYZD to generate CoordsXYZD equivalent 2019-12-19 00:11:26 -03:00
Tulio Leao
a5065e95c6 Simplify MouseInput differential coords calculation 2019-12-18 23:57:57 -03:00
Tulio Leao
5c657bde9f Remove map_get_surface_element_at operating with TileCoordsXY 2019-12-18 23:47:17 -03:00
Tulio Leao
7c75db2b2d Make map_get_surface_element_at only accept Coords objects 2019-12-18 23:46:50 -03:00
Duncan
099404b505
Merge pull request #10381 from tupaschoal/cursorsate-store-coords
Make CursorState store a ScreenCoordsXY object
2019-12-18 20:10:51 +00:00
Tulio Leao
af281817c3 Use CoordsXYZD on map_get_wall_element_at() (#10374)
* Use CoordsXYZD on map_get_wall_element_at()

* Add CoordsXYZ::ToTileStart()
2019-12-18 11:23:53 +01:00
Tulio Leao
4f615c5802 Make const some methods of location objects (#10392) 2019-12-18 11:21:16 +01:00
Tulio Leao
52d09171ba Remove usage of LocationXY on TrackDesign (#10383) 2019-12-18 11:20:51 +01:00
Tulio Leao
c71c4284d0 Make map entrance/exit fetching functions use only CoordsXY objects 2019-12-17 23:55:46 -03:00
Tulio Leao
8613edee4a Use ScreenCoordsXY::operator- to improve readability 2019-12-17 23:33:07 -03:00
Tulio Leao
972a8735e8 Fix arithmetic error in Scenery::window_scenery_update() 2019-12-17 23:32:34 -03:00
Tulio Leao
502a15512b Save mouse differential coords using ScreenCoordsXY 2019-12-17 23:21:12 -03:00
Ted John
b2c0787c2d Fix #10389: Invalid read in vehicle_update_travelling (#10390) 2019-12-17 21:48:38 +01:00
Tulio Leao
c2c40fa951 Create ScreenCoordsXY on UIContext mouse/finger functions (#10382) 2019-12-17 18:46:28 +01:00
Tulio Leao
6b06b2c578 Use ScreenCoordsXY for Mouse Drag storage (#10380) 2019-12-17 18:38:20 +01:00
duncanspumpkin
df5d5f4eb1 Fix the logging once and for all 2019-12-15 16:48:14 +00:00
duncanspumpkin
11974dd7b3 Increment Network Version 2019-12-15 08:31:26 +00:00
duncanspumpkin
3c89fc63ad Reduce logging of variables to just name to make logs useful 2019-12-15 08:26:19 +00:00
duncanspumpkin
2eab8c3784 Fix formatting and declaration 2019-12-15 08:23:21 +00:00
duncanspumpkin
63b8f83f4f Make suggested changes 2019-12-15 08:23:21 +00:00
duncanspumpkin
073e75a7bd Remove extra line break 2019-12-15 08:23:21 +00:00
duncanspumpkin
d97bb88c41 Reduce desyncs by removing teh track before updating peep logic 2019-12-15 08:21:32 +00:00
duncanspumpkin
cfb4bba721 Remove todo and clang format where required
Change array type to avoid additional code

Make CI's happier
2019-12-15 08:21:32 +00:00
duncanspumpkin
d8b5060eb9 Remove dead game command code.
Refactor of z increment
2019-12-15 08:21:32 +00:00
duncanspumpkin
fa3332f47a Fix ghost desync and rotation issue
Fix callback by reworking placement code
2019-12-15 08:21:32 +00:00
duncanspumpkin
7dbf0353ff Serialise scenery, mazes, entrances 2019-12-15 08:21:32 +00:00
duncanspumpkin
83503f4c69 Serialise track design. Start work on making it work
Fix track designs issuing extra game actions
2019-12-15 08:21:32 +00:00
duncanspumpkin
c781fcb72d Start moving track design into a game action
Make place track design work with game actions
2019-12-15 08:21:32 +00:00
Tulio Leao
2cd3add373 Make CursorState store a ScreenCoordsXY object 2019-12-14 23:30:55 -03:00
Tulio Leao
72d19f779b Fix clang-format 2019-12-14 23:07:45 -03:00
Tulio Leao
9d09f1b95c Use ScreenCoordsXY on context cursor operations (#10364) 2019-12-14 22:52:18 +01:00
Tulio Leao
af7b364946 Prefer map_is_location_valid over hardcoded map limits (#10373) 2019-12-14 22:50:34 +01:00
Tulio Leao
03e7e29b21 Make map entrance/exit fetching functions use Coords objects 2019-12-14 12:13:09 -03:00
frutiemax
18ba9b27a3 Implement #7865: Allow transport rides to synchronise with adjacent stations (#10280) 2019-12-14 09:58:00 +01:00
Tulio Leao
801e6e085d Use CoordsXY on Map::map_surface_is_blocked() (#10369)
* Use CoordsXY on Map::map_surface_is_blocked()

* Update src/openrct2/peep/GuestPathfinding.cpp

* Use map_is_location_valid() instead of hardcoded number
2019-12-14 09:57:13 +01:00
Abd Narane
1ace96ccc4 Add shortcuts for changing the scaling value. (#10341)
Fixes #10305
2019-12-13 17:31:23 +01:00
Tulio Leao
440f012e8a Remove unused Map::rotate_map_coordinates() function (#10362) 2019-12-12 18:53:24 +01:00
Tulio Leao
2ff4c28cb5 Use CoordsXY on action rotation (#10332)
* Use CoordsXY on action rotation

* Don't use intermediate CoordsXY variable just for Rotating it next

* Standardize operations on Coords and Rotated Coords

* Remove unwanted linebreak addition
2019-12-12 08:09:46 +00:00
Duncan
fed417da03
Merge pull request #10356 from duncanspumpkin/label_var
Change the label on known var to reflect use.
2019-12-11 18:14:07 +00:00
Duncan
90bde58852
Merge pull request #10329 from tupaschoal/coords-for-windows-rotate
Use CoordsXY on TopToolbar and TrackDesignPlace rotations
2019-12-11 08:44:06 +00:00
Tulio Leao
43366a0a51 Make sure height comparisons are done against TileCoords 2019-12-10 23:33:53 -03:00
Duncan
2a53ebd936
Merge pull request #10333 from tupaschoal/rotate-paint
Use CoordsXY for Paint rotations
2019-12-10 18:35:38 +00:00
Duncan
432ad7867a
Merge pull request #10334 from tupaschoal/rotate-for-trackdesign
Use CoordsXY for TrackDesign* rotations
2019-12-10 12:49:34 +00:00
Michael Steenbeek
8e805f5088
Merge pull request #10328 from tupaschoal/rotate-ride-coords
Use CoordsXY and ScreenCoordsXY for rotate in Ride*.*
2019-12-10 13:13:03 +01:00
Ted John
e72d2aba85
Merge pull request #10309 from tupaschoal/floor-ceil-constexpr
Make floor2 and ceil2 constexpr functions
2019-12-09 22:48:20 +00:00
Tulio Leao
68e0519c5e Remove Map::map_offset_with_rotation() 2019-12-09 17:55:57 -03:00
Tulio Leao
2ddde8a344 Simplify attach calculation on Paint.cpp 2019-12-09 17:19:45 -03:00
Tulio Leao
01c62437b2 Remove Ride::ride_get_rotated_coords() 2019-12-09 16:52:47 -03:00
Tulio Leao
aca4d39107 Allow TileCoordsXYZ conversion to CoordsXYZ 2019-12-05 21:43:20 -03:00
Tulio Leao
e21e0105af Use CoordsXY for Map rotations (#10335) 2019-12-05 20:38:14 +01:00
Tulio Leao
081c9fb187 Use CoordsXY for TrackDesign* rotations 2019-12-04 23:30:36 -03:00
Tulio Leao
5b43f19708 Use CoordsXY for Paint rotations 2019-12-04 23:08:26 -03:00
Tulio Leao
accb4ea691 Use CoordsXY on TopToolbar and TrackDesignPlace rotations 2019-12-04 22:07:11 -03:00
Tulio Leao
d9348cf562 Use CoordsXY::ToTileCentre() on Ride.cpp 2019-12-04 22:02:11 -03:00
Michael Steenbeek
d012c8141b
Merge pull request #10316 from duncanspumpkin/light_fx
Make lights work for all rotations.
2019-12-04 14:11:26 +01:00
Tulio Leao
6f0ebfea27 Use CoordsXY and ScreenCoordsXY for rotate in Ride*.* 2019-12-04 08:02:09 -03:00
ζeh Matt
ab5be44ccb Fix #10325: Crash when banners have no text (#10327)
* Fix #10325: Crash when banners have no text

* Update changelog.txt
2019-12-04 11:22:07 +01:00
Tulio Leao
aa02a8c7ce Throw exception if floor2 and ceil2 are misused 2019-12-03 23:13:12 -03:00
Tulio Leao
c4089acd63 Removed parentheses for improved readability 2019-12-01 22:45:16 -03:00
duncanspumpkin
44998481f6 Use tile Offset 2019-12-01 15:15:44 +00:00
duncanspumpkin
ef10cb243b minor code cleanup 2019-12-01 14:53:52 +00:00
duncanspumpkin
813ed4fdac Remove commented out dead code 2019-12-01 14:52:17 +00:00
duncanspumpkin
f964d38e7d Renable light occlusion 2019-12-01 14:51:14 +00:00
duncanspumpkin
ace59e6a73 Make lights work for all rotations.
Mistake made with the coordinates confusing viewport and screen coordinates. In addition occlusion code that is depretiated was culling all lights in two rotations due to dead code.
2019-12-01 14:07:48 +00:00
duncanspumpkin
0c6e062d5a Refactor return value of screen_coord_to_viewport_cord 2019-12-01 09:15:07 +00:00
Tulio Leao
1532ee2b23 Create CoordsXY::ToTileStart() and CoordsXY::ToTileCentre() 2019-11-30 16:47:23 +01:00
Tulio Leao
1e67c3bff8 Make floor2 and ceil2 constexpr functions 2019-11-30 08:41:45 -03:00
Tulio Leao
721a4961a7 Fix #10304: Mouse zoom not following cursor position 2019-11-29 18:08:59 -03:00
Tulio Leao
4537c061d9 Prefer std::optional over LOCATION_NULL on Viewport (#10297) 2019-11-29 17:17:01 +01:00
Duncan
7e96ddf1d6
Merge pull request #10289 from tupaschoal/viewport-inter-2
Use CoordsXY on ViewportInteraction.cpp
2019-11-29 09:21:08 +00:00
Duncan
b316f447a4
Merge pull request #10285 from tupaschoal/useCoords-get-map-coords
Remove raw coordinates overload of get_map_coordinates_from_pos
2019-11-29 09:20:12 +00:00
Ted John
569161902f Fix #9919: invalid read in vehicle_update_measurements (#10300) 2019-11-27 21:45:32 +01:00
Tulio Leao
fb95154000 Use operator -= and += of CoordsXY 2019-11-25 23:08:31 -03:00
Tulio Leao
47935288d0 Remove raw coordinates overload of get_map_coordinates_from_pos 2019-11-25 17:45:02 -03:00
Tulio Leao
2af1f1feba Use CoordsXY on ViewportInteraction.cpp 2019-11-24 19:45:56 -03:00
duncanspumpkin
0c4fffb2ec Refactor viewport_adjust_for_map_height to use CoordsXYZ. 2019-11-24 21:37:35 +00:00
Duncan
966ba6b018
Merge pull request #10269 from duncanspumpkin/centre_2d
Refactor centre_2d_coordinates to use screenCoords.
2019-11-24 14:28:18 +00:00
Duncan
81566a5e90
Merge pull request #10276 from tupaschoal/viewport-inter
Use ScreenCoordsXY on viewport interactions
2019-11-24 14:27:58 +00:00
tjwrona1992
5f41e9df38 Add missing include for std::max to fix VS16.4.0P2 compilation (#10282)
* Fix errors where "std::max" was not recognized while compiling with the latest Visual Studio (2019 16.4.0 Preview 2.0) due to a missing "#include" statement.

* Ran clang-format.
2019-11-24 08:12:50 +01:00
Tulio Leao
831050745c Fix #10275: Track element preview incorrect 2019-11-22 12:10:47 +01:00
Tulio Leao
c91bdadb47 Use ScreenCoordsXY on viewport interactions 2019-11-21 17:53:28 -03:00
Duncan
dfe8335e91
Merge pull request #10273 from tupaschoal/with_z_coords
Use CoordsXY/ScreenCoordsXY for viewport*_with_z
2019-11-21 17:06:49 +00:00
Paweł Bylica
7e7e088d8e
Use fs::path for some implementations in Path 2019-11-21 13:40:21 +01:00
Paweł Bylica
45002d723a
Add core/FileSystem.hpp for accessing std::filesystem
This file enables access to std::filesystem as `fs` namespace
or injects third-party drop-in replacement on build configs
where std::filesystem is not available.
2019-11-21 13:40:20 +01:00
Paweł Bylica
5a8a7fe7ba
Add ghc::filesystem for thirdparty/
This adds the filesystem.hpp from https://github.com/gulrak/filesystem the the src/openrct2/thirdparty directory. The header is going to be used in build configurations where std::filesystem is not available.
2019-11-21 13:40:20 +01:00
Tulio Leao
7f74e01669
Add braces to fix return on null Coords 2019-11-21 09:22:09 -03:00
Tulio Leao
a9c2e1229a Propagate error upward with LOCATION_NULL 2019-11-21 08:00:06 -03:00
duncanspumpkin
d4c15cd774 Refactor centre_2d_coordinates to use screenCoords. 2019-11-20 18:44:03 +00:00
Tulio Leao
f94970b059 Use CoordsXY/ScreenCoordsXY for viewport*_with_z
Closes #10268
2019-11-19 18:33:40 -03:00
Duncan
463ef9d218
Merge pull request #10238 from duncanspumpkin/viewport_get_xy_z
Refactor screen_get_map_xy_with_z to use CoordsXY structs
2019-11-19 15:02:50 +00:00
Tulio Leao
7718d83b21 Simplify assignment in RideConstruction.cpp (#10266) 2019-11-19 16:01:22 +01:00
duncanspumpkin
3b8bf56b71 Use helper function 2019-11-19 11:20:59 +00:00
duncanspumpkin
421107436f Refactor helper function to take screen coords 2019-11-19 11:20:59 +00:00
duncanspumpkin
1d6a923298 Refactor screen_get_map_xy_with_z to use CoordsXY structs 2019-11-19 11:20:58 +00:00
Duncan
c04cb0b94b
Merge pull request #10254 from tupaschoal/coords-for-ride-construction
Coords for ride construction
2019-11-19 11:12:51 +00:00
Tulio Leao
2acdc577f7 Use Coords for windows/RideConstruction 2019-11-18 19:17:54 -03:00
Tulio Leao
9fa355cb8c Make window_event_list use Coords for moved and cursor (#10258) 2019-11-18 23:13:32 +01:00
Duncan
5bfe31ceb9
Merge pull request #10062 from tupaschoal/nullptr-deref-avoid-surface
Avoid dereferencing map_get_surface_element_at nullptr on libopenrct2
2019-11-18 12:39:41 +00:00
Tulio Leao
72b4d93ad2 Avoid dereferencing map_get_surface_element_at nullptr on libopenrct2 2019-11-18 08:01:04 -03:00
Ted John
f7a8f5a0c7 Fix #10228: Can't import RCT1 Deluxe from Steam (#10260)
Use size of buffer rather than the size of a pointer which would always return 4 or 8 for the buffer size.
2019-11-18 10:05:16 +01:00
ζeh Matt
7744fc71e4 Fix #10256: Desync because of client advancing ahead of server ticks during map change (#10257) 2019-11-17 23:26:32 +01:00
ζeh Matt
5606b4895b Fix desync because of ride status (#10227) 2019-11-16 16:12:33 +01:00
Tulio Leao
93083780df Use ScreenCoordsXY for windows/Map (#10233)
* Use ScreenCoordsXY for windows/Footpath

- Refactor `place_park_entrance_get_map_position()` to receive `ScreenCoordsXY` and return `CoordsXYZD`
- Refactor `sub_68A15E()` to receive `ScreenCoordsXY` and return `CoordsXY`. Some of its usage are narrowing the result on purpose, as same variable is used for contexts where `int16_t` is still a hard requirement.

* Properly increment for big Z and use LOCATION_NULL
2019-11-14 23:09:27 +01:00
duncanspumpkin
e4ee91f5ff Refactor get_map_coordiantes to enforce Coords struct 2019-11-14 20:28:54 +00:00
Duncan
8eb42867dd
Merge pull request #10223 from duncanspumpkin/viewport_refactor
Remove global variables from get_map_coordinates_from_pos_window
2019-11-14 20:27:39 +00:00
Duncan
d6bb101f8d
Merge pull request #10237 from tupaschoal/screencoords-for-mouse-functions
Use ScreenCoordsXY for scroll_mouse* functions
2019-11-14 20:24:06 +00:00
Tulio Leao
cc12dbf238
Fix tile_element_height to use mapCoords instead of screenCoords 2019-11-14 10:50:10 -03:00
Duncan
a80566027a
Merge pull request #10236 from tupaschoal/coords-for-tile-inspector
Use more ScreenCoordsXY on windows/TileInspector.cpp
2019-11-14 12:52:00 +00:00
Duncan
38db42ac22
Merge pull request #10235 from tupaschoal/coords-for-landrights
Use ScreenCoordsXY on windows/LandRights.cpp
2019-11-14 12:43:17 +00:00
Duncan
3f7a4a9f42
Merge pull request #10229 from tupaschoal/refactor_ride_get_entrance_or_exit
Refactor ride_get_entrance_or_exit_position_from_screen_position()
2019-11-14 12:42:38 +00:00
Tulio Leao
fe3d6f6faf Use ScreenCoordsXY for scroll_mouse* functions 2019-11-14 08:40:40 -03:00
Tulio Leao
a5492acdec Use more ScreenCoordsXY on windows/TileInspector.cpp 2019-11-14 08:05:07 -03:00
Tulio Leao
5ca54758ae Use ScreenCoordsXY on windows/LandRights.cpp 2019-11-14 07:58:54 -03:00
Tulio Leao
0bc28406e0 Fix mistake on Coords Z assignment 2019-11-14 07:27:28 -03:00
Tulio Leao
7e65aeaea3 Fix issues in code review
Implement operator== and operator!= for CoordsXYZD
Set location to null before returning from ride_get_entrance_or_exit_position_from_screen_position
2019-11-13 18:46:02 -03:00
Tulio Leao
ce9432964c Improve coords management on window_rotate_camera 2019-11-13 18:28:03 -03:00
Tulio Leao
c36606c051 Distinguish Screen and Map Coords on window_rotate_camera 2019-11-13 18:28:03 -03:00
Tulio Leao
47387690f5 Improve coords assignments 2019-11-13 18:28:03 -03:00
Tulio Leao
30815f0886 Fix clang-format 2019-11-13 18:28:03 -03:00
Tulio Leao
054bc8e4ca Receive ScreenCoordsXY and return CoordsXY in Viewport 2019-11-13 18:27:59 -03:00
duncanspumpkin
0af10781f1 Remove unused globals 2019-11-13 19:04:01 +00:00
duncanspumpkin
57baeeaa3c Refactor to remove std::optional 2019-11-13 18:58:17 +00:00
Duncan
dde6ee93e0
Merge pull request #10220 from tupaschoal/coords-for-footpath
Use ScreenCoordsXY for windows/Footpath
2019-11-13 18:41:37 +00:00
Tulio Leao
27f47e1407
Apply suggestions from code review 2019-11-13 05:18:06 -08:00
Tulio Leao
677bd119cf
Update src/openrct2/ride/Ride.cpp 2019-11-13 05:17:02 -08:00
Tulio Leao
c568510bdc Fix warning displayed on CI 2019-11-13 09:54:05 -03:00
Tulio Leao
5dfe373061 Refactor ride_get_entrance_or_exit_position_from_screen_position() 2019-11-13 09:41:58 -03:00
Tulio Leao
0fc6da2443 Use ScreenCoordsXY for MazeConstruction (#10222) 2019-11-13 11:54:55 +01:00
Tulio Leao
5e888747de Use mapCoords instead of ScreenCoords 2019-11-12 20:13:14 -03:00
duncanspumpkin
278dd9b1d2 Remove global variables from get_map_coordinates_from_pos_window 2019-11-12 20:11:48 +00:00
Tulio Leao
3fa4b7b964 Fix clang-format 2019-11-12 00:27:59 -03:00
Tulio Leao
892c084cd8 Use ScreenCoordsXY for windows/Footpath 2019-11-11 23:10:51 -03:00
ζeh Matt
7e279d37cd Fix out of bounds access opening the in-game console at startup (#10197) 2019-11-09 21:26:14 +01:00
Conrad Kostecki
fef1906d0d CMakeLists.txt: make discord-rpc and google benchmark optional (#10208)
For a package maintainer, it should be possible to disable the support
for discord-rpc and google benchmark, as it currently always includes them,
when the library if found.
2019-11-09 21:20:16 +01:00
ζeh Matt
9b499ea239 Fix #10087: crash loading a save with corrupt peeps (#10122) 2019-11-09 17:00:09 +01:00
ζeh Matt
f6a23fd5f5 Add compile time selection for copying data with specialised paths (#9331) 2019-11-09 15:54:43 +01:00
ζeh Matt
f4a1b75a53
Merge pull request #10191 from ZehMatt/refactor/benchgfx
Refactor benchgfx
2019-11-09 00:22:58 +01:00
Michał Janiszewski
afc92ee15a
ifdef-out WinNT 6.0+ APIs (#10198)
Occasionally I need to build a binary compatible with WinNT 5.1, e.g.
when testing out Wine or ReactOS. There are just a few minor changes
required to have a working build, but as they are not part of the
repository, I always end up doing them from scratch. I would like to
upstream them instead so I don't have to recreate them each time, even
if this is not the most common use case.
2019-11-08 23:16:15 +01:00
Matt
d3103b6397
Refactor benchgfx 2019-11-08 08:52:45 +01:00
Tom Lankhorst
027c09553b Reformat code with clang-format 8.0. 2019-11-04 15:11:06 +01:00
Tom Lankhorst
efea8856ed Clean up OpenGL engine.
Code de-duplication and improved namespacing.
2019-11-04 15:10:42 +01:00
Aaron van Geffen
91f91d4388
Merge pull request #10147 from AaronVanGeffen/implement/1164
Use available translations for shortcut keys
2019-11-04 13:07:34 +01:00
Aaron van Geffen
d3b5214f95 Clarify user strings section in comment; add stylistic braces. 2019-11-04 12:09:36 +01:00
Duncan
8dc5865e6f
Merge pull request #10170 from tupaschoal/int32t_for_vehicle_train_index
Use int32_t instead of int for train_index
2019-11-03 05:17:30 +00:00