1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-20 21:43:06 +01:00
Commit Graph

209 Commits

Author SHA1 Message Date
Ted John
b2c0787c2d Fix #10389: Invalid read in vehicle_update_travelling (#10390) 2019-12-17 21:48:38 +01:00
Tulio Leao
af7b364946 Prefer map_is_location_valid over hardcoded map limits (#10373) 2019-12-14 22:50:34 +01:00
Ted John
569161902f Fix #9919: invalid read in vehicle_update_measurements (#10300) 2019-11-27 21:45:32 +01:00
ζeh Matt
5606b4895b Fix desync because of ride status (#10227) 2019-11-16 16:12:33 +01:00
duncanspumpkin
ac87b3f667 Use std::optional to remove requirement for invalid result. 2019-11-02 14:43:51 +00:00
Tulio Leao
e86ee10e5f Use int32_t instead of int for train_index 2019-10-31 01:39:37 -03:00
Duncan
bb48a471e6 Merge pull request #10135 from tupaschoal/constexpr-for-openrct2-defines
Use constexpr on openrct2/*
2019-10-30 19:45:25 +00:00
Tulio Leao
9123b597a9 Use constexpr on openrct2/* 2019-10-29 18:44:14 -03:00
Krisztián Csordás
f2eb1fada6 Refactor SteamParticleOffsets (#10134)
* Refactor SteamParticleOffsets

Turn flat array of 48 offsets into arrays of 16 offsets for 3 different
types.
2019-10-29 17:38:57 +01:00
Duncan
c3e14328f1 Little Refactor (#10075)
* Correct the label for track elem 255.

* Catch last little change
2019-10-19 10:00:42 +02:00
Hielke Morsink
8c1ccfdaa9 Fix possible cause for desyncs on ride crashes (#10104)
`scenario_rand` was used twice between two sequence points. The order of evaluation is unspecified in C++, meaning that these calls could be done in both forward and reverse order. Storing them in variables guarantees their order, making this cross-platform.
2019-10-16 21:51:59 +02: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
aw20368
ff1698bcb9 Improve #9987: Minimum load rounding (#9987)
Refactor code for vehicles waiting for a specific load level.
Original code rounded the target load down, changed to round up.
2019-09-28 20:51:13 +02:00
aw20368
3f10811426 Fix #9970: Wait for quarter load fails
Vehicle was always incorrectly flagged as ready to depart when quarter load is selected. Removed erroneous flag.
2019-09-22 23:06:54 +02:00
Peter
650142de9b Fix #9902: Doors and portcullises can be double opened 2019-09-18 23:26:33 +02:00
Gymnasiast
f365bc3cb7 Create getters and setters for occupied quadrant 2019-08-27 21:12:48 +02:00
Gymnasiast
6e200459d3 Refactor some accessors to tile element type and flags fields 2019-08-24 22:42:47 +02:00
duncanspumpkin
5fe5f8e964 Refactor audio_play_sound_at_location to use CoordsXYZ 2019-08-19 20:04:58 +01:00
duncanspumpkin
bc12618d46 Clang format 2019-08-19 20:04:57 +01:00
duncanspumpkin
f3db7f877a Refactor tile_element_water_height to take CoordsXY 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
5333dc4295 Return a SurfaceElement from get_surface_element 2019-08-19 20:04:56 +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
93789b9034 Add nullptr checks for get_ride in libopenrct2ui (#9795) 2019-08-09 08:06:25 +01:00
Ted John
ab7b17fc4e Add nullptr checks for get_ride in libopenrct2 (#9788) 2019-08-08 22:58:56 +01:00
Michael Steenbeek
073e4b0ccc Fix #7690: Problem with guests freezing on certain tiles of path (#9723) 2019-08-04 17:19:40 +02:00
Ted John
3f8890afde Fix remaining errors and a few bugs 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
Matt
f3638ca858 Address code review 2019-07-24 18:12:25 +02: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
Cody Brittain
5342a6d9a9 Renamed sound enums for accuracy and organization 2019-07-20 12:41:36 +02:00
Peter
dd948f99c4 #9295 Refactor rct_vehcile->status to rct_vehicle::SetState() (#9329)
Fix #9295. Refactor rct_vehicle->status to rct_vehicle::SetState()

Created rct_vehicle::SetState() and refactored all assignments to
rct_vehcile->status. SetState also includes a call to
vehicle_invalidate_window(), so it cannot be forgotten.
2019-06-09 15:45:56 +01:00
Ted John
6f0298deb3 Refactor ride measurement storage 2019-06-09 11:55:41 +02:00
Ted John
5fa0c18455 Do not provide test results for simulate 2019-05-28 16:50:08 +01:00
Ted John
5f1f428bce Add and use Ride::SupportsStatus 2019-05-28 16:50:08 +01:00
Ted John
c4e18e570e Add and implement simulation mode for rides 2019-05-28 16:50:08 +01: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
nexgenration
ebefe5721b Fix #9198: Move vehicle invalidate to member function
To further improve the readability of the codebase the vehicle_invalidate function is now a member function of rct_vehicle.
2019-05-11 13:20:34 +01:00
Filip Gawin
6833da77e3 Simplify boolean expresions 2019-05-10 22:00:38 +02:00
Florian Will
8c109307cf Fix #8507: Incorrect change in vehicle rolling direction
In OpenRCT2, when vehicles roll backward on a long, flat track piece,
they would eventually change their direction of movement and move
forward instead, after their velocity reached -4095. The acceleration
due to rolling resistance and drag changes to 0 at that point, which
caused the "implicit boost" up to a velocity of ~+32k (close to 2km/h)
to trigger.

The behavior is different in vanilla RCT2, where vehicles just keep on
very slowly rolling backwards.

This commit disables the "implicit forward boost" for vehicles rolling
backward to mimic vanilla RCT2 behavior.
2019-05-02 22:22:59 +02: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
Michael Steenbeek
42a1a8704d Use empty() for vectors; clean up bool comparisons (#9118) 2019-04-20 20:39:47 +02:00
Michael Steenbeek
8d83f5a549 Merge pull request #8978 from Gymnasiast/refactor/inversions
Close #8965: Refactor ride->inversions
2019-03-28 20:28:35 +01:00
Michael Steenbeek
a50c7836f8 Move more ride functions to struct methods (#8977) 2019-03-27 21:53:38 +01:00
Gymnasiast
a27e04e5a3 Limit inversions and holes to 31 (for now) 2019-03-27 19:44:46 +01:00
Gymnasiast
2a99c42242 Fix code to determine number of golf holes 2019-03-27 12:53:15 +01:00
Gymnasiast
64e51cd34b Close #8965: Refactor ride->inversions 2019-03-27 11:30:18 +01:00
Michael Steenbeek
1c570c8eec Move some ride functions to struct methods 2019-03-20 20:05:25 +01:00