Commit Graph

847 Commits

Author SHA1 Message Date
Tulio Leao 57a2dab064
Rename Peep::NoActionFrameNum to WalkingFrameNum 2020-06-04 19:16:25 +02:00
Tulio Leao c9f071a766
Rename Peep::TimeOnRide to GuestTimeOnRide 2020-06-04 19:16:25 +02:00
Tulio Leao ce952961b9
Rename Peep::PeepIsLostCountdown to GuestIsLostCountdown 2020-06-04 19:16:24 +02:00
Tulio Leao fabdb8cdef
Rename Peep::path_check_optimisation to PathCheckOptimisation 2020-06-04 19:16:24 +02:00
Tulio Leao 6dc08afdd0
Rename Peep:staff_id to StaffId 2020-06-04 19:16:24 +02:00
Tulio Leao d05e5f8dc7
Rename Peep::guest_heading_to_ride_id to GuestHeadingToRideId 2020-06-04 19:16:12 +02:00
Tulio Leao 9fbaf61e07
Rename Peep::staff_orders to StaffOrders 2020-06-04 19:16:12 +02:00
Tulio Leao 480009c0f6
Rename Peep::peep_is_lost_countdown to PeepIsLostCountdown 2020-06-04 19:16:11 +02:00
Tulio Leao 7357eeca60
Rename Peep::photo1_ride_ref to Photo1RideRef 2020-06-04 19:16:11 +02:00
Tulio Leao a2a0fad886
Rename Peep::peep_flags to PeepFlags 2020-06-04 19:16:11 +02:00
Tulio Leao 53bff03a3f
Rename Peep::pathfind_goal to PathfindGoal 2020-06-04 19:16:11 +02:00
Tulio Leao cad809275e
Rename Peep::pathfind_history to PathfindHistory 2020-06-04 19:16:11 +02:00
Tulio Leao f2808eecbe
Rename Peep:no_action_frame_num to NoActionFrameNum 2020-06-04 19:16:11 +02:00
Tulio Leao 0933cd4e57
Rename Peep::litter_count to LitterCount 2020-06-04 19:16:11 +02:00
Tulio Leao 7665d1386f
Rename Peep:time_on_ride to TimeOnRide 2020-06-04 19:16:11 +02:00
Tulio Leao 0e170d40d4
Rename Peep::staff_mowing_timeout to StaffMowingTimeout 2020-06-04 19:16:11 +02:00
hdpoliveira a1be45d0b7
#9473: Create Vehicle::UpdateFlag (#11850) 2020-06-01 08:35:30 -03:00
Tulio Leao e18abc7e3d Rename NoOf... to AmountOf... on Peep 2020-05-31 09:13:56 -03:00
Tulio Leao 0c502988ef Rename Peep::disgusting_count to DisgustingCount 2020-05-30 20:35:06 -03:00
Tulio Leao a987a9ee5e Rename Peep::paid_to_enter to PaidToEnter 2020-05-30 20:35:06 -03:00
Tulio Leao 07f36a93de Rename Peep::staff_lawns_mown to StaffLawnsMown 2020-05-30 20:35:05 -03:00
Tulio Leao 133ff992b6 Rename Peep::staff_rides_fixed to StaffRidesFixed 2020-05-30 20:35:05 -03:00
Tulio Leao 3f091d33e2 Rename Peep::paid_on_rides to PaidOnRides 2020-05-30 20:35:05 -03:00
Tulio Leao 719607f876 Rename Peep::staff_gardens_watered to StaffGardensWatered 2020-05-30 20:35:05 -03:00
Tulio Leao 6b56a353f9 Rename Peep::staff_rides_inspected to StaffRidesInspected 2020-05-30 20:35:05 -03:00
Tulio Leao 414cff9b91 Rename Peep::paid_on_food to PaidOnFood 2020-05-30 20:35:05 -03:00
Tulio Leao 5bd3e88972 Rename Peep::staff_litter_swept to StaffLitterSwept 2020-05-30 20:35:05 -03:00
Tulio Leao c2f7efa328 Rename Peep::paid_on_souvenirs to PaidOnSouvenirs 2020-05-30 20:35:05 -03:00
Tulio Leao 7d581e6978 Rename Peep::staff_bins_emptied to StaffBinsEmptied 2020-05-30 20:35:04 -03:00
Tulio Leao a729ac1589 Rename Peep::no_of_food to NoOfFood 2020-05-30 20:35:04 -03:00
Tulio Leao bc7ea40c4b Rename Peep::no_of_drinks to NoOfDrinks 2020-05-30 20:35:04 -03:00
Tulio Leao 625f7859a4 Rename Peep::no_of_souvenirs to NoOfSouvenirs 2020-05-30 20:35:04 -03:00
Tulio Leao fc1ba40dc8 Rename Peep::vandalism_seen to VandalismSeen 2020-05-30 20:35:04 -03:00
Tulio Leao fd71b1b009 Rename Peep::voucher_type to VoucherType 2020-05-30 20:35:04 -03:00
Tulio Leao bf228abf55 Rename Peep::voucher_arguments to VoucherArguments 2020-05-30 20:35:03 -03:00
Gymnasiast 9a9ab47856
Remove Twitch from the rest of the code 2020-05-28 09:28:32 +02:00
tylerleamon 51872f9741
Fix #10634: Guests are unable to use uphill paths out of toilets
Co-authored-by: duncanspumpkin <duncans_pumpkin@hotmail.co.uk>
2020-05-22 19:58:38 +02:00
Ted John b710e417df Split peep into guest and staff and add more fields 2020-05-14 18:35:21 +01:00
Tulio Leao c17aa095d5 Rename Peep::surrounding_thought_timeout > SurroundingsThoughtTimeout 2020-05-13 23:28:16 -03:00
Tulio Leao 32c8e5614f Rename Peep::angriness to Angriness 2020-05-13 23:25:09 -03:00
Tulio Leao 589a7a48be Rename Peep::time_lost to TimeLost 2020-05-13 23:22:08 -03:00
Tulio Leao a216cb9930 Rename Peep::days_in_queue to DaysInQueue 2020-05-13 23:19:41 -03:00
Tulio Leao 128c1993c1 Rename Peep::balloon_colour to BalloonColour 2020-05-13 23:16:43 -03:00
Tulio Leao 6c57f33dc9 Rename Peep::umbrella_colour to UmbrellaColour 2020-05-13 23:14:45 -03:00
Tulio Leao 222f8df6cb Rename Peep::hat_colour to HatColour 2020-05-13 23:11:28 -03:00
Tulio Leao 3b632fcf95 Rename Peep::favourite_ride to FavouriteRide 2020-05-13 23:06:40 -03:00
Tulio Leao 7a6de648fe Rename Peep::favourite_ride_rating to FavouriteRideRating 2020-05-13 23:03:58 -03:00
Tulio Leao 14e0cc5e4a Rename Peep::item_standard_flags to ItemStandardFlags 2020-05-13 23:01:03 -03:00
Michael Steenbeek f0bd05cf6d
Part of #11158: Remove more C-style casts (#11743) 2020-05-13 21:22:50 -03:00
Gymnasiast ae194192d6
Clean up calls to MoveTo 2020-05-13 10:47:33 +02:00
Gymnasiast 11472f909d
Convert sprite_move to method 2020-05-13 10:47:32 +02:00
Gymnasiast 15b5d97795
Refactor shop items 2020-05-11 19:16:23 +02:00
Michael Steenbeek a261b4ce33
Remove commented out code (#11721) 2020-05-11 13:54:15 +02:00
Ted John 7b8ffdb865 Refactor peep.intensity into new strict struct 2020-05-09 12:37:51 +01:00
Tulio Leao 28b3ac1693 Make track_block_get_previous() use CoordsXYE 2020-05-02 11:07:18 -03:00
Duncan 32eb7071a1
Fix #11550: Use std::nullopt instead of empty brace (#11595)
This is technically a gcc bug from the looks of it but since std::nullopt is slightly easier to read I've gone through the codebase and used that over empty braces. In addition noticed a mistake on the scripting viewport get widgetIndex function where it would return an incorrect widgetIndex.
2020-05-02 10:09:12 +02:00
hdpoliveira e8c95e6e3a Part of #9473: Create Vehicle::IsUsedInPairs
Converted from vehicle_is_used_in_pairs
2020-05-01 19:49:01 -03:00
Gymnasiast cc65564521
Use (RCT12)ObjectEntryIndex in more places 2020-05-01 22:06:13 +02:00
duncanspumpkin fed148648c Use IsPeep in more places 2020-04-28 07:57:47 +01:00
duncanspumpkin 5b07a76f05 Use sprite_identifier when identifying entitys
The linked list index is only meant to be used for accessing the linked lists. Using the wrong variable is unlikely to cause issues for this exact case but it makes things cleaner.
2020-04-27 18:47:51 +01:00
Gymnasiast e67ebed697
Remove some Americanisms 2020-04-26 11:07:19 +02:00
Breno Rodrigues Guimarães ab53ddf59f Avoid fast-forwarding peep into the ride
The code being removed in the patch tries to fast forward a peep into the ride when it is the second peep for a vehicle that is used in pairs. Problem is that funds checking does not happen, so it happens that a peep may pay against its will.
Lets say a rich peep enters in line and a poor peep enters in line right after.
If the price of the ride is such that the rich peep can pay and the poor peep can't, it will be dragged into the ride because funds checking only happened for the first.
The second part of the patch just adjusts we consider the vehicle a full car if the second position is filled.

Add test to verify that a peep is not dragged into a ride it can't pay

This test puts two peeps in a Ferris Wheel. The first peep is rich and the second peep is poor. When they are both in line, the ride price is raised so that the poor peep can't pay.
Make sure the poor peep turns back and leaves the ride.

During development, a mistake in the logic would have broken all rides other than ferris wheels in a way that multiple guests could enter the same car.
Also add a test to make sure that is never broken.
2020-04-25 18:27:33 -03:00
Michael Steenbeek 44f62a97c2
Move PhotoItem to RTD (#11415) 2020-04-24 04:47:40 +02:00
Breno Rodrigues Guimarães c0d0c7de16
Part of #11389: Replace set_format_arg by Formatter::Common() (#11388) 2020-04-22 21:41:20 -03:00
Mustapha Elghoul b138cb46ba
Name Flags in PeepThoughtToActionMap 2020-04-22 18:50:53 +02: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
Breno Rodrigues Guimarães 374b744477
Use Formatter to handle argument formatting for tooltips (#11379) 2020-04-21 12:38:59 +02:00
Breno Rodrigues Guimarães 2479256bc1
Adjust Formatter function names according to coding style (#11378) 2020-04-20 18:55:15 -03:00
Breno Rodrigues Guimarães d4a2a98e20
Replacing set_format_arg_on macro in favor of a more C++zy solution (#11350) 2020-04-20 07:10:33 +02:00
duncanspumpkin b81f6d0bed Fix crash caused by bad pointers 2020-04-18 11:41:05 +01:00
duncanspumpkin f9ae3dd980 Make review changes 2020-04-18 10:34:41 +01:00
ThomasZ 401504aff9 Fix #11075: SpriteListHead Refactor
Refactor "for (spriteIndex = gSpriteListHead[SPRITE_LIST_PEEP]; spriteIndex != SPRITE_INDEX_NULL; spriteIndex = nextSpriteIndex)" like for loops across files with replacing them by FOR_ALL_PEEPS(sprite_index, peep). The same for FOR_ALL_STAFF, FOR_ALL_GUESTS where necessary.

modify incorrect codestyle

modifying incorrect codestyle of the first attempted PR of issue 11075 (missing space after FOR_ALL_GUEST, FOR_ALL_STUFF ...)

modify codestyle further

Forgot to add one more space, correcting it.

another codestyle correction

apparently there is someting wrong with src/openrct2/peep/Peeps.cpp adding a newline after i = 0;

event further modifying codestyle

changing i = 0; to int i = 0;

another codestyle modification, at this point just trying to pass CI clang

adding another newline

another modification
2020-04-18 10:31:02 +01:00
Gymnasiast edd31d9f16
Move flags to RideTypeDescriptors 2020-04-17 17:03:33 +02:00
Michał Janiszewski a197e529e8
Fix #6238: Invalid tile elem iteration in Guest::UpdateUsingBin (#11248) 2020-04-08 01:03:02 +02:00
Michael Steenbeek 3a47e3b309 Fix #11166: Null pointer read in Guest::UpdateRideAdvanceThroughEntrance (#11182) 2020-04-06 22:32:27 +02:00
Michał Janiszewski 971db142a5 Revert "Fix #11166: Null pointer read in Guest::UpdateRideAdvanceThroughEntrance (#11182)"
This is being reverted now that we have replay records uploaded as part
of the backtrace.io information to try figuring out the root cause.

This reverts commit 598b85d0ca.
2020-04-03 09:51:32 +02:00
Michael Steenbeek 598b85d0ca
Fix #11166: Null pointer read in Guest::UpdateRideAdvanceThroughEntrance (#11182) 2020-04-01 12:45:08 +02:00
Duncan 2806104db0
Remove peep sort (#11088)
* Remove peep sort. No longer required.

Peeps are now only sorted in a temporary vector when the staff or guest list is open. This allows for simpler allocation of sprites

* Increment Network Version
2020-03-28 12:37:01 +00:00
Michael Steenbeek cfb405f0ed
Use StationIndex in many more places (#10992) 2020-03-26 21:38:26 +01:00
Michael Steenbeek 81c6bb26e9
Prepare guest counters for more than 32767 guests (#10989) 2020-03-26 20:02:15 +01:00
Duncan 40160892a9
Rework GuestList to use a vector. (#11014)
* Rework GuestList to use a vector.

This is part of a chain of refactors that will be used to rework peep order in the sprite list

* Apply comments. Remove setting var_492 as no longer required
2020-03-26 07:23:30 +00:00
Ted John d34dec9c27 Create ZoomLevel struct to add two new zoom levels 2020-03-23 15:54:03 +00:00
Gymnasiast 2f7a26e8da
Refactor station index a bit 2020-03-21 17:05:16 +01:00
Michael Steenbeek fd91c41a76
Name remaining ride type flags (#10947) 2020-03-16 22:52:06 +01:00
Gymnasiast bdf681f440
Clean up many other coordinates 2020-03-13 12:03:43 +01:00
Gymnasiast 3412c47a9e
Convert some Guest functions to methods 2020-03-13 10:50:22 +01:00
Michael Steenbeek 9b5e8140f9
Fix #10919: Crash when assertion fails in heavily damaged park (#10921) 2020-03-13 10:35:03 +01:00
Gymnasiast 02c135e4fa
Clean up many staff functions 2020-03-07 23:07:47 +01:00
Michael Steenbeek be13c1fc87
Refactor more TileCoords 2020-03-07 21:07:18 +01:00
Michael Steenbeek 904cad77b5
Merge pull request #10864 from Gymnasiast/refactor/station-starts
Change station starts to CoordsXY
2020-03-05 22:48:53 +01:00
Gymnasiast dcf4301559
Use constant for invalid direction 2020-03-05 18:27:36 +01:00
Gymnasiast 2eb967b30d
Change station start to CoordsXY 2020-03-05 12:29:02 +01:00
Tulio Leao 09fad0ef7f Change rct_viewport to use ScreenCoordsXY 2020-03-02 20:50:58 -03:00
Michael Steenbeek d5c4d78d49
Move vehicle track location to CoordsXYZ (#10856)
* Move vehicle track location to CoordsXYZ

Co-authored-by: Tulio Leao <tupaschoal@gmail.com>
2020-03-01 15:45:51 -03:00
Tulio Leao 2da96e8cfc Revert to copy instead of const-ref for functions that edit content 2020-03-01 09:57:03 -03:00
Tulio Leao 475eed0a56 Receive CoordsXY by const ref instead of copy 2020-02-29 01:16:19 -03:00
Tulio Leao b9186f4b0b Receive TileCoordsXYZ by const ref instead of copy 2020-02-29 01:16:16 -03:00
Tulio Leao 181eaf768d Receive CoordsXYZ by const ref instead of copy 2020-02-29 01:14:05 -03:00
Michael Steenbeek f41f878581
Replace some usages of LocationXY(Z)16 (#10699) 2020-02-18 22:42:38 +01:00
Michał Janiszewski d3db4f5cf8
Fix GCC10 warnings (#10703)
The warnings reported were:
```
../src/openrct2/peep/GuestPathfinding.cpp: In function ‘Direction peep_pathfind_choose_direction(TileCoordsXYZ, Peep*)’:
../src/openrct2/peep/GuestPathfinding.cpp:1371:81: error: ‘void* memset(void*, int, size_t)’ writing to an object of non-trivial type ‘struct<unnamed>’; use assignment instead [-Werror=class-memaccess]
 1371 |             std::memset(_peepPathFindHistory, 0xFF, sizeof(_peepPathFindHistory));
      |                                                                                 ^
../src/openrct2/peep/GuestPathfinding.cpp:35:1: note: ‘struct<unnamed>’ declared here
   35 | {
      | ^

../src/openrct2/world/Sprite.cpp: In function ‘void reset_sprite_list()’:
../src/openrct2/world/Sprite.cpp:152:52: error: ‘void* memset(void*, int, size_t)’ clearing an object of non-trivial type ‘union rct_sprite’; use assignment or value-initialization instead [-Werror=class-memaccess]
  152 |     std::memset(_spriteList, 0, sizeof(_spriteList));
      |                                                    ^
In file included from ../src/openrct2/world/Sprite.cpp:10:
../src/openrct2/world/Sprite.h:117:7: note: ‘union rct_sprite’ declared here
  117 | union rct_sprite
      |       ^~~~~~~~~~
```
2020-02-18 00:00:19 +01:00
Michael Steenbeek 6d97601d6f
Replace hardcoded occurrences of maximum map size (#10696) 2020-02-13 20:27:13 +01:00
Matt c381d9ff3f
Remove obsolete construction of CoordsXY object 2020-02-13 12:11:20 +01:00
Matt 758a7e432f
Use const reference instead of copy for location structures 2020-02-13 11:53:14 +01:00
Michael Steenbeek e53d76ae2e
Fix errors in #10680 (#10692) 2020-02-12 23:11:04 +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
Gymnasiast ca2f37ae7f
Remove opt::optional polyfill
std::optional is supported by Xcode 10. The non-polyfill variant was already used in our code, so this is not likely to break anything that wasn't broken before.
2020-02-01 22:25:03 +01:00
duncanspumpkin 5e9e9df7ce Refactor invalidate_sprite 2020-01-19 17:16:42 +00:00
duncanspumpkin bdcfd615ed Refactor sprite_move 2020-01-19 17:16:41 +00:00
duncanspumpkin a262f325ed Refactor sprite_remove 2020-01-19 17:15:52 +00:00
duncanspumpkin 1b6bfa2bbf Remove no longer strictly correct comments 2020-01-19 17:15:51 +00:00
duncanspumpkin a5ef8d6240 Rename rct_vehicle 2020-01-19 17:14:56 +00:00
duncanspumpkin 164acc85cc Rename sprites to newer style naming 2020-01-19 17:10:53 +00:00
Gymnasiast af12421f2d
Apply fixes 2020-01-19 17:34:11 +01:00
modulo7 fdf0c17fd8
Name field var_CD of vehicle struct. Refactor to enum 2020-01-19 17:34:11 +01: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
duncanspumpkin f04e791f7c When in NO_MONEY mode still path to shops with prices 2020-01-16 20:28:38 +00:00
Tulio Leao b829b22415 Use CoordsXYRangedZ on fence_in_the_way() 2020-01-11 11:13:01 -03:00
Michael Steenbeek 29922da871
Refactor calls to staff_is_patrol_area_set() 2019-12-31 10:10:40 +01:00
Duncan c170926200 Refactor to prefer baseZ instead of height for big Z (#10478) 2019-12-31 09:33:27 +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
Tulio Leao 2d7dccb0c2 Make Map::map_can_construct_*() use CoordsXYRangedZ (#10462)
* Make Map::map_can_construct_with_clear_at() use CoordsXYRangedZ

* Make Map::map_can_construct_at() use CoordsXYRangedZ
2019-12-30 15:00:42 +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 64f7cac6d6
Create getters for station height and start (#10453) 2019-12-27 15:57:40 +01:00
Michael Steenbeek 8ca0cf52a7
Replace more direct accesses to base/clearance Z with getter/setter (#10454) 2019-12-27 15:26:40 +01:00
Tulio Leao a4e99695d4 Remove LocationXY usage on openrct2\peep\Staff.cpp 2019-12-27 08:49:35 -03:00
Tulio Leao 37973c162f Remove LocationXY usage on openrct2\peep\Guest.cpp 2019-12-27 08:49:35 -03:00
ζeh Matt 518780c3e8
Merge pull request #10422 from ZehMatt/refactor/gCommandExpenditure
Refactor out gCommandExpenditureType
2019-12-25 01:49:46 +01:00
Tulio Leao 6ab46bd74a Make Map::map_get_track_element_at_from_ride() use CoordsXYZ 2019-12-24 11:19:06 -03:00
Tulio Leao 6c998d7b4d Make Map::map_get_track_element_at() use CoordsXYZ 2019-12-24 11:19:03 -03:00
Gymnasiast 62fcbb07ca
Rename methods to GetBaseZ/GetClearanceZ 2019-12-23 20:08:37 +01:00
Gymnasiast 85ecb52e7c
Manually replace more Z occurrences 2019-12-23 20:05:26 +01:00
Gymnasiast 7d11858dbe
Create getter for GetBaseHeight()/GetClearanceHeight() 2019-12-23 20:05:24 +01: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
Matt 52ee9c6896
Use enum class for ExpenditureType 2019-12-22 20:51:55 +01:00
Matt 79acb6a073
Move staff wage data to Staff.cpp/h 2019-12-22 20:51:55 +01:00
Matt c24112ffad
Refactor out gCommandExpenditureType 2019-12-22 20:51:49 +01: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 7e7b4029a9 Simplified conversions from TileCoordsXYZ to CoordsXY 2019-12-19 08:12:42 -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
Tulio Leao af7b364946 Prefer map_is_location_valid over hardcoded map limits (#10373) 2019-12-14 22:50:34 +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
Tulio Leao 1532ee2b23 Create CoordsXY::ToTileStart() and CoordsXY::ToTileCentre() 2019-11-30 16:47:23 +01:00
Tulio Leao 72b4d93ad2 Avoid dereferencing map_get_surface_element_at nullptr on libopenrct2 2019-11-18 08:01:04 -03:00
Tulio Leao b793d7e79a Avoid dereferencing map_get_first_element_at nullptr on libopenrct2 (#10013)
* Avoid dereferencing map_get_first_element_at nullptr on Map.cpp

* Avoid dereferencing map_get_first_element_at nullptr on MapAnimation.cpp

Returning true or internal control variable, based on what was seen on `map_animation_invalidate_track_onridephoto`

* Avoid dereferencing map_get_first_element_at nullptr on Park.cpp

* Avoid dereferencing map_get_first_element_at nullptr on Scenery.cpp

* Avoid dereferencing map_get_first_element_at nullptr on Sprite.cpp

* Avoid dereferencing map_get_first_element_at nullptr on TileInspector.cpp

* Avoid dereferencing map_get_first_element_at nullptr on Wall.cpp

* Avoid dereferencing map_get_first_element_at nullptr on Fountain.cpp

* Avoid dereferencing map_get_first_element_at nullptr on Footpath.cpp

* Avoid dereferencing map_get_first_element_at nullptr on Entrance.cpp

* Avoid dereferencing map_get_first_element_at nullptr on Banner.cpp

* Avoid dereferencing map_get_first_element_at nullptr on Vehicle.cpp

* Avoid dereferencing map_get_first_element_at nullptr on TrackDesignSave.cpp

* Avoid dereferencing map_get_first_element_at nullptr on TrackDesign.cpp

* Avoid dereferencing map_get_first_element_at nullptr on Track.cpp

* Avoid dereferencing map_get_first_element_at nullptr on Station.cpp

* Avoid dereferencing map_get_first_element_at nullptr on RideRatings.cpp

* Avoid dereferencing map_get_first_element_at nullptr on Ride.cpp

* Avoid dereferencing map_get_first_element_at nullptr on S4Importer.cpp

* Avoid dereferencing map_get_first_element_at nullptr on Staff.cpp

* Avoid dereferencing map_get_first_element_at nullptr on Peep.cpp

* Avoid dereferencing map_get_first_element_at nullptr on GuestPathfinding.cpp

* Avoid dereferencing map_get_first_element_at nullptr on Guest.cpp

* Avoid dereferencing map_get_first_element_at nullptr on VirtualFloor.cpp

* Avoid dereferencing map_get_first_element_at nullptr on Paint.TileElement.cpp

* Fix issues raised on review

* Fix remaining review issues.

* Early exit on loops if tileElement is nullptr

* Fix clang-format issues
2019-10-09 15:02:21 +01:00
Ted John 15767c3be3 Fix output result of remove_unused_objects (#10029) 2019-10-01 22:30:11 +02:00
Michael Steenbeek a5700a3d07
Merge pull request #9959 from richard-fine/directions
Convert more code to use proper Direction symbols
2019-09-22 16:59:41 +02:00
gill984 565ad3798d Fix #9957: Guests complain about running out of money in no money parks 2019-09-22 16:52:53 +02:00
Richard Fine 92f50efedc Formatting fixes 2019-09-01 19:10:27 +01:00
Richard Fine 31ce0f20f7 Use range-based for loops for checking all directions 2019-09-01 18:40:28 +01:00
Richard Fine 3131bfdc74 Use INVALID_DIRECTION in a bunch of places 2019-09-01 18:40:24 +01:00
Richard Fine 5ff78e48c7 Reduce usage of GetDirectionWithOffset()
GetDirectionWithOffset(2) is the same thing as 'direction_reverse(GetDirection())', and the latter is more readable.
2019-09-01 18:40:08 +01:00
Richard Fine 6449393d50 Use Direction type in a bunch of the pathfinding code 2019-09-01 18:38:03 +01:00
Richard Fine 06b2f66ba1 Use Direction type for peep::direction 2019-09-01 16:08:01 +01:00
Matt e0afefc6de
Add missing Invalidate calls 2019-08-21 12:31:05 +02:00
Matt 66793e664a
Refactor some unnecessary Invalidate calls and call member function if available 2019-08-21 12:08:19 +02:00
duncanspumpkin 5fe5f8e964 Refactor audio_play_sound_at_location to use CoordsXYZ 2019-08-19 20:04:58 +01:00
duncanspumpkin af39ff20af Refactor to use new inheritence and remove duplicate/redundant code 2019-08-19 20:04:58 +01:00
duncanspumpkin bc12618d46 Clang format 2019-08-19 20:04:57 +01:00
duncanspumpkin 5b92b64ec7 Refactor map_get_path_element_at to return PathElement and use CoordsXYZ 2019-08-19 20:04:57 +01:00
duncanspumpkin c6452095ca Refactor tile_element_height to use CoordsXY 2019-08-19 20:04:57 +01:00
duncanspumpkin 5ba9d55415 Refactor map_is_location_owned_or_has_rights to use CoordsXY 2019-08-19 20:04:57 +01:00
duncanspumpkin 5333dc4295 Return a SurfaceElement from get_surface_element 2019-08-19 20:04:56 +01:00
duncanspumpkin 9619fd384d Refactor map_is_location_owned to use CoordsXYZ 2019-08-19 20:04:56 +01:00
duncanspumpkin 9721b8a1bb Fix #9878. Prevent peeps from aimlessly wanderings/drowing when exiting rides.
Mistake made whilst refactoring
2019-08-15 20:24:01 +01:00
Duncan 3da62e4697
Refactor of Peep Update Action (#9793)
* Change the parameters of UpdateAction

* Use std::optional to make things a bit safer

* Use the core optional header to keep xcode happy
2019-08-15 18:32:19 +01:00
Matt cc6321048f
Refactor window_invalidate to use rct_window::Invalidate 2019-08-11 17:22:00 +02:00
Ted John d730a76809 Fix #9844: Guests can't enter park 2019-08-10 15:22:03 +01:00
Ted John 9954f0b725
Add nullptr checks for more instances of get_ride (#9819) 2019-08-09 14:20:59 +01:00
Ted John ab7b17fc4e
Add nullptr checks for get_ride in libopenrct2 (#9788) 2019-08-08 22:58:56 +01:00
Duncan 659b4d8f9f
Clean up some litter in the codebase (#9753)
13CA740 and 141F568 have been doing mostly nothing since the game action refacotr. Before that they didn't do much as I've never found any instance where the code was hit.
2019-08-08 06:05:58 +01:00
Duncan 75210ef3e2
Merge pull request #9742 from duncanspumpkin/fix_9729
Fix 9729
2019-08-08 06:02:08 +01:00
duncanspumpkin ad06491d21 Abstract the common score generator 2019-08-07 20:35:20 +01:00
duncanspumpkin 8ba5b43636 Fix #9729. Change peep pathfinding to take entrance height into account
When choosing which entrance to head to peeps would not take into account the height difference between the locations. This caused peeps to choose badly especially when useing lift transport rides.
2019-08-06 21:28:34 +01:00
Ted John 8022211112 Refactor guest ride consideration 2019-08-04 16:44:17 +01:00
Ted John a863c7ae50 Remove rest of FOR_ALL_RIDES instances 2019-08-04 16:44:17 +01:00
Ted John 414b53b56d Remove ride classifications 2019-08-04 16:43:50 +01:00
Ted John a3fe00f0a3 Refactor ride list to a manager with iterator 2019-08-04 16:43:50 +01:00
Ted John 7ce2f38c92 Fix formatting 2019-07-29 20:01:49 +01:00
Ted John 40d49b93d3 Do not use user strings for peep names 2019-07-29 19:18:16 +01:00
Ted John f8b08b334e Fix a few more bugs 2019-07-29 19:18:16 +01:00
Ted John 3f45976009 Fix openrct2ui errors 2019-07-29 19:18:16 +01:00
Ted John 3155c661fa Refactor format peep action 2019-07-29 19:18:16 +01:00
Ted John 6fff2079f9 Refactor ride name to dynamic args and std::string 2019-07-29 19:18:16 +01:00
Jim Armstrong a432a8a514 Fix #9487: Access violation in UpdateRideEnterVehicle (#9577)
* Fix #9487: Implement nullptr checks

Implemented nullptr checks for the ride and vehicle variables
in UpdateRideEnterVehicle()
2019-07-29 18:07:21 +01:00
Matt 98a17fe8d9
Refactor create_sprite and remove unnecessary move_sprite_to_list 2019-07-24 17:53:51 +02:00
Duncan ab5f5b20cd
Use enum class for RCT2_SOUND (#9618)
* Use enum class for RCT2_SOUND

* Fix formatting. Fix mistaken declaration.

* Change name of enum to SoundId

* Fix clang format
2019-07-22 19:02:45 +01:00
Duncan 4e44818a04
Merge pull request #9449 from ZehMatt/refactor/sprite-list-pow2
Remove unnecessary multiplication and division for sprite lists
2019-07-13 09:37:35 +01:00
Jim Armstrong cc62e41feb Refactor #9291: Move easter egg code to Guest
Refactored static Peep functions related to easter egg names into member
functions in the Guest struct.
2019-06-24 15:17:59 -04:00
Matt fc3afb3349
Remove unnecessary multiplication and division for sprite lists 2019-06-22 17:38:28 +02:00
duncanspumpkin 2de9430bd3 Remove incorrect code that resets picked peep
The game command owner is never set for game actions so this would be incorrect
2019-06-20 20:13:23 +01:00
duncanspumpkin b896f07687 Add PeepPickupAction
Move Guest and Staff pickup to the new game action. Rework the game
action so that only one game action is required for the two game
commands. Remove the final game command with a callback.
2019-06-20 19:34:02 +01:00
Aaron van Geffen f1ac847fce
Merge pull request #9222 from IntelOrca/implement/485-ghost-train-simulation
Implement #485: ghost train simulation
2019-06-04 20:24:16 +02:00
ζeh Matt bc14f427a5 Fix #9322: Peep crashing the game trying to find a ride to look at 2019-05-30 20:49:54 +02:00
Ted John c4e18e570e Add and implement simulation mode for rides 2019-05-28 16:50:08 +01:00
aw20368 8c20b635bd Fix #9270: Refactor money effect
Changed static functions to rct_money_effect member functions. GetStringId now returns std::pair.
2019-05-21 21:22:47 +02:00
nexgenration 6b232f7e53 Fix#9197: Peep insert new thought (#9230)
Improve the readability of the codebase by moving functions into the relevant structures.
- Change name of peep_insert_new_thought to InsertNewThought.
- Update InsertNewThought definition to Guest::InsertNewThought.
2019-05-18 09:47:25 +01:00
Greg Hennis 1fcedae3bc Fix #9258: Rename SPRITE_LIST_NULL to ..._FREE (#9260) 2019-05-15 19:07:01 +02:00
Gymnasiast 4e23c42d38 Remove stub functions from new_game_command_table[] 2019-05-13 22:51:41 +02:00
Gymnasiast 2ea1fcc69d Remove unused declarations and functions 2019-05-13 22:16:14 +02:00
Filip Gawin 6833da77e3 Simplify boolean expresions 2019-05-10 22:00:38 +02:00
Michael Steenbeek da6794ad9e
Refactor second argument to move_sprite_to_list() 2019-05-08 22:11:51 +02:00
Gymnasiast 7f5c9622c0 Fix guests eating popcorn being drawn eating pizza 2019-05-08 20:57:20 +02:00
Gymnasiast 916b8c2705 Use more constants 2019-05-07 19:46:58 +02:00
Gymnasiast 212f425ff0 Rename variables, change signature 2019-05-07 19:34:50 +02:00
NexGenration 846011e21b another message here 2019-05-07 19:34:50 +02:00
ζeh Matt cd8c67ddac
Implement SetCheatAction. (#8990)
* Implement SetCheatAction.

* Bump up network version
2019-05-04 15:28:38 +02:00
Michael Steenbeek c8df801e66
Create ShopItemDescriptor 2019-04-26 20:25:11 +02:00
Duncan 3f4acd7e69
Merge pull request #9120 from Gymnasiast/fix/8079
Fix #8079: Crash when unloading buggy custom rides
2019-04-23 18:28:34 +01:00
Nicole d38fb6a7a2 Fix #8800: ensure tile_element_height is used correctly (#9087)
* Changed calls to tile_element_height to tile_element_water_height

* Changes to calls to tile_element_height

* Removed tile element_height, map_get_highest_land_height, and map_get lowest_land_height

3 functions removed due to relocation.

* Added function tile_element_height back to map.cpp

Added tile_element height back to map.cpp. Was unnecessarily deleted.

* Update Map.h

* water_height changes

* Update Scenario.cpp

* Update Scenario.cpp

* Fix 8800: applied clang format

* Removed unnecessary ANDs
2019-04-23 18:26:48 +01:00
Gymnasiast 6d3eca31fd Add log_verbose for vehicle entries with broken peep loading positions 2019-04-22 23:27:25 +02:00
Gymnasiast ec6b738317 Fix #8079: Crash when unloading buggy custom rides 2019-04-21 12:13:04 +02:00
Michael Steenbeek 5a906b2378
Port more functions to Ride struct (#9119) 2019-04-20 22:22:39 +02:00
Michael Steenbeek 42a1a8704d
Use empty() for vectors; clean up bool comparisons (#9118) 2019-04-20 20:39:47 +02:00
Florian Will 6e9a9448a2 Fix format issue, second attempt
Let's see if I can get this right.
2019-04-15 16:10:57 +02:00
Florian Will 35ff10e480 Fix format issue and add myself to contributors.md 2019-04-15 15:51:01 +02:00
Florian Will eb6ea8e81d Fix #5893: Invalidate widget only if it's visible
Remove the widget_invalidate() call after changing a guest's
guest_heading_to_ride_id, because that call fails a debug assertion if
the guest window is open and the currently active tab is not the
"overview" tab. In Release builds (if assertion is disabled),
widget_invalidate() might access the widgets array out of bounds.

Instead, introduce a new flag PEEP_INVALIDATE_PEEP_ACTION for
window_invalidate_flags in the peep struct and set that flag. The guest
window update function then makes sure to invalidate the label if the
flag is set.

The flag could be used in other places to reduce libopenrct2 dependency
on window_*() calls (see #6808), but this commit only cares about cases
where the assertion would fail.
2019-04-15 14:26:33 +02:00
Gymnasiast 44da799afd Modify return type of get_num_of_sheltered_eighths() 2019-03-27 15:52:18 +01:00
Gymnasiast 64e51cd34b Close #8965: Refactor ride->inversions 2019-03-27 11:30:18 +01:00
Aaron van Geffen f4602d0a34 Use SCREEN_FLAGS_EDITOR when appropriate. 2019-03-20 20:58:08 +01:00
duncanspumpkin add40feb57 Merge #8898 branch 'staff_ga' into game_actions 2019-03-18 20:00:34 +00:00
Aaron van Geffen 2af13904c5 Update copyright notices for 2019. (#8903) 2019-03-17 07:16:15 +00:00
duncanspumpkin 0b231c8b38 Remove old game commands 2019-03-16 20:47:54 +00:00
Duncan 9c4430736d
Use get track element (#8884)
* Use get_track_element and change its return type

* Make things work

* Use helper functions where possible
2019-03-16 11:21:36 +00:00
duncanspumpkin edff5caa7e Merge pull request #8849 'ga-staff-hire' 2019-03-15 19:49:24 +00:00
Duncan 5538fe3ac5
Merge pull request #8599 from janisozaur/fix-h2h7-r4-diamondheights
Add missing nullptr check in rct_peep::UpdateRideMazePathfinding
2019-03-12 11:19:04 +00:00
Matt f8e98b4e3e Pass staff orders by parameter. 2019-03-11 16:54:46 +01:00
Matt f96a1a1b5f Implement StaffHireNewAction game action. 2019-03-11 13:44:34 +01:00
Ted John f5904c90cb Fix #8834: Invalid read in UpdateRideApproachExitWaypoints 2019-03-09 11:36:53 +00:00
Ted John cdec457abd Refactor peep struct 2019-02-28 20:28:58 +01:00
Duncan f0092b7aae
Merge pull request #8781 from duncanspumpkin/flag_refactor
Flag refactor
2019-02-27 19:18:02 +00:00
Michael Steenbeek 6d3200aacc
Merge pull request #8772 from IntelOrca/refactor/sprite-import-export-2
Refactor in-game sprite structs
2019-02-27 13:29:13 +01:00
duncanspumpkin fae15fceca Use IsBroken 2019-02-27 10:49:48 +00:00
duncanspumpkin 7840f6a7f7 Use SetIsBroken 2019-02-27 10:49:48 +00:00
Ted John a3af56f285 Fix formatting 2019-02-25 22:31:14 +00:00
Ted John bac3168a23 Refactor IsChild to IsHead 2019-02-25 17:58:22 +00:00
duncanspumpkin 737c308e4e Use IsGhost() to access ghost state
Added set and clear ghost to further prevent direct access to flags
2019-02-25 15:12:35 +00:00
duncanspumpkin 6890f4f756 Use quarter tile for map can construct at
Make callees of map_can_construct_with_clear use QuarterTile

Use quarter tile for small scenery rotation

Fix clang format

Further clang format
2019-02-25 13:51:08 +00:00
duncanspumpkin f9fe09634c Move quarter tile class to the tile element header.
Refactor flags slightly
2019-02-25 13:51:07 +00:00
Ted John 520b1b4819 Try out changed sprite structs for main game 2019-02-25 12:29:31 +00:00
Ted John 261dd32697
Refactor peep_interact_with_path to prevent null ride warnings (#8728) 2019-02-20 16:47:38 +00:00
Ted John 9e461b2e34 Pass Ride* instead of ride_id_t 2019-02-12 23:29:38 +00:00
Ted John fd090f5ef3 Refactor PickRideToGoOn 2019-02-12 23:29:38 +00:00
Ted John e361655b10 Pass Ride* instead of ride_id_t 2019-02-12 23:29:37 +00:00
duncanspumpkin 8a69b89df6 Move Staff Set Orders into game action framework.
Split up costume and order game commands
2019-02-05 20:38:18 +00:00
Matt 7ad59bbb37 Refactor number values to RIDE_VALUE_UNDEFINED 2019-01-30 14:59:06 +01:00
ζeh Matt 6668a1fa86 Refactor remaining number values to RideStation::NO_TRAIN (#8655) 2019-01-30 13:49:46 +00:00
Matt 4026ead774 Fix #8653: crash when peeps attempt to enter a ride with no vehicles. 2019-01-30 13:16:45 +01:00