Commit Graph

107 Commits

Author SHA1 Message Date
Hielke Morsink 30506c7a35
Use ScreenCoordsXY and ScreenSize structs for main toolbar 2021-10-23 11:22:43 +02:00
Hielke Morsink 9dd20ec619
Improve array formatting
For most of these cases, adding a trailing comma to the array block makes clang-format put each item on a new line, and clang-format exception blocks could be reduced where clang-format does not handle them properly.
2021-10-17 18:21:45 +02:00
Michał Janiszewski 1b4875e528 Extract math-related functions from common.h to Math.hpp
Saves wide inclusion of <stdexcept> header, which pulls in <string>
2021-10-09 21:43:06 +02:00
Hielke Morsink 4b4b3333d6
Remove unnecessary else blocks 2021-09-16 18:31:12 +02:00
Michael Steenbeek 624a32e93b
Make Coords isNull/setNull functions TitleCase (#15382) 2021-09-08 20:48:53 -03:00
ζeh Matt eccbbdbe59
Use inline for direction functions in Location.hpp 2021-08-25 00:07:25 +02:00
ζeh Matt 55add9883f
Implement DirectionFlipXAxis 2021-08-24 22:57:13 +02:00
ZehMatt c858f21845
Default initialize members the same way across the file 2021-08-23 14:41:18 +03:00
ZehMatt 07ceec6b60
Make all location types constexpr 2021-08-23 14:35:58 +03:00
ZehMatt b7b3418b75
Fix setNull on inherited classes leaving uninitialized variables 2021-07-27 21:34:53 +03:00
ZehMatt b9ec5d079e
Add construction of TileCoordsXYZD with TileCoordsXYZ 2021-07-27 19:57:45 +03:00
Michael Steenbeek 8e01bd46ce
Remove LocationXY(Z)16 (#14834) 2021-06-07 17:44:38 +02:00
Matt a2ebec8676
Add multiply and divide to coordinate components 2021-02-21 09:52:32 +02:00
duncanspumpkin f6d2db48dc Name 98196C 2020-11-07 14:15:25 +00:00
Richard Fine a1222fa4ca
Staff code cleanup (#12907)
* Make UpdateFixing*() methods use const where possible

To make it clearer which steps actually modify the ride being fixed and which do not, pass const Ride* instead of Ride* where possible.

* Extract maximum litter search distance to a constant

* Make peep_update_*() methods return bool

* Use Direction type and helpers where applicable

* Const correctness and other cleanup

Make many functions take a const Peep* / const Staff* to clarify that they do not modify the peep being passed in. Also use the Direction type for some return values, and simplify staff_is_location_on_patrol_edge.

* Use clearer expression of constant value

Co-authored-by: Michael Steenbeek <m.o.steenbeek@gmail.com>

* Convert staff functions to members

* Remove AsStaff const overload

* Use As<Staff>() instead of static_cast

* Simplify direction selection code

* Clean up use of magic constants

Co-authored-by: Michael Steenbeek <m.o.steenbeek@gmail.com>
2020-09-27 21:07:09 -03:00
Arran Ireland 89e4714198
Close #12331: Use CoordsXY in track_remove_station_element (#12609)
* Update track_remove_station_element signature

Part of #12331: This commit will update the
signature of track_remove_station_element and
its callers, to use CoordsXYZD.

* Fix track_remove_station_element local vars

Part of #12331: This commit will ensure that
references to the previous arguments in
track_remove_station_element will now use the new
CoordsXYZD argument.

* Refactor remove in track_remove_station_element

Part of #12331: This commit refactors the removeX/Y
to use CoordsXY.

* Refactor station0 in track_remove_station_element

Part of #12331: This commit will refactor stationX/Y0
to use CoordsXY.

* Close #12331 track_remove_station_element refactor

This commit refactors stationX/Y1 to use CoordsXY,
and fixes the smallZ vs bigZ problem in callers of
track_remove_station_element. These are the final
changes for this issue.

* Added operator for CoordsXYZD minus CoordsXY.

This commit adds a missing operator for subtracting
a CoordsXY from a CoordsXYZD. This was needed for
refactoring Track.cpp

* Refactor track_remove_station_element Coord use

This commit utilises the overloaded operators for
Coords and ensures that they are used so that the
function implementation is more readable.

* Close #12331 track_remove_station_element refactor

This commit also fixes a bug in which a small Z
value (the Height of a RideStation) was being
updated with a big Z value without scaling. It
adds a few extra refactors in calls of the
track_remove_station_element function, and
changes the contributors to add ion232.
2020-08-09 07:25:44 +01:00
Aaron van Geffen 7b5087f057
Update copyright year to 2020 2020-07-21 15:04:34 +02:00
Tulio Leao d10b615eb3
Remove assert on ScreenLine (#12333)
Code is not always constructing a valid line
2020-07-20 18:49:15 -03:00
Helio Santos b0a4f2a97e Part of #12159: updated get_station_platform to use CoordsXYRangedZ
Updated get_station_platform function to use CoordsXYRangedZ. Updated caller(s) accordingly. Implemented constructor for CoordsXYRangedZ that takes a CoordsXYZ as argument.
2020-07-10 10:59:52 -07:00
Tulio Leao f725fff2da
Clarify CoordsRange-derived interface methods (#12127) 2020-07-06 14:42:11 +02:00
Tulio Leao 99b39f04e7
Do not try to force dimensions of a rectangle (#12115) 2020-07-03 09:28:30 +02:00
Tulio Leao b5195f77c4 Reuse Rectangle definitions for ScreenRect and MapRange 2020-06-30 09:44:28 -03:00
Tulio Leao a86a60cbf5 Extract ScreenRect from Graph for reusability 2020-06-30 09:32:22 -03:00
Tulio Leao 5ce65eb7dc Create ScreenLine struct 2020-06-30 09:26:42 -03:00
Tulio Leao 70e245a1c3 Add Coords constructor to Map and CoordsRange 2020-06-30 09:12:14 -03:00
Tulio Leao 701f7f6d67 Extract base CoordsRange class from MapRange
Enforce MapRange to be rectangle shaped
2020-06-30 09:00:20 -03:00
Michael Steenbeek 511a300251
Some cleanup in Vehicle.cpp (#11742) 2020-05-13 11:51:38 +02:00
Duncan 79dda7260a
Fix #11695. Mechanics walking to 0,0 on entrance only (#11704)
Mistake made when refactoring that meant that null locations were converted into tile 0, 0. I've fixed the general case but it is preferred to try avoid using null states for coordinates if at all possible.
2020-05-11 20:28:40 +02:00
Michael Steenbeek d7637cd70f
Replace many C-style casts (#11720) 2020-05-11 14:32:56 +02:00
Ted John 096de3ccc8 Implement list view 2020-05-09 17:24:15 +01:00
duncanspumpkin 54a058ca6c Fix boat location import/export/update.
After a refactoring to split off the boat location the import/export functions meant incorrect information could be loaded into the s6 file for boats that had not left the station. Boats that had left the station had other fields clobbered for the same reason
2020-04-07 20:19:26 +01:00
Gymnasiast bdf681f440
Clean up many other coordinates 2020-03-13 12:03:43 +01:00
Michael Steenbeek e1427df59f
Fix #10899: Position of money animation is incorrect (#10903) 2020-03-09 15:00:13 +01:00
Michael Steenbeek be13c1fc87
Refactor more TileCoords 2020-03-07 21:07:18 +01:00
Tulio Leao 8b36cce37c Make _lastMainViewport use ScreenCoordsXY 2020-03-02 20:51:01 -03:00
Tulio Leao 09fad0ef7f Change rct_viewport to use ScreenCoordsXY 2020-03-02 20:50:58 -03:00
Michael Steenbeek 61175a4fbf
Confine use of LocationXY8 to RCT12 load/save code (#10698) 2020-03-01 21:16:10 +01:00
Michael Steenbeek f41f878581
Replace some usages of LocationXY(Z)16 (#10699) 2020-02-18 22:42:38 +01:00
Tulio Leao 0c4623a39f
Replace typedef aliasing by using (#10712) 2020-02-17 11:43:47 +01:00
Matt 758a7e432f
Use const reference instead of copy for location structures 2020-02-13 11:53:14 +01:00
Duncan b8b539c16e
Modify next_x/y/z to become a CoordsXYZ (#10680)
* Modify next_x/y/z to become a CoordsXYZ

Should be further scope for refactoring from this.

* Make suggested changes

* Fix default construct issues
2020-02-11 22:01:14 +00:00
Tulio Leao 7cf03d3e41 Use CoordsXY on footpath_remove_edges_at() 2020-01-11 11:13:04 -03:00
Gymnasiast 1133a8c81c
Remove sLocationXY8 2019-12-30 23:03:13 +01:00
Michael Steenbeek 77494bbc73 Create definitions for some coords related stuff (#10456)
* Create definitions for some coords related stuff

* Use constexpr; add define for Z step
2019-12-30 15:03:51 +00:00
Michael Steenbeek 4b0dff92aa
Name word_981D6C (#10471) 2019-12-30 12:29:08 +01:00
Tulio Leao 98110c0544 Make Map::map_invalidate*() use CoordsXY (#10437)
* Make Map::map_invalidate_element() use CoordsXY

* Make Map::map_invalidate_tile_full() use CoordsXY

* Make Map::map_invalidate_tile_zoom0() use CoordsXY

* Make Map::map_invalidate_tile_zoom1() use CoordsXY

* Make Map::map_invalidate_tile() use CoordsXY

* Use CoordsXYRangedZ for map invalidation

* Fix vehicle tile invalidation use Z instead of Y coord

* Fix BannerRemoveAction sending Z TileCoords to invalidate tile

* Fix wrong tile invalidation on peep_update_walking_break_scenery

* Prefer ToTileStart over bitwise and
2019-12-28 08:44:33 +00:00
Michael Steenbeek d0744df22f
Merge pull request #10443 from tupaschoal/reduce-locationxy
Remove LocationXY usage on windows and actions
2019-12-27 15:58:26 +01:00
Michael Steenbeek 64f7cac6d6
Create getters for station height and start (#10453) 2019-12-27 15:57:40 +01:00
Tulio Leao 109a90269c Prefer setNull/isNull on TopToolbar over LOCATION_NULL 2019-12-27 09:52:31 -03:00
Tulio Leao 6c998d7b4d Make Map::map_get_track_element_at() use CoordsXYZ 2019-12-24 11:19:03 -03:00