Commit Graph

659 Commits

Author SHA1 Message Date
duncanspumpkin 3a615c2126 Use new game action for callees 2019-02-21 16:00:31 +00:00
duncanspumpkin 9b6fdd41aa Remove redundant code. Rename to standard style 2019-02-19 15:20:55 +00:00
duncanspumpkin 09bb99d9e8 Fix clang format and travis errors
Minor refactor

Move key callback code into callbacks. Fixes shop placement

Use rotate_map_coordinates
2019-02-19 12:31:22 +00:00
duncanspumpkin 77b25714ff Move callbacks into GameActionCallbacks
Remove remaining references to game command
2019-02-19 12:30:42 +00:00
Ted John ba445cb6ef Pass Ride* instead of ride_id_t 2019-02-13 20:16:42 +00:00
Ted John fdf9f36fab Pass Ride* instead of ride_id_t 2019-02-12 23:58:45 +00:00
Ted John 9e461b2e34 Pass Ride* instead of ride_id_t 2019-02-12 23:29:38 +00:00
Ted John aaacece0ea Pass Ride* instead of ride_id_t 2019-02-12 23:29:37 +00:00
Michał Janiszewski 379fd42dc4 Fix types passed to ride_type_has_flag 2019-02-10 00:04:52 +01:00
Matt d87ca57e72 Replace game command references with new game action. 2019-02-08 18:03:06 +01:00
duncanspumpkin 201db19d0a Move Ride Set Appearance into action framework 2019-02-07 08:14:45 +00:00
Michael Steenbeek b4bef2fe7d
Merge pull request #8560 from richard-fine/directions
Begin cleanup of direction handling
2019-01-18 19:09:39 +01:00
Ted John 92412d4bab Store ride index inside ride struct 2019-01-18 11:46:18 +01:00
Gymnasiast 87f894079b Replace hardcoded occurrences of RIDE_ENTRY_INDEX_NULL 2019-01-12 12:48:35 +01:00
Gymnasiast 74a3674e86 Replace more hardcoded instances of RIDE_ID_NULL 2019-01-12 12:38:23 +01:00
Ted John 8701286772
Use new ride_id_t typedef (#8561) 2019-01-12 10:11:55 +00:00
Richard Fine e90e9dd73f Introduce many uses of direction_reverse
Change many of the places doing the ^2 trick to use direction_reverse instead, for improved readability.
2019-01-05 15:41:46 +00:00
Ted John d979511628 Do code review suggestions 2019-01-02 19:46:13 +00:00
Ted John 38f632074b Merge ride track colour arrays into one 2019-01-01 21:25:34 +00:00
Ted John 37f76d1687 Move station fields into new station struct 2019-01-01 02:26:14 +00:00
Ted John 8e6497fc1d Merge vehicle_colours and vehicle_colours_extended 2018-12-31 19:25:07 +00:00
Michael Steenbeek 2530cd1ac3
Fix #8426: Queue banner left behind after ride demolition 2018-12-22 15:34:17 +01:00
ζeh Matt 3cc6e1ab15 Fix #8469: Crash modifying colour on hacked rides. (#8470) 2018-12-17 16:27:45 +01:00
ζeh Matt 7d19a5bc77 Refactor memcpy to std::memcpy and memset to std::memset (#8408) 2018-12-15 22:23:31 +01:00
Hielke Morsink f53bf5508b
Merge pull request #8335 from ZehMatt/vehicle-crash-fix
Fix hacked rides with no vehicles crashing the game.
2018-12-14 21:01:59 +01:00
ζeh Matt a78a6f2a33 Fix #8349: Ride's exit is rendered incorrectly while building it 2018-12-14 20:08:18 +01:00
Matt f0bd72732c Fix hacked rides with no vehicles crashing the game. 2018-12-14 00:04:35 +01:00
Ted John 06f203a7e7 Implement surfaces, edges and stations as objects 2018-12-09 23:30:40 +00:00
Hielke Morsink 354d973a48 Use std::size instead of Util::CountOf 2018-11-23 21:59:08 +01:00
ζeh Matt 06c5508bab Fix #8212: Crash when opening rides with changed mode and no tracks. (#8216) 2018-11-12 20:13:42 +01:00
Felix Pelletier 4c5fccc9b6 Fix #7689: Deleting 0-tile maze gives a MONEY32_UNDEFINED (negative) refund 2018-11-11 21:01:06 +01:00
Felix Pelletier 0cd7f1e07c Fix #8142: Reliability of unbreakable rides can go below 100% 2018-11-02 09:04:27 +01:00
Michael Steenbeek f8add7f62e
Rename rct_tile_element to TileElement 2018-11-01 13:53:50 +01:00
Michael Steenbeek 853e4c4a6a Remove residual access to path ride_index field 2018-10-31 13:09:53 +01:00
Michael Steenbeek 28d302d653 Remove more direct access to TileElement->type 2018-10-03 12:31:02 +02:00
Michael Steenbeek f8483b4726 Fix formatting 2018-09-27 22:15:04 +02:00
Michael Steenbeek a8e087b560 Return actual entrance elements from map functions 2018-09-27 22:15:04 +02:00
Michael Steenbeek 3c93aca727 Port entrance station index and sequence lookup 2018-09-27 22:15:04 +02:00
Michael Steenbeek c7eaa1ba80 Port entrance ride index lookup 2018-09-27 22:15:04 +02:00
Michael Steenbeek cc7f8e612d Port entrance type lookup 2018-09-27 22:15:04 +02:00
Gymnasiast 539d274297 Fix crash in ride_set_map_tooltip() 2018-09-26 21:11:24 +02:00
Gymnasiast ed616b0fb5 Add assert; fix crash 2018-09-25 21:57:21 +02:00
Gymnasiast eecf465e3b Fix formatting 2018-09-25 21:57:21 +02:00
Gymnasiast fc136230d8 Fix crash 2018-09-25 21:57:21 +02:00
Michael Steenbeek 75b5c45a97 Remove residual direct access to most track fields 2018-09-25 21:57:21 +02:00
Michael Steenbeek d7f226592c Remove direct access of track sequence 2018-09-25 21:57:21 +02:00
Michael Steenbeek e6d5638815 Move inverted() functions to struct methods 2018-09-25 21:57:21 +02:00
Michael Steenbeek 0cea008c18 Move cable lift functions to struct methods 2018-09-25 21:57:21 +02:00
Michael Steenbeek 69f02400f9 Move GetColourScheme to struct methods 2018-09-25 21:57:21 +02:00
Michael Steenbeek a3e9c63fc3 Move GetRideIndex to struct methods 2018-09-25 21:57:21 +02:00
Michael Steenbeek 650971bc68 Move HasChain to struct methods 2018-09-25 21:57:21 +02:00
Gymnasiast 67d7d5c022 Move getting station index to struct methods 2018-09-25 21:57:21 +02:00
Gymnasiast 6bd732ce5a Move getting seat rotation to struct methods 2018-09-25 21:57:21 +02:00
Gymnasiast ae4c464ce7 Move getting track sequence to struct methods 2018-09-25 21:57:21 +02:00
Gymnasiast 8908f3f47e Move getting track type to struct methods 2018-09-25 21:57:21 +02:00
Michael Steenbeek 1d3baef9b7 Remove some C-style tile element functions 2018-09-16 21:34:04 +02:00
deurklink a5cbcb448c Fix #7975: Clear inspection due flag when interval set to Never 2018-09-07 13:08:26 +02:00
Matt ccf12befd5 Formating. 2018-08-31 07:18:51 +02:00
Matt 04928d4b84 Refactor reference over std::shared_ptr. 2018-08-31 07:18:48 +02:00
Linus Unnebäck fd07be587a
Remove Math::Clamp in favour of std::clamp 2018-08-12 16:47:12 +01:00
Gymnasiast 45b8ca9421 Remove more strings, fix error 2018-08-12 15:56:47 +02:00
clang-format b02dfdbc93 Binpack function arguments together
Previously when the arguments of a function wouldn't fit on a single line, clang-format would put each argument on its own line instead. By enabling the binpack parameter setting, it tried to fit as many on one line as possible instead.

Co-authored-by: Hielke Morsink <hielke.morsink@gmail.com>
2018-07-23 16:00:22 +02:00
clang-format 95ce592579 Enforce not breaking before assignments and function names
Co-authored-by: Hielke Morsink <hielke.morsink@gmail.com>
2018-07-23 16:00:19 +02:00
Hielke Morsink 7c6002cb26 Correct formatting in remaining files in libopenrct2 2018-07-23 16:00:17 +02:00
clang-format e8310d079d clang-format ride 2018-07-23 16:00:09 +02:00
Michael Steenbeek 1b08fb4e69 Replace our own integer types with standard ones 2018-06-20 17:30:40 +02:00
Michael Steenbeek ec3a1e575e
Replace Math::Min and Max with std variants 2018-06-20 17:11:35 +02:00
Hielke Morsink 0cf256ac9e Ready copyright notice for clang-format
Clang-format sees the text behind `#pragma region` as code and formats it. Instead of stating the copyright and date there, it's now in the comment block right below it. The text "Copyright" is left in the `#pragma region` line, as clang-format sees it as a single identifier.

I took the opportunity to normalize the dates, and add the copyright notice to the source files where it was missing them (except for third-party and the generated resources.h file).
2018-06-15 14:07:34 +02:00
Ted John b043428cf0
Merge pull request #6998 from JeroenDStout/railway-crossings-wait
Railway crossing behaviour for peeps and vehicles
2018-06-11 09:09:07 +01:00
Ted John bc1d2252aa Remove window dependency from Ride.cpp 2018-06-10 23:34:36 +01:00
Ted John b4d3806614 Unblock tiles when vehicles are removed from ride 2018-06-10 22:59:58 +01:00
Hielke Morsink 5d0022a5cb Remove argument list from zero-initializers with zero/false/nullptr value 2018-06-04 19:50:46 +02:00
Michael Steenbeek a14d59028f
Modify some commands to use CoordsXY 2018-06-04 19:18:52 +02:00
jensj12 b94f5ea9d8 Fix #7568: Demolish button causes hang
Fixed by adding the standard infinite loop check. Also makes the save button save the entire track again. Affects cost of refurbishing.
2018-06-01 10:34:32 +02:00
Hielke Morsink 2fed57d792
Check for ghost flag when removing track blocks (#7596) 2018-05-31 22:36:45 +02:00
Michael Steenbeek b573bd49b3 Replace all occurrences of tile_element_is_last_for_tile() 2018-05-24 11:44:53 +02:00
jensj12 b6b3486a3d Fix cost being shown as 0 while paused 2018-05-23 16:33:37 +02:00
jensj12 56fcd2ec94 Use ride_get_start_of_track in TrackDesignSave 2018-05-23 16:33:37 +02:00
jensj12 23dc6bb9d3 Add button to refurbish ride
Add a button to refurbish the selected ride. The cost for this is 35% of the
build price and may only be done if the ride is closed and empty.
2018-05-23 16:33:37 +02:00
Ted John 29fb1b7692 Fix #7534: Train/No.cars/Vehicles quantities frozen on custom or pre existing rides 2018-05-17 19:05:45 +01:00
Ted John 34531f7afb
Fix signed/unsigned mismatch warnings (#7529)
Unignore MSVC warning: C4245:
'conversion_type': conversion from 'type1' to 'type2', signed/unsigned mismatch
2018-05-16 21:22:17 +01:00
Michael Steenbeek fcf507e051
Spin off shop item stuff to separate files 2018-05-14 19:21:43 +02:00
Ted John d7e93cec27 Prevent use of Context during ~Context 2018-05-13 00:43:56 +01:00
Hielke Morsink afac7f6557 Make more global functions part of rct_peep 2018-05-05 11:42:43 +01:00
duncanspumpkin fcb66b7449 Start refactoring pathfinding to use tileCoords 2018-05-05 11:42:34 +01:00
duncanspumpkin ddbcae801e Use correct remove function 2018-05-05 11:42:27 +01:00
duncanspumpkin 5d7da79702 Label next_var_29. Add accessor functions.
Removed unused flag (1<<4). Not set in any save. Possibly left over from RCT1
2018-05-05 11:42:15 +01:00
duncanspumpkin a94fb2fa2e Use Invalidate 2018-05-05 11:35:54 +01:00
duncanspumpkin 8d37502c7a Further use of SetState 2018-05-05 11:08:17 +01:00
duncanspumpkin cbefe633d0 Further fixing 2018-05-05 11:06:26 +01:00
duncanspumpkin f245d049f1 Further fixing 2018-05-05 11:04:49 +01:00
Michael Steenbeek 5f9d40be7a
Replace tile_element_get_type() with struct method 2018-05-02 19:27:04 +02:00
Michael Steenbeek b725916808 Use TitleCase 2018-05-02 13:27:53 +02:00
Michael Steenbeek ef433df26a Clean up tile element usage, introduce struct methods 2018-05-02 11:58:12 +02:00
Hielke Morsink 30063984e6
Delete unused function arguments or mark them so (#7426)
This aims to make future refactoring easier. The arguments are removed where possible, but kept and marked with C++17's [[maybe_unused]] where they could not be removed (e.g. when they are used as a callback, rather than called directly).

I've skipped the rides/<category>/* and peep/* source files, because the rides source files are mostly generated and have a ton of unused variables, and the peep source files are being refactored.
I've also skipped most of window/* source files, because most of the functions are used as callbacks and will be bulk-renamed at some point.
2018-04-20 13:56:37 +02:00
duncanspumpkin e4e514c743 Fix travis errors. Revert mistaken rename.
Use enum where known

Remove unused cases
2018-04-11 18:16:23 +01:00
duncanspumpkin 765500adfa Label offsets and functions
Actually save before commiting

Label more peep vars.

Remove unread var

Further refactoring

Fix mistake in map element type
2018-04-11 18:16:09 +01:00
duncanspumpkin a24c2672fd Label all peep ride sub states
Add additional notes to function.

Perform exorcism on code base

Use vector for carArray
2018-04-11 18:15:47 +01:00
duncanspumpkin fc14f6e635 Refactor peep update ride sub state 0 2018-04-11 18:13:17 +01:00
Hielke Morsink dc673a64d8 Give context the ownership of repositories and the object manager (#7340)
This makes them no longer a singleton, which fixes annoying behaviour when launching multiple contexts in one game session.
2018-04-10 13:19:23 +01:00
Michael Steenbeek cfb5a6b39d Correct spelling of 'sujonkwa' 2018-03-29 13:00:01 +02:00
zaxcav 9d3e1fbedf Fix #7176 pending breakdown interfering with mechanic heading to inspection (#7201)
* Fix pending breakdown interfering with mechanic heading to inspection

* Rename peep_fixing sub states per suggestions.

Reset ride->mechanic_status to UNDEFINED in sub-state finish fix/inspect (previously sub_state_13).

* Increment network version. Fix tabs/spaces
2018-03-20 21:55:30 +00:00
Michał Janiszewski cd065d4f41 Reduce includes in common header 2018-03-20 00:27:58 +01:00
Michał Janiszewski 9b0fe5f09e Don't use registers struct where not strictly required
The only advantage of `struct registers` is the union hierarchy. If this
is not being actively exploited, it is detrimental to use this struct.
2018-03-14 22:11:30 +01:00
Ted John 42490b64fc Show entrance / exit fix messages as verbose only
This is because some title sequences have parks which need fixes and they end up showing on stdout every game launch.
2018-03-10 15:18:25 +01:00
Hielke Morsink 4bfeaf0c72 Fix #6870 Crash when loading groena lund
This crash only occurs when the option "no test crashes" was enable. With this commit the sprite index will be checked before the vehicle gets checked.
2018-03-10 06:50:45 +00:00
Michael Steenbeek 88af2d3954 Rename sub_6CA2DF() to window_ride_construction_update_state() 2018-03-09 09:17:24 +01:00
Michael Steenbeek 1fa2fa8f80
Refactor ride->entrances and ride->exits 2018-03-07 19:10:50 +01:00
ZehMatt e3708c0593 Split special direction to new parameter. 2018-03-05 00:17:34 +01:00
ZehMatt bdc1cf8adc Refactor GAME_COMMAND_MAZE_SET_TRACK to game action. 2018-03-05 00:17:34 +01:00
Aaron van Geffen ba1d269227 Move all Virtual Floor code from Map to its own file. 2018-03-04 19:28:56 +01:00
ZehMatt fdf7adecd9 Fix #7002: Always invalidate virtual floor regardless of selection. 2018-03-04 19:28:56 +01:00
Michael Steenbeek f4ac2b4d5b Replace LocationXYZD16 2018-02-16 16:16:49 +01:00
Michael Steenbeek bde913ee16 Rename SmallCoords and BigCoords 2018-02-15 22:26:50 +01:00
Michael Steenbeek a2260929dd Replace rct_xy_element with BigCoordsXYE 2018-02-15 22:26:50 +01:00
Michael Steenbeek d481cca2ed
Remove some redundant casts and fix rct_sprite::AsDuck() 2018-02-15 13:04:25 +01:00
jensj12 02474353e3 Reduce duplicate code
Fix two cases of duplicated code
2018-02-13 00:11:29 +01:00
Ted John 7e01dcdaaf Remove legacy object list 2018-02-12 12:48:41 +00:00
Ted John 4d8fe051e8 Remove most usages of object_entry_groups 2018-02-12 12:48:41 +00:00
jensj12 06e52f2d6f Fix #7137: Water, gentle and transport rides can only have 1 vehicle... (#7159)
.../train
2018-02-10 19:22:28 +00:00
Ted John 97032f7044
Merge pull request #7062 from rwjuk/fix7052
Fix #7052: Infinite loops occur in track circuit iteration
2018-02-06 11:42:19 +00:00
Gymnasiast cc4f7e144a Remove most usages of 'new Intent' 2018-02-05 23:23:26 +01:00
Gymnasiast e3c0f6606d Clean up Intent.{cpp,h}
This gets rid of the C transfer functions, add licence and does some alignment fixes
2018-02-05 23:23:26 +01:00
duncanspumpkin ac2ad02491 Update name of chairlift flag 2018-01-30 12:53:50 +00:00
duncanspumpkin eb5f8485fa Name further entry flags 2018-01-30 12:53:50 +00:00
duncanspumpkin 5401e69b50 Name vehicle animation offsets 2018-01-30 12:53:50 +00:00
duncanspumpkin 93d1b7a233 Label vehicle sound2 flags 2018-01-30 12:53:50 +00:00
duncanspumpkin 4551f9c04e Label flags 2018-01-30 12:53:50 +00:00
duncanspumpkin 96f664abb9 Fix Water Ride spinning on slope bug. Name flags. Refactor
There was a bug in the spinning water ride code that would mean that it would never trigger the stopping of spinning when going up a lift. This mistake was made during implementation of the function.
2018-01-30 12:53:50 +00:00
duncanspumpkin f9d6203200 Refactor vehicle spinning.
Fix bug in R8_SPIN and LR_SPIN that would cause vehicles to spin in wrong direction on certain track elements.
Name parameters
Name flag for additional vehicle spinning sprites
Add comments to code to make function easier to understand.
2018-01-30 12:53:50 +00:00
pss9205 d6bf08e407 Fix #7030: Ride reliability underflows 2018-01-28 12:51:45 +01:00
Richard Jenkins c76b075348 Fix #7052: Infinite loops occur in track circuit iteration 2018-01-20 21:51:26 +00:00
Ted John 6d63729a40 Fix MSVC 2018-01-18 22:59:30 +00:00
Ted John f2014fb6b1 Refactor music_list.c to C++ 2018-01-18 22:08:56 +00:00
Marijn van der Werf 7d0417a366 Import private headers in remaining files 2018-01-18 22:57:55 +01:00
Marijn van der Werf 430bf482f2 Add viewport getter 2018-01-18 22:57:55 +01:00
Ted John 9afbfe02ab Add new helper to check if raining 2018-01-14 01:06:47 +00:00
Ted John 742690b4f4 Add enums for weather effect and rain level 2018-01-14 01:06:47 +00:00
Ted John 83cdd56825 Unify current and next climate state into common struct 2018-01-14 01:06:47 +00:00
ZehMatt 84f2917f59 Use const and constexpr whenever possible. 2018-01-11 22:29:08 +01:00
Michael Steenbeek cd5a1ba888 Compile files in world folder as C++ 2018-01-11 13:25:09 +01:00
Aaron van Geffen 0527f50c7f Take previous virtual floor area into account when invalidating. 2018-01-11 10:37:40 +01:00
Jeroen D Stout 0268be92cb Prevent ride construction from setting tiles when scenery tool is active 2018-01-11 10:37:40 +01:00
Jeroen D Stout 2849561eb6 Make ride editing set virtual floor height 2018-01-11 10:37:40 +01:00
Michał Janiszewski 469e142c7b Change casing of header files 2018-01-11 09:30:09 +01:00
Michał Janiszewski 5a8cfb16c8 Clang-format guards for static data
This guards most of the hardcoded data from clang-format.

[ci skip]
2018-01-11 09:19:56 +01:00
Michael Steenbeek 6a88d6e04d Move and rename RCT{1,2,12}.h 2018-01-09 13:36:41 +01:00
Ted John c3eab7ead6 Refactor window.c to C++ 2018-01-07 12:39:58 +01:00
Michael Steenbeek 755add6c9a
Compile localisation folder as C++ 2018-01-06 18:32:25 +01:00
Duncan 12dde3a589
Refactor of Vehicle Sound Functions (#6907)
* Refactor vehicle_update_sound_params

Named known params.
Changed function structure to use more return statements to prevent multiple nested ifs.
Used core memory functions instead of hand rolled version.
Added more comments.
Named sub_6BC2F3.
Added comment on likely source of corruption of sound.

* Refactor vehicle_sounds_update

Split the function up into multiple functions.
Rework code to remove GoTos.

* Label params. Refactor slightly the restraint code to use bools
2018-01-04 21:38:27 +00:00
Michał Janiszewski b2bc974fe7
Use nullptr where possible 2018-01-04 06:58:44 +01:00
Michael Steenbeek 91589f57c6 Compile map.c as C++ 2018-01-03 20:40:51 +01:00
Ted John 49f5611bd1 Rename scenario.c|h to cpp 2018-01-03 15:07:17 +01:00
Michael Steenbeek 347ff702d0 Refactor objects 2018-01-03 10:16:51 +01:00
Michał Janiszewski b1a78c8f24
Fix a compilation issue with older compilers 2018-01-01 22:55:00 +01:00
Michał Janiszewski 1cd7f99d2d
Fix Ride.cpp compilation issues 2018-01-01 22:16:16 +01:00
Gymnasiast dc68946649 Remove unneeded C transfer functions from RideGroupManager 2017-12-31 21:15:34 +01:00
Gymnasiast 6e281e2061 Move music tune id list out of Ride.cpp for now 2017-12-31 20:43:17 +01:00
Gymnasiast 23d70a4ac9 Compile ride.c as C++ 2017-12-31 20:43:17 +01:00
Renamed from src/openrct2/ride/ride.c (Browse further)