Commit Graph

94 Commits

Author SHA1 Message Date
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
Tulio Leao a2c7ecc6e5 Make Map::map_get_first_element_at() use CoordsXY (#10413)
* Make Map::map_get_first_element_at() use CoordsXY

* Fix clang-format on ClearAction.hpp

* Prefer TileDIrectionDelta over hardcoded delta on RideConstruction

* Use named Direction constants

* Make Compat::map_get_first_element_at() use CoordsXY
2019-12-23 07:35:41 +00:00
Duncan 96ff8fe7a1 Change value of COORDS_NULL to a less likely to collide value. (#10423)
It will also now match LOCATION_NULL. As this change should only affect in memory coords there should be no save, replay, network issues.
2019-12-22 14:03:32 +01:00
Michael Steenbeek c2565bfe1c
Merge pull request #10407 from duncanspumpkin/refactor_stations
Fixing COORDS_NULL: Refactor stations
2019-12-21 16:13:48 +01:00
Gymnasiast dcc720c1ec
Remove MakeXY16() 2019-12-21 13:51:59 +01:00
duncanspumpkin b3dafc64c3 Refactor to improve readability as per suggestions 2019-12-21 12:12:10 +00:00
duncanspumpkin 45403ac2d3 Move station_starts to TileCoordsXY 2019-12-21 11:48:13 +00:00
Michael Steenbeek a2b9598341
Modify code using Location8 to use isNull()/setNull() (#10403) 2019-12-21 11:34:46 +01:00
Tulio Leao 780e3265d1 Standardize Coords and TileCoords objects 2019-12-20 08:29:42 -03: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
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
Tulio Leao aea755bd70 Allow TileCoordsXYZD to generate CoordsXYZD equivalent 2019-12-19 00:11:26 -03:00
Tulio Leao 5c657bde9f Remove map_get_surface_element_at operating with TileCoordsXY 2019-12-18 23:47:17 -03: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