Commit Graph
296 Commits
Author SHA1 Message Date
Matt 1aa75f04b7 Add templated version for tile element insertion and cleanup code 2021-02-05 12:22:34 +02:00
Matt 71174b8de7 Make the insertion of tile elements type explicit 2021-02-04 19:00:59 +02:00
ζeh Matt 6186766a05 Introduce TileElementsView (#13975)
* Simplify TileElement type conversation

* Introduce TileElementsView

* Move TileElementsView code into TileElementsView.h

* Cleanup code and move into OpenRCT2 namespace

* Use reference instead of pointer

* Fix include

* Make GCC happy

* Move the cast functions into base

* Use the cast function instead of reinterpret_cast

* Add TileElementsView tests

* Fix iterating on TileElementBase, return pointer not reference
2021-02-04 18:58:45 +02:00
Michael Steenbeek d3a4c16270 Reserve room for tile owner 2021-01-29 16:56:33 +01:00
Michael Steenbeek 20f959c833 Use track_type_t in more places 2021-01-22 11:33:55 +01:00
Michael Steenbeek bf63a562ae Fix #11438: Crash when decreasing map size 2021-01-12 22:04:22 +01:00
ζeh Matt a6080b7996 Refactor code to dynamically add and remove viewports (#13687) 2021-01-07 19:06:49 +00:00
Michael Steenbeek abd7babc86 Get RTD from ride via a struct method, part 1 2020-12-12 22:53:50 +01:00
Adamandduncanspumpkin f09b14ef2b Split actions hpp files into separate h and cpp files (#13548)
* Split up SmallSceneryPlace/Remove

Added undo function for Remove Scenery

* Refactor: Balloon and Banner actions hpp=>h/cpp

* Refactor: rename all action *.hpp files to *.cpp

This is preparation for separation in later commits. Note that without
the complete set of commits in this branch, the code will not build.

* Refactor Clear, Climate, Custom, and Footpath actions hpp=>h/cpp

* VSCode: add src subdirectories to includePath

* Refactor Guest actions hpp=>h/cpp

* Refactor Land actions hpp=>h/cpp

* Refactor LargeScenery actions hpp=>h/cpp

* Refactor Load, Maze, Network actions hpp=>h/cpp

* Refactor Park actions hpp=>h/cpp

* Refactor/style: move private function declarations in actions *.h

Previous action .h files included private function declarations with
private member variables, before public function declarations. This
commit re-orders the header files to the following order:
- public member variables
- private member variables
- public functions
- private functions

* Refactor Pause action hpp=>h/cpp

* Refactor Peep, Place, Player actions hpp=>h/cpp

* Refactor Ride actions hpp=>h/cpp

* Refactor Scenario, Set*, Sign* actions hpp=>h/cpp

* Refactor SmallScenerySetColourAction hpp=>h/cpp

* Refactor Staff actions hpp=>h/cpp

* Refactor Surface, Tile, Track* actions hpp=>h/cpp

* Refactor Wall and Water actions hpp=>h/cpp

* Fix various includes and other compile errors

Update includes for tests.
Move static function declarations to .h files
Add explicit includes to various files that were previously implicit
(the required header was a nested include in an action hpp file, and the
action .h file does not include that header)
Move RideSetStatus string enum to the cpp file to avoid unused imports

* Xcode: modify project file for actions refactor

* Cleanup whitespace and end-of-file newlines

Co-authored-by: duncanspumpkin <duncans_pumpkin@hotmail.co.uk>
2020-12-10 06:39:10 +00:00
ζeh Matt 645289f4ec Rename GameActionResult and use GameActions namespace instead (#13184) 2020-10-14 22:04:39 -03:00
Julia Pinheiro cba1d48226 Close #12408: Refactor CURSOR_ID to use strong enum 2020-10-11 18:01:14 +02:00
Simon Jarrett 52209af94d Rename TRACK_ELEM_* enums to TrackElemType::*
- Replace enum in Track.h with namespace and constexpr
- Find and replace all instances of TRACK_ELEM_* enums
2020-10-01 19:57:52 +01:00
Aaron van Geffen 7b5087f057 Update copyright year to 2020 2020-07-21 15:04:34 +02:00
Helio Nunes Santos 2812be8c9a Close #12252: remove of goto in function wall_remove_at (#12279)
* Removed use of goto in function wall_remove_at
* Implemented overload of function map_get_wall_element_at
2020-07-16 17:52:45 -03:00
frutiemax 14a07359b3 Part of #11389: Use formatter class for Ride::FormatNameTo (#12041) 2020-06-24 21:02:08 -03:00
Duncan bb34213b93 MapCanConstructAt refactor (#11977)
* Start using MapCanConstructAt

* Fix #11675. Pass the full error message arguments on peep pickup

This was causing a crash as the error message arguments were being cleared which would mean eventually a nullptr dereference would happen.
2020-06-17 22:35:13 +01:00
Sohil Adwaniandduncanspumpkin 03f016e9ef Smart pointers (#11852)
* Part of #11159 Added smart pointers to a few functions

* Use camelCase for variables

Co-authored-by: duncanspumpkin <duncans_pumpkin@hotmail.co.uk>
2020-06-15 19:47:07 +01:00
Michael Steenbeek 1ea1d24f00 Use constant for 255 tile element height (#11928) 2020-06-10 23:18:26 +02:00
Gymnasiast 09cc95f536 Move remaining calls to set_format_arg() 2020-06-03 14:49:04 +02:00
Hummel95 aac55d2cc0 Fix #10876: Peeps spawns can stack and are not removable (#11155) 2020-05-09 16:17:08 +02:00
Michael Steenbeek f3c0476673 Create constants for both tile element limits (#11645) 2020-05-05 15:40:33 +02:00
Ted John e1c08defc8 Remove use of std::variant 2020-04-26 14:35:07 +01:00
Ted John 83fe0cf5c5 Implement strings for GameAction errors 2020-04-26 14:35:05 +01:00
Ted John 32d72471b8 Add more tile APIs 2020-04-26 14:35:04 +01:00
Michał Janiszewski 2323cc1596 Use named casts instead of old-style casts
Change prepared with clang-tidy and google-readability-casting check
2020-04-22 17:09:29 +02:00
Michał Janiszewski c4b6897635 Address possible nullptr dereferences 2020-04-21 13:31:01 +02:00
Michael Steenbeek 8127437de1 Reduce direct ride type checking; move available piece lookup to RTD (#11353) 2020-04-19 13:32:43 +02:00
Olivier Wervers b71062ce1b Fix #6530: Make land tools work consistently on park borders (#11181)
Makes all land tools behave the same
2020-04-18 08:19:03 -03:00
Tulio Leao 64e4a8420e Use named casts on openrct2/world (#11141) 2020-04-17 21:08:22 +02:00
Gymnasiast 5dc4b3e136 Make tile_element_insert take CoordsXYZ 2020-03-07 21:28:36 +01:00
Michael Steenbeek be13c1fc87 Refactor more TileCoords 2020-03-07 21:07:18 +01:00
Gymnasiast 3ed7694495 Move tile element-specific flags 2020-03-04 22:01:09 +01:00
Gymnasiast 57a40c0657 Extend PathElement 2020-03-04 21:57:42 +01:00
Matt 758a7e432f Use const reference instead of copy for location structures 2020-02-13 11:53:14 +01:00
Michael Steenbeek d16fbb0cd2 Change ride->overall_view to CoordsXY (#10673) 2020-02-08 17:19:59 +01:00
Michael Steenbeek 5da4903430 Fix #10629: Footpaths on the ground do not cost money (#10671) 2020-02-08 16:29:14 +01:00
Ted John 1e6bf84796 Do not log element out of range as error (#10641)
Many routines will attempt to access tile elements outside the range of the map. This can happen for example when a routine is observing surrounding tiles of a piece of track that is near the edge of the map. Null is returned from the function which is handled by the routine, so not really an error and can reduce many bounds checking in callers.
2020-02-01 20:44:57 +00:00
Tulio Leao b7e9b36a27 Prefer std::array and COORDS defines on Map::CoordsDirectionDelta 2020-01-19 13:30:29 -03:00
Michael Steenbeek d798811c4a Make GetWaterHeight return big Z (#10579)
* Make GetWaterHeight return big Z

* Restore > 0 [ci skip]
2020-01-19 15:12:48 +00:00
Duncan 8abb9e5515 Fix obstructions not stopping ride placement (#10585) 2020-01-19 15:12:26 +00:00
Duncan 0702808692 Use a game action result for clear at function (#10576)
* Use a game action result for clear at function

* Clean up callers of set_error_text

* Make it compile

* Make suggested changes

* fix compile

* Fix nullptr deref
2020-01-19 13:14:37 +00:00
Tulio Leao ac063a7e9a Use CoordsXY on footpath_update_path_wide_flags() 2020-01-14 07:33:43 -03:00
Michael Steenbeek 44dc2068e7 Merge pull request #10515 from tupaschoal/use-more-coords-4
Use CoordsXY* on world/Footpath.cpp
2020-01-11 20:52:39 +01:00
Tulio Leao 7cf03d3e41 Use CoordsXY on footpath_remove_edges_at() 2020-01-11 11:13:04 -03:00
Michael Steenbeek 08ab15ef36 Fix #10313: Path furniture can be placed on level crossings 2020-01-05 17:59:02 +01:00
Michael Steenbeek 63da894257 Merge pull request #10511 from tupaschoal/improve-clear-at
Improve variable names in map_can_construct_with_clear_at() and use big Z
2020-01-04 19:57:46 +01:00
Tulio Leao d3579e472b Use Big Z coordinates for map_can_construct_with_clear_at() vars 2020-01-04 10:31:18 -03:00
Tulio Leao dff747ce0f Improve variable names in map_can_construct_with_clear_at() 2020-01-04 10:27:57 -03:00
Tulio Leao d861658669 Use CoordsXY on Scenery and SmallScenery (#10513) 2020-01-04 12:45:51 +01:00
Tulio Leao 06fb16ee88 Use CoordsXYZ for gMapSelectArrowPosition (#10442) 2019-12-30 16:51:35 +00:00