Commit Graph

794 Commits

Author SHA1 Message Date
Hielke Morsink 325b986c56
Merge pull request #15489 2021-12-03 00:16:06 +01:00
Duncan 79b12d2953
Introduce DATLimits.h for RCT2 Dat file object limits (#16034) 2021-12-01 21:55:52 +00:00
ζeh Matt ad5e54460f
Merge pull request #16062 from ZehMatt/refactor/map-iterators
Refactor tile map iterations
2021-12-01 06:16:39 -08:00
Hielke Morsink 53d9bfa8b4
Update implicit zoom conversions 2021-12-01 00:08:35 +01:00
GalBr c2fa54057a
Remove vehicle_colour and replace references to VehicleColour (#16055)
This is done because we had two identical structs: vehicle_colour and
VehicleColour. We now only use VehicleColour.

See: #16028
2021-11-29 22:04:31 +00:00
ζeh Matt be5d6ac3db
Fix the loops 2021-11-29 14:12:26 +02:00
ζeh Matt 9e89be71ab
Refactor iterating over all map tiles in ride_clear_leftover_entrances 2021-11-29 13:05:32 +02:00
ζeh Matt 9f23449ffb
Move Staff/Guest/Peep to entity 2021-11-26 18:26:19 +02:00
Duncan 275d565e52
Start splitting up ride.h (#16011)
* Start splitting up ride.h

* Use cstdint instead of common.h
2021-11-26 15:03:14 +00:00
ζeh Matt 56e78d5733
Merge pull request #15985 from ZehMatt/refactor/entities2
Refactor Sprite to Entity
2021-11-25 12:53:50 -08:00
Peter Schussheim 0495b265c0
Refactor unchecked std::array subscript operator 2021-11-25 10:13:20 +01:00
ζeh Matt 03fb9b390f
Rename Sprite to EntityRegistry 2021-11-24 17:04:12 +02:00
ζeh Matt 7c726e2a0c
Fix includes 2021-11-24 16:48:33 +02:00
duncanspumpkin ed54a28e38
Modify ride update to match vanilla balance 2021-11-21 22:43:22 +01:00
IntelOrca 34128dc262
Add new .park save format
Co-authored-by: Gymnasiast <Gymnasiast@users.noreply.github.com>
Co-authored-by: duncanspumpkin <duncanspumpkin@users.noreply.github.com>
Co-authored-by: ZehMatt <Zehmatt@users.noreply.github.com>
Co-authored-by: Broxzier <Broxzier@users.noreply.github.com>
2021-11-21 22:43:22 +01:00
Duncan 5d2a56525f
Refactor min max cars per train from nsf (#15911) 2021-11-14 20:58:44 +00:00
ζeh Matt cd7e35044a
Move statics into TrackDesignState and pass that to each function 2021-10-29 02:06:59 +03:00
Michael Steenbeek dd007c836f
Fix #15579: Crash in track_block_get_next() 2021-10-26 18:05:13 +00:00
seanmajorpayne f6cb144f8c
Fix #15322: Circus Music is Not Playing (Full Fix) 2021-10-20 13:11:06 +00: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
Michael Steenbeek 5cb1cee0d8
Fix #15584: Ride income underflows when on-ride photos are making losses 2021-10-17 09:15:13 +02:00
Michael Steenbeek 5563139ed1
Fix #15503: Freeze when doing specific merges 2021-10-06 23:00:06 +02:00
Hielke Morsink 429e34d7f3
Make uses of window_get_main use (const) auto* 2021-09-30 14:36:06 +02:00
Hielke Morsink 94144bcd89
Remove some dead code
Reported by clang
clang-analyzer-deadcode.DeadStores
2021-09-30 10:40:32 +02:00
ζeh Matt 82f0da24b1
Use int32_t for iterating tiles
Co-authored-by: Ted John <ted@brambles.org>
2021-09-29 20:40:57 +03:00
Michael Steenbeek f7d61c67e6
Fix arbitrary ride type cheat not working 2021-09-26 16:21:34 +02:00
seanmajorpayne 2ba515fb37
Improve #15322: Circus Music Not Playing
Alleviates the issue, though the circus in European Extravaganza still does not work correctly.
2021-09-25 19:21:38 +00:00
ζeh Matt e5de2adc4f
Merge pull request #15429 from ZehMatt/backport/ticks
Remove scenario ticks and adjust export/import
2021-09-23 12:08:16 -07:00
ζeh Matt 74e8988dd8
Remove scenario ticks and adjust export/import
Co-authored-by: Ted John <ted@brambles.org>
2021-09-23 21:49:09 +03:00
ζeh Matt 719a5a9d8e
Merge pull request #15369 from ZehMatt/refactor/tile-coords
Refactor overload map_get_first_element_at
2021-09-21 14:36:03 -07:00
Hielke Morsink 4b4b3333d6
Remove unnecessary else blocks 2021-09-16 18:31:12 +02:00
ζeh Matt 687b6c000e
Apply review suggestion
Co-authored-by: Tulio Leao <tupaschoal@gmail.com>
Co-authored-by: Hielke Morsink <hielke.morsink@gmail.com>
2021-09-14 16:30:38 +03:00
ζeh Matt 59a6c34db4
Make use of std::optional strict 2021-09-13 20:02:32 +03:00
ζeh Matt b733e97bfa
Remove numerics from common.h and use it as needed 2021-09-11 20:21:08 +03:00
ζeh Matt 516232e0a7
Change static casts to EnumValue 2021-09-10 19:10:15 +03:00
ZehMatt 3ad72baaae
Cast fixes 2021-09-10 19:10:12 +03:00
Michael Steenbeek 624a32e93b
Make Coords isNull/setNull functions TitleCase (#15382) 2021-09-08 20:48:53 -03:00
ζeh Matt 07a7946caf
Remove redundant conversions 2021-09-07 22:36:16 +03:00
spacek531 ebc201aaf2 comment and rename
refactor to class method

fix formatting

rename function

rename another

rename sub_6C683D

rename loc_6CD18E

annotate ride_get_entrance_or_exit_position_from_screen_position

fix format

rename loop value

fix formatting again

rename functions to TitleCase
2021-09-02 19:47:22 -07:00
Michael Steenbeek 4bbee1c6ae
Merge pull request #15261 from frutiemax/13874_refactor
Track Element Descriptor refactor (issue #13874)
2021-08-29 22:38:46 +02:00
frutiemax 450bf61ee4 Part of #13874: TrackSequenceProperties, Pricing and MirrorMap renamed 2021-08-29 10:45:17 -04:00
frutiemax b3744f129f Part of #13874: Avoid copies of ted 2021-08-28 18:57:46 -04:00
frutiemax 5f438535ad Part of #13874: Gymnasiast review 2021-08-27 17:57:10 -04:00
frutiemax 9c53fe252d Part of #13874: ZehMatt review changes 2021-08-27 17:44:33 -04:00
Duncan 008f106242
Add constants for golf flags (#15072)
* Add constants for golf flags

* Reorg SubPositionData for minigolf

* Add enum for golf states

* Add golf animation enum

* Fix names of animations

* Correct spleing

* Revert stray change
2021-08-25 11:08:57 +01:00
frutiemax 046c060e74 Part of #13874: Replace Track Sequence properties 2021-08-22 18:01:03 -04:00
frutiemax 382315b2c3 Part of #13874: Replace block tables 2021-08-22 17:57:56 -04:00
frutiemax 780eb4f287 Part of #13874: Replace piece lengths 2021-08-22 17:53:38 -04:00
frutiemax 1bfa26e4c5 Part of #13874: replace flags table 2021-08-22 17:51:35 -04:00
frutiemax 80418efafb Part of #13874: Replace TrackCoordinates 2021-08-22 17:49:00 -04:00
spacek531 c49c6ca4a7
Rename animation vars 2021-08-21 19:23:27 +02:00
Michael Steenbeek e547dd96db
Make RideConstructionState a strong enum 2021-08-11 17:51:59 +02:00
Michael Steenbeek 8ecbabf8bf
Fix #14974: too many dodgems not handled correctly
Properly check if all vehicles have been created, and clean them up properly if not.
2021-08-02 22:02:06 +02:00
Ted John 5f853df1fd
Remove gS6Info 2021-08-02 20:38:02 +02:00
Gymnasiast 8af70cf402
Correctly import ride profits 2021-08-01 15:14:42 +02:00
ζeh Matt afc4cd7cba
Refactor ride construction code into a new unit 2021-07-27 17:21:03 +02:00
Michael Steenbeek 4f80ef50ef
Fix #15086: Crash in vehicle_create_trains() 2021-07-26 21:17:17 +02:00
Jamie Quigley 4f6d0a00fd
Refactor RIDE_STATUS to use strong enum (#14840)
* Refactor RIDE_STATUS to use strong enum

* Change platform-specific code to match RIDE_STATUS refactor

* Re-added check for valid RideStatus value

* Fixed errors in "g2" build target

* Use EnumValue instead of static_cast<uint8_t>

* Revert rct{1,2}.h to use uint8_t.

* Fix formatting

* Reverted from constexpr variable to additional enum variant

* Fix formatting
2021-06-10 07:09:58 +01:00
Adam dbd84f9f40
Fix #14415: Entrances/exits are removed when built on top of each other (#14490) 2021-05-23 15:41:34 +02:00
Michael Steenbeek 513398b1f6
Fix #14488: Crash when building too many rides 2021-05-13 19:23:53 +02:00
Basssiiie 5480c99e0b
Rename previously unknown vehicle flags, and json strings to camelCase 2021-05-13 13:34:32 +02:00
ZxBiohazardZx 36b2742c19
Change Vehicle Rotation namings in accordance with OpenRCT2 Codestyle (#14616)
* Code Refactor: Rename vehicle_sprite_type to Pitch 

In some of the issues the vehicle_sprite_type is used to check for properties in regards to the pitch of the vehicle.Similarly bank_rotation is used to provide information on the Roll property. This is not in alignment with the https://github.com/OpenRCT2/OpenRCT2/wiki/Coding-Style and makes it harder to refactor other elements of the codebase and makes for undesired nested logics.

This PR also includes the change from rename bank_rotation to Roll in alignment with the OpenRCT2 Coding Style


Related to PullRequest #11956

* Apply formatting

Co-authored-by: duncanspumpkin <duncans_pumpkin@hotmail.co.uk>
2021-05-12 12:38:46 +01:00
Michael Steenbeek c9943ee11d
Merge pull request #14458 from Gymnasiast/backport-nsf
Backport ride limit refactors from new-save-format
2021-04-20 23:25:53 +02:00
Duncan 8eabdf8c8f
Split guest and staff peep variables (#14462)
* Split guest and staff peep variables

* Move variable location

* Increment network version

* Update replays
2021-04-18 17:48:21 +01:00
Gymnasiast d857dca36d
Replace hardcoded max number of trains per ride 2021-04-16 18:56:16 +02:00
Duncan a9e1f2e89c
Remove SpriteBase::flags (#14460)
* Remove SpriteBase::flags

* Increment network version

* update replays
2021-04-11 18:02:19 +01:00
Michael Steenbeek 7c73e271ad
Name num_sheltered_sections flags 2021-04-03 22:17:57 +02:00
Michael Steenbeek 7344b7fbfd
Use 16-bit ride_id_t thoughout and raise RIDE_ID_NULL (#14411)
* Replace RIDE_ENTRY_INDEX_NULL with OBJECT_ENTRY_INDEX_NULL

Ride entries are objects like any other, so there is little point having separate constants.

* Use ride_id_t in many more places

* Change RIDE_ID_NULL to 0xFFFF

* Increment network version

* Update replays

Co-authored-by: duncanspumpkin <duncans_pumpkin@hotmail.co.uk>
2021-04-01 16:02:57 +01:00
Michael Steenbeek cbefc4fe38
Fix #14412: NPE in vehicle_create_car() 2021-04-01 11:26:14 +02:00
Duncan 0a47d2157a
Use more specific types where appropriate (#14388)
It takes marginally more time to get a Peep than a Guest/Staff so may as well go straight to the correct type
2021-03-25 08:44:25 +00:00
Duncan 6ec379cd0e
Split Entity Lists by Entity type (#14326)
* Make initial changes to add entity type

* Make further corrections

* Revert header changes

* Fix mistakes
2021-03-16 11:18:06 +00:00
Duncan 5474194905
Implement train view and remove linked_list_index (#13956)
* Make train manager view

* Remove linked list index field

* Remove merge mistake

* Fix further rebase errors

* Rename and add comments

* Update replays

* Fix Xcode project

* Increment network version

Co-authored-by: Michael Steenbeek <m.o.steenbeek@gmail.com>
2021-03-15 08:13:00 +00:00
Michael Steenbeek 28c680f97f
Merge pull request #14163 from Gymnasiast/refactor/get-rtd
Use GetRideTypeDescriptor() in more places
2021-02-26 10:46:38 +01:00
Gymnasiast 48f513f73f
Apply review request; fix Testpaint 2021-02-26 10:19:03 +01:00
Gymnasiast 44d0e77afb
Make all access to RTD table use the bounds checking function 2021-02-26 10:01:00 +01:00
Gymnasiast 62f8796677
Replace more flag checking 2021-02-26 09:51:17 +01:00
Gymnasiast f118b2ede4
Replace ride_type_has_flag() with retrieving RTD 2021-02-26 09:49:09 +01:00
Gymnasiast b1ab20ec27
Replace loose flag checking with helper function 2021-02-25 23:04:40 +01:00
Michał Janiszewski 6baff43f52 Reduce inclusion of Sprite.h 2021-02-25 10:56:27 +01:00
Gymnasiast d63e3b1d9f
Replace RideTypeDescriptors[ride->type] with GetRideTypeDescriptor() 2021-02-24 14:10:30 +01:00
Gymnasiast 56399e7188
Use the RTD instead of ride_type_has_flag() 2021-02-24 14:10:30 +01:00
Gymnasiast 429f6fb845
Always return an RTD 2021-02-24 14:10:22 +01:00
ζeh Matt c9ca066e94
Merge pull request #14024 from ZehMatt/refactor/coords-peep-destination
Use CoordsXY for for some types
2021-02-21 15:33:52 +02:00
Duncan 2b26e423e4
Remove AsGuest and AsStaff duplicated functions 2021-02-21 13:23:31 +01:00
Matt 965041b437
Remove direct access to DirectionX and DirectionY 2021-02-21 09:52:33 +02:00
Ted John 762b6ee816 Refactor viewport interaction flags and add plugin API 2021-02-18 18:10:29 +00:00
Gymnasiast 1b964c0f2e
Refactor flat ride track pieces 2021-02-18 17:50:19 +01:00
Michael Steenbeek e3a1af3d05
Use getters/setters for track type and direction 2021-01-30 15:16:17 +01:00
spacek531 1e3fe9b550
Separate booster track elem type (#13857)
* add data to Track.cpp

add data to TrackData.cpp

add import helper functions

fix Booster value

import booster as 256

export booster as 100

add vehicle subposition data

add SV4 import

add TD4 import

add TD6 import

use track_type_t when importing TD6

add TD6 export

change peep tracktype type to auto

fix SV4 track element import

fix import of booster speed

add None enum to TrackElemType

move _legacy RideConstruction functions to Ride.cpp

change _currentPossibleRideConfigurations to use track_type_t

fix booster track category

add booster string tto

expand _currentTrackCurve to 32 bits

expand track_curve_chain to 32 bits

update get_track_element et al. to handle 16 bit track types

run clang-format

remove unused #includes from _legacy.cpp

Revert "remove unused #includes from _legacy.cpp"

This reverts commit 4c4d4b06edb0c130314789d8fe371246be246c9f.

Revert "update get_track_element et al. to handle 16 bit track types"

This reverts commit 73920dafd4a6c9e7c9f0c7ee1098d493f8f5d262.

Revert "move _legacy RideConstruction functions to Ride.cpp"

This reverts commit 2d83a75c1477d387ad77a7a5085f37a28f72a589.

update _legacy functions for 16-bit track types

update ride_construction_reset_current_piece behavior with new enum

fix declaration of _currentTrackCurve to match other track tcurve vars

remove unused include from T4Importer.cpp

move SCT to 256 part 1: RideConstruction.cpp

move SCT to 256 part 2: TrackData.cpp

move SCT to 256 part 3: Ride.h/Ride.cpp

move SCT to 256 Part 4: revert changes to S4Importer.cpp, T4Importer.cpp

fix stations appearing as curves

fix too many initializers in TrackData.cpp

move SCT to 256 part 5: S6/T6 importing and exporting

move SCT to 256 part 6: simplify RCT12.cpp functions

fix comments in S6Exporter.cpp, S6Importer.cpp

fix clang-format on S6Importer.cpp

add missing data to TrackData.cpp

revert new functions for checking if track type is a booster

revert unused include

change trackType to auto and add comment to S6Exporter.cpp

move track type aliasing from TrackDesign.cpp to T6Import.cpp, T6Export.cpp

add comment about sv6 vehicle.track_type

static cast to uint8_t in T6Exporter.cpp`

set type to auto when setting value to _currentTrackCurve

revert moving function in S6Importer.cpp

fix value names in RideData.cpp

revert cahnge to uint16_t return for GetTrackType() in RCT12.cpp

fix GetTrackType return type for real

add changelog entry

bump network version

cast alternate track type to track_type_t

static_cast tuple input value in _legacy.cpp

change _currentTrackCurve to uint32

use TrackElemType::Count to determine length of subposition array

perform some changes

remove padding from rct_trackdefinition

fix alternative type check

remove _boosterTrackSelected

add missing condition for booster speed

add comments for TrackElemType::MultiDimInvertedUp90ToFlatQuarterLoop

add missing comments to RideData.cpp

remove extra entry

simplify some things

fix formatting

remove redundant checks todo: fix building the track piece

use TrackElemType::None more

remove git.txt

* bump network version

* make conditional more explicit w/ parentheses

* move booster check to RCT12.cpp

* implement getters and setters for vehicle track type and direction

* fix formatting

* rename RCT12TrackTypeIsBooster to RCT2TrackTypeIsBooster

* add whitespace in RCT2.h

* change the thing I thought I changed

* move booster check function to RCT2.cpp

* move function into if condition

* fix scope issues with setters
2021-01-29 15:24:53 +00:00
ζeh Matt 109a06663d
Fix entrance or exit stacked on top considered a duplicate 2021-01-29 16:19:07 +01:00
Ted John a9755609c2 Move ride audio into own namespace 2021-01-27 18:45:28 +00:00
Ted John 2f39442d25 Implement ride music objects and refactor 2021-01-27 18:45:27 +00:00
Duncan 8c5cd61b69
Split free id's into seperate vector (#13924) 2021-01-26 07:42:56 +00:00
ζeh Matt 329b228cac
Fix #13916: use correct constant for maximum station locations 2021-01-23 23:06:05 +01:00
ζeh Matt 73275b311b
Fix #13903: ride exits not being recognized (#13906) 2021-01-22 22:08:54 +00:00
ζeh Matt bc20efb3df
Merge pull request #13822 from ZehMatt/refactor/fixedvector
Avoid some allocations by using a fixed size vector
2021-01-22 16:17:14 +02:00
Michael Steenbeek 20f959c833
Use track_type_t in more places 2021-01-22 11:33:55 +01:00
Duncan 354a131892
Use specific type for peep list access (#13831)
* Use specific type for peep list access

* Simplify calculation further
2021-01-19 17:57:22 +00:00
Duncan 4ff5b9a89f
Reset Entity to 0 on removal (#13835)
This is to force any use after remove bugs to the surface
2021-01-16 15:48:39 +00:00
Michael Steenbeek 32d8dadc2b
Replace some leftover use of uint8_t for ride subtype 2021-01-15 19:35:06 +01:00
Matt e9cdb559e3
Avoid some allocations by using a fixed size vector 2021-01-14 12:27:54 +02:00
Duncan d5ada2dca1
Remove type from SpriteBase (#13735)
* Move type field into sub structures

* Use type for misc_type

* Use type for l_type

* Rename to SubType

* Rename SpriteGeneric to MiscEntity

* Rename generic to misc

* Add extra nullptr checks for compilers that cant understand

* Make review changes

* Increment network version

* Update replays
2021-01-10 15:14:34 +00:00
Michael Steenbeek 1da6ae6b51
Merge pull request #13710 from skdltmxn/refactor/string_view
Refactor/string view
2021-01-10 13:37:01 +01:00
ζeh Matt acf71315b5
Cleanup variables usage and initialize them 2021-01-06 22:29:40 +01:00
skdltmxn c093a50f3f Refactor to use string_view more properly 2021-01-07 01:52:10 +09:00
Michael Steenbeek 406967c71f
Refactor object_entry_get_entry() to return Object 2021-01-03 23:01:52 +01:00
Dennis Devriendt 3073cca6aa
Close #13624: Refactor ViewportInteractionItem to use strong enum (#13657)
* Closes #13624: Refactor ViewportInteractionItem to use strong enum
2020-12-29 15:09:15 -03:00
Tulio Leao 8c9fa45a76 Use switch for Ride::UpdateAll 2020-12-23 20:15:39 -03:00
Tulio Leao 00483df2f2 Close #13625: Refactor TOOL_IDX to use strong enum 2020-12-23 20:07:54 -03:00
Tulio Leao 221aa8cece Close #12453: Refactor RCT2_EDITOR_STEP to strong enum 2020-12-23 20:07:53 -03:00
Michael Steenbeek abd7babc86
Get RTD from ride via a struct method, part 1 2020-12-12 22:53:50 +01:00
Adam 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
Adam 1b61b4b104
Fix #13489: Mechanics continue heading to inspect broken down rides (#13490)
* Fix #13489: Mechanics continue heading to inspect broken down rides
2020-12-05 15:05:55 -03:00
Łukasz Pękalski 3de233c796
Close #12395: Refactor PeepItem to use strong enum (#13311)
* refactor: integrated PEEP_ITEM into SHOP_ITEM

* refactor: converted merged enum to flag

Only former occurrences of PEEP_ITEM

* cleanUp: code cleaned after merging

* refactor: converted ShopItem to strong enum

code reformatting

* refactor: ShopItem enum items renamed

code formatted

* refactor: new getter and setter functions for Item...Flags

* refactor: replaced all occurrences of ItemStandardFlags

with appropriate getter and setter functions.
COMPARE_FIELD macro needs to be commented out or the flag has to stay public.

* refactor: all occurrences of ItemExtraFlags replaced

with proper function calls. COMPARE_FIELD macro issue not resolved.

* refactor: introduced new variable for unified item flags

* refactor: adapted accessor functions

accessor functions were modified to accommodate both standard and extra ShopItem flags

* refactor: ItemExtraFlags accessor functions are replaced

with general functions

* refactor: reverted to original uint32_t flag variables

* refactor: implemented suggested changes

* refactor: integrate additional comments

* refactor: incorporated requested changes

* refactor: incorporated requested changes

added static_cast<PeepThoughtType> in lines 1572 and 1590
2020-12-03 21:15:59 -03:00
Florian Probst 923b5f990d
Close #12438: Refactor RIDE_COMPONENT_TYPE to use strong enum (#13456)
* Part of #12438  Changed RIDE_COMPONENT_TYPE to enum class

(1/3)

Changed the enum RIDE_COMPONENT_TYPE to be enum class in RideData.h.
Shortened the enumerators.
And fixed

I split the changes I did into 3 commits because the enum is used in a total of 85 different files where I just replace the single line where they occur.

The changes in those 85 files are analogous to my change in line 328 in RideData.h in this commit.

* Part of #12438  changed all RIDE_COMPONENT_TYPE enumerators appearances

(2/3)

Changed every appearance of the old RIDE_COMPONENT_TYPE enumerators to the changed enumerators from last commit.

* Part of #12438

(3/3)

Used EnumValue() wherever a field or variable of the type RideComponentType was used as an index.

Havent checked if anything from these 3 commits on this branch got codestyle issues

* Part of #12438

used clang-format

* Closes #12438  Added Accessor function for RideComponentName

Added Accessor function GetRideComponentName to RideData.
to replace the use RideComponentNames[EnumValue(RideComponentType type)]

* Close #12438 moving GetRideComponentName to RideData Headerfile

Moved GetRideComponentName to RideData Headerfile since thats where it should be.
2020-11-26 15:23:47 -03:00
ffrogman 1f0764be28
Fix #13427: Newly created Go-Karts show "Race won by <blank>" (#13457)
* Fix #13427. Show # of people for newly created Go-Karts

* Add changelog entry

* Reorder changelog entry
2020-11-26 18:04:35 +00:00
Łukasz Pękalski 832fd69822 refactor: changed ObjectType enum to strong enum
code does not compile yet
2020-11-11 16:07:01 +01:00
Łukasz Pękalski 6e5105ab3b refactor: ObjectType to use strong enum
enum renaming complete
2020-11-11 16:07:01 +01:00
Gymnasiast d58a8d1184
Change tile_element_get_ride_index() to method 2020-11-07 12:58:32 +01:00
Michael Steenbeek 92a5f1aa24
Merge pull request #13310 from ju-pinheiro/sprite-identifier-strong-enum
Close #12450: Refactor SPRITE_IDENTIFIER to use strong enum
2020-11-06 16:55:01 +01:00
Michael Steenbeek eea57f2bfe
Create calls for min/max cars per train 2020-11-05 17:42:02 +01:00
Manuel Vögele ef51cfb29c
Refactor loc_6DDF9C (#13369)
* Move ride_create_vehicles into Ride

* Refactor loc_6DDF9C
2020-11-04 15:58:24 +00:00
Manuel Vögele 96ff1894ee
Remove unnecessary parameter from Ride::Open (#13368)
Ride::Open is only ever called with RIDE_STATUS_OPEN,
so the parameter is redundant.
2020-11-04 11:24:32 +00:00
Manuel Vögele b40ea0169d
Rename sub_6B5952 to ChainQueues (#13357)
Also remove unreachable call to it
2020-11-03 22:43:26 -03:00
Manuel Vögele 47419b8ba1 Rename vehicle_unset_update_flag_b1 and move it into Vehicle 2020-11-03 21:36:26 +01:00
Manuel Vögele 6517757df7 Rename VEHICLE_UPDATE_FLAG_1 2020-11-03 20:08:10 +01:00
Manuel Vögele 1b55914c96
Rename ride_set_block_points to RideOpenBlockBrakes (#13360) 2020-11-03 17:24:54 +00:00
Manuel Vögele 15dc5e004e
Rename VEHICLE_UPDATE_MOTION_TRACK_FLAG_10 (#13362) 2020-11-03 17:24:18 +00:00
Michael Steenbeek 1aff58b23e
Use TrackElement in vehicle_create_trains() and friends (#13338) 2020-11-02 23:56:12 -03:00
Manuel Vögele fac1b1f81e
Refactor loc_6B51C0 2020-11-02 23:05:47 +01:00
Manuel Vögele d0e5a5ab6e Move ride_open and ride_test into Ride 2020-10-28 18:13:37 +01:00
Manuel Vögele eaa340dd92 Rename ride_is_valid_for_test/open and update return type 2020-10-28 15:31:24 +01:00
ju-pinheiro bb16ca075b Close #12450: Refactor SPRITE_IDENTIFIER to use strong enum 2020-10-27 13:26:27 -03:00
Manuel Vögele d927fefb86
Fix #13019: Stop simulating when ghost train crashes in block mode 2020-10-26 21:37:51 +01:00
Simon J a017d3fa57
Fix #13215: lingering arrows after ride construction (#13245)
Co-authored-by: Simon Jarrett <mwnciau@users.noreply.github.com>
2020-10-21 23:45:53 -03:00
Simon Jarrett 65a8c58af7 Fix missing direction arrow for stations 2020-10-15 19:44:36 +01:00
Simon Jarrett 25ce8b3f6e Fix #7443: Construction arrows pulse at irregular intervals. 2020-10-15 19:44:10 +01:00
ζeh Matt 645289f4ec
Rename GameActionResult and use GameActions namespace instead (#13184) 2020-10-14 22:04:39 -03:00
Duncan 84c9ff833a
Move formatter to separate file. Rework GetMeasurement (#13131)
* Move formatter to seperate file. Rework GetMeasurement

* Add Formatter source files to Xcode project

Co-authored-by: Aaron van Geffen <aaron@aaronweb.net>
2020-10-09 08:02:07 -03:00
Duncan 4fb4feb83c
Fix missing error message on ride graph (#13129)
* Fix missing error message on ride graph

Mistake made during implementation meant that the ride graph would not show the error message when the ride had not left the station. Another mistake meant that the tertiary colour of the ride window was not set to green. The tertiary colour was only used by this error message though so was not noticed.
2020-10-08 15:22:23 -03:00
Tulio Leao db728d61a7
Fix signed/unsigned mismatch 2020-10-06 21:32:59 -03:00
Matt 7045fd9e9f
Minor cleanup 2020-10-07 01:10:53 +03:00
Matt 091145037e
Move the audio code into OpenRCT2 namespace 2020-10-07 00:34:42 +03:00
Simon J 7f963c4901
Fix entrance and exit ghosts not being removed for mazes (#13074)
* Fix entrance and exit ghosts not being removed for mazes

Co-authored-by: Simon Jarrett <simonjjarrett@gmail.com>
Co-authored-by: Tulio Leao <tupaschoal@gmail.com>
2020-10-03 09:33:28 -03:00
Tulio Leao 29955f28e0
Merge pull request #12976 from mwnciau/Refactor-TRACK_ELEM-enum
Refactor TRACK_ELEM_* enum
2020-10-01 22:05:44 -03: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
Sam J Gunner 55b4c4c6f1
Fix #13046: Simplify block sectioned comparisons (#13049) 2020-10-01 09:06:28 -03:00
rpstester 3508bdc37d
Close #12390: Refactor PeepRideSubState to enum class
Also made a RideSubState as a union with SubState and SittingSubState
Updated all values across all files, and the corresponding assert.
2020-09-30 23:33:58 +02:00
Duncan 3c8adb1fc1
Remove gMapTooltip format args global (#12971)
Fix mistake
2020-09-28 21:45:28 -03:00
Łukasz Pękalski d1cd2e08b5
Close #12388, refactor PeepState to use strong enum (#12927)
* Close #12388, refactor:PeepState to use strong enum

* refactor: refactored file PlayTests.cpp

* refactor: change PEEP_STATE_ to PeepState:: and camel case after merging

chore: code reformatting
2020-09-28 15:51:49 -03:00
Łukasz Pękalski 065da23b3b
Close #12437, refactor: RIDE_MODE_* to strong enums (#12833)
* partial refactor: RIDE_MODE_* to strong enums

* Close #12437, refactor: RIDE_MODE_* to strong enums

* chore: code formatting

* refactor: RideMode, change enum names to CamelCase

and resolve casting order.

* chore: refactor due to code formatting

* Close #12437, refactor: RIDE_MODE_* to strong enums

Resolved comments

* chore: Formatting correction.

* Use EnumsToFlags constexpr

* refactor: resolved comments

added newline at the end of file

* refactor: Change case stack to default in Switch

Co-authored-by: duncanspumpkin <duncans_pumpkin@hotmail.co.uk>
2020-09-28 14:09:59 +01: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
Matt b3b9a348c5
Apply review suggestions 2020-09-17 22:16:05 +03:00
Matt 38e03ae45d
Use the Formatter for News items 2020-09-17 22:14:36 +03:00
Matt ccde06ab0f
Explicitly pass formatter arguments to ShowError and family 2020-09-17 22:14:36 +03:00
Matt 2639349925
Move storage into Formatter class and refactor usage 2020-09-17 22:14:36 +03:00
Michael Steenbeek 8b19d943a4
Merge pull request #12676 from mwnciau/Ride-Helix-Save
Fix #7037: saving rides starting with sloped turn
2020-08-26 12:13:59 +02:00
Tulio Leao efdb7e1a2d Change gDateMonthsElapsed type to int32_t 2020-08-25 19:06:38 -03:00
Tulio Leao 10aca0fe6e Fix #12764: Rides don't start aged anymore 2020-08-25 08:21:34 -03:00
Simon Jarrett 31a1d5259c Fix #7037: Unable to save tracks starting with a sloped turn or helix 2020-08-19 00:08:14 +01:00
ryan-bello cc2bb33892 changed enum STAFF_TYPE to strong enum StaffType, moved it to Peep.h 2020-08-17 22:59:02 -04:00
ryan-bello 54a33cbde8 renamed StaffType to AssignedStaffType 2020-08-17 20:16:09 -04:00
Gymnasiast 89f04c4fb3
Fix names of two track type functions 2020-08-10 23:48:18 +02:00
Arran Ireland 4de58e1fd4
Close #12440: Refactor VEHICLE_STATUS to use strong enum (#12606)
* Close #12440: Refactor VEHICLE_STATUS to use strong enum

* Fix code formatting for VEHICLE_STATUS refactoring

* Refactor VehicleStatus enum to be inside Vehicle

This commit moves VehicleStatus inside Vehicle,
renamed as Status.
2020-08-09 06:24:25 +01:00
Arran Ireland 1702c90c8e
Merge pull request #12605 from ion232/refactor-vehicle-type
closes #12439: Refactor VEHICLE_TYPE to use strong enum
2020-08-08 18:41:04 +01:00
Łukasz Pękalski 399e0abe2e
Close #12497: Remove extra SPRITE_INDEX_NULL checks (#12601) 2020-08-08 09:12:52 -03:00
pizza2004 156be224f9
Close #12399: Refactor MIXER_GROUP to strong enum (#12531) 2020-08-03 20:51:12 -03:00
pizza2004 d217dfa9b9
Refactor NewsItem into namespace and Pascal Case (#12511) 2020-08-02 23:14:00 -03:00
Duncan 733bc5a981
Close #12518: Viewport Refactor (#12541)
* Remove viewport pointer from get_map_coordinates_from_pos

* Removed viewport from get_window

* Return a InteractionInfo from get_map_coord...

* Remove viewport_interaction_info struct

* Add Entity union to simplify code

* Name the enum used for viewport interaction

* Simplify functions further by returning the info struct

* Add default switches
2020-08-02 08:32:59 +01:00
Łukasz Pękalski 0f78d452a4
Part of #12497: Remove extra SPRITE_INDEX_NULL check (#12538)
* refactor: deleted double check of SPRITE_INDEX_NULL in Staff* ride_get_mechanic(Ride* ride)

* refactor: deleted double check of SPRITE_INDEX_NULL in Ride.cpp file

* refactor: deleted double check of SPRITE_INDEX_NULL in windows/Ride.cpp in function static rct_string_id window_ride_get_status_vehicle

* refactor: deleted double check of SPRITE_INDEX_NULL in ride/Ride.cpp

* refactor: deleted double check in FormatStatusTo
2020-08-02 08:28:11 +01:00
Sidney 97d74e142e
Close #12441: Refactor VEHICLE_TRACK_SUBPOSITION to use strong enum (#12550) 2020-08-02 07:50:07 +01:00
Cory Sanin 394e8fb733
Resolve GCC warnings for Ride.cpp (#12553)
Eliminate warnings from ride_create_vehicles and ride_create_vehicles_find_first_block that would prevent build from succeeding when using GCC.
2020-08-02 00:28:47 +02:00
Duncan c6e26267a4
Reduce the use of GET_VEHICLE (#12494)
* Start removing GET_VEHICLE macro use

* Further work

* Remove further GET_VEHICLE's

* Further removal of GET_VEHICLE

* Remove the last of GET_VEHICLE

* Fix testpaint

* Fix nullptr deref

* Make review changes

Also swapped in helper functions and used a standard patern for iterating the train cars

* Further simplify loops for train cars
2020-07-31 07:48:27 +01:00
Tulio Leao 63f683853e
Merge pull request #12479 from pizza2004/news-enum
Refactor NewsItem to use strong enums
2020-07-28 18:21:45 -03:00
pizza2004 cee7f8d34c Close #12397: Refactor NEWS_ITEM_* to use strong enum 2020-07-28 12:54:18 -06:00
Duncan 8a378ad236
Remove uses of GET_PEEP macro and replace with GetEntity (#12467)
* Use TryGetEntity and GetEntity instead of macro

* Use GetEntity for ui guest window

* Remove final GET_PEEP macro uses

* Fix remaining issues
2020-07-26 17:42:02 +01:00
Michael Steenbeek ba10b84789
Fix #12478: Crash in track_block_get_next() 2020-07-26 17:16:27 +02:00
chaitanyathengdi 33a88fbdbd
Fix #10946: On-ride photo profit assumes every guest buys one (#12285)
* Use stored values of customers to adjust income from on-ride photos

Use stored values of photos sold and total customers to calculate ratio
and use that to predict income per hour for rides that include
on-ride-photo sections.

* Get rid of float

* Fix formatting

* Fix formatting - again

* Review changes

* Fix formatting

* Use new method of checking on-ride photo

* Use constants

* Add a changelog and contributors entry
2020-07-25 07:19:51 +01:00
Gymnasiast cf664c8340
Close #11971: Replace ride groups with new ride types 2020-07-17 00:19:49 +02:00
frutiemax 0fa0ca451e
Part of #12245: Use coords for window_scroll_to_location (#12282) 2020-07-15 23:26:27 -03:00
Tulio Leao 0758d0fe5c Prefer reference on ride_create_vehicles parameter 2020-07-11 12:21:46 -03:00
Tulio Leao de8bb169de Use CoordsXYZ on vehicle_create_trains 2020-07-11 12:21:44 -03:00
Tulio Leao 47db30f1d7 Use CoordsXYZ on vehicle_create_train 2020-07-11 12:21:09 -03:00
Tulio Leao 7921740938 Use CoordsXYZ on vehicle_create_car 2020-07-11 12:21:07 -03:00
frutiemax 123d0cceb6
Close #12173: Remove Formatter additions with void* (#12196) 2020-07-11 03:06:23 +02:00
Helio Santos 925d21eeda Part of #12159: update check_for_adjacent_station to use CoordsXYZ&
Update check_for_adjacent_station to use CoordsXYZ&. Updated caller(s) accordingly.
2020-07-10 11:00:00 -07: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
Helio Santos fb9fab69a9 Part of #12159: Uses CoordXY on find_closest_mechanic
Updated find_closest_mechanic prototype to use CoordXY. Updated caller(s) accordingly.
2020-07-10 09:41:51 -07:00
Tulio Leao e5e70688c5
Use big Z coords on some Ride station functions (#12192) 2020-07-10 08:40:42 -03:00
Tulio Leao f29abf6953
Part of #11389: Use Formatter on Ride::FormatStatusTo (#12172) 2020-07-09 18:54:30 +02:00
duncanspumpkin 57d2877e67 Provide accesor function for get entity list count 2020-07-05 07:28:38 +01:00
duncanspumpkin e51bbeed23 Convert SPRITE_LIST to an enum class 2020-07-04 07:38:11 +01:00
frutiemax 14a07359b3
Part of #11389: Use formatter class for Ride::FormatNameTo (#12041) 2020-06-24 21:02:08 -03:00
frutiemax f86931d8a0
Close #12019: Use ScreenCoordsXY on gfx_draw_sprite_software 2020-06-22 23:52:54 +02:00
frutiemax 57b50e46df
Part of #11964: Move RideTypeEnumNames to RideTypeDescriptors 2020-06-19 23:03:24 +02:00
frutiemax 57b121d448
Part of 11964: move RideColourPresets to RideTypeDescriptors 2020-06-19 18:04:43 +02:00
Michael Steenbeek 2013e1a36f
Merge pull request #11974 from Gymnasiast/refactor/ride-type-misc
Refactor/ride type misc
2020-06-17 23:15:30 +02:00
Michael Steenbeek e2b187c24a
Merge pull request #11921 from duncanspumpkin/CreateSprite6
Entity List Iterator
2020-06-17 21:28:36 +02:00
Gymnasiast 2a9c2be7d0
Remove unused function 2020-06-17 19:11:02 +02:00
frutiemax de1c172c74
Move RideProperties and rideBonusValue to RideTypeDescriptors
Part of #11964.
2020-06-17 18:59:04 +02:00