1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-17 12:03:07 +01:00
Commit Graph

148 Commits

Author SHA1 Message Date
Michael Steenbeek
d481cca2ed Remove some redundant casts and fix rct_sprite::AsDuck() 2018-02-15 13:04:25 +01:00
Michał Janiszewski
92c4c39b96 Guard from nullptr dereference in object_entry_get_entry
While looking at
https://github.com/OpenRCT2/OpenRCT2/issues/7176#issuecomment-365399194
I got a crash with stacktrace:

    #0 0x7f9e81fa2e30 in object_entry_get_entry(int, unsigned long) ../src/openrct2/object/ObjectList.cpp:181
    #1 0x7f9e81fa24ae in get_loaded_object_entry(unsigned long) ../src/openrct2/object/ObjectList.cpp:142
    #2 0x7f9e8215d64f in S6Exporter::Export() ../src/openrct2/rct2/S6Exporter.cpp:169
    #3 0x7f9e8216de71 in scenario_save(char const*, int) ../src/openrct2/rct2/S6Exporter.cpp:757
    #4 0x7f9e81c932b0 in game_autosave() ../src/openrct2/Game.cpp:1590
    #5 0x7f9e828625b6 in scenario_autosave_check() ../src/openrct2/scenario/Scenario.cpp:297
    #6 0x7f9e81c8a958 in game_update() ../src/openrct2/Game.cpp:439
    #7 0x7f9e81c6731f in OpenRCT2::Context::Update() (/home/janisozaur/workspace/OpenRCT2/build/libopenrct2.so+0x10f331f)
    #8 0x7f9e81c6674c in OpenRCT2::Context::RunVariableFrame() (/home/janisozaur/workspace/OpenRCT2/build/libopenrct2.so+0x10f274c)
    #9 0x7f9e81c6402d in OpenRCT2::Context::RunFrame() (/home/janisozaur/workspace/OpenRCT2/build/libopenrct2.so+0x10f002d)
    #10 0x7f9e81c638f4 in OpenRCT2::Context::RunGameLoop() (/home/janisozaur/workspace/OpenRCT2/build/libopenrct2.so+0x10ef8f4)
    #11 0x7f9e81c627bf in OpenRCT2::Context::Launch() (/home/janisozaur/workspace/OpenRCT2/build/libopenrct2.so+0x10ee7bf)
    #12 0x7f9e81c5b08a in OpenRCT2::Context::RunOpenRCT2(int, char const**) ../src/openrct2/Context.cpp:170
    #13 0x56323695b95e in main ../src/openrct2-ui/Ui.cpp:60

Sadly I cannot reproduce it anymore
2018-02-14 09:48:34 +01:00
Hielke Morsink
55979a3fff Remove and replace C typedefs
`typedef struct/union/enum name { ... } name_again;` is not needed whe compiling C++, moving the name at the back to be in front of the object and removing `typedef` makes it usable the very same way.
This also replaces typedefs with the using keyword. They have better readability, especially for function pointer types, and would allow more flexibility when used with templates.
2018-02-14 09:42:26 +01:00
Gymnasiast
431c2a4e74 Temporarily fix #7173: cannot load saves into vanilla 2018-02-14 09:26:59 +01:00
Ted John
9cc8d36a03 Fix #7171: Clicking any ride that has custom designs crashes
Wrong argument was being passed to object_entry_get_entry.
2018-02-13 17:30:47 +00:00
Michael Steenbeek
a408747c4c Use object_entry_get_type() throughout 2018-02-13 16:42:18 +01:00
Ted John
928ae3b4cd Fix mistake in ObjectRepository::Create
Objects that could not be loaded were being returned with a success status causing blanks in the index file.
2018-02-12 21:22:27 +00:00
Ted John
0433803ae1 Use std::vector for ObjectManager 2018-02-12 17:15:15 +00:00
Ted John
7e01dcdaaf Remove legacy object list 2018-02-12 12:48:41 +00:00
Ted John
51321a71e7 Get entries directly from object manager 2018-02-12 12:48:41 +00:00
Ted John
d22572d0b9 Remove rct_object_entry_extended 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
Ted John
d905dde070 Simplify selected object flags 2018-02-12 12:48:41 +00:00
Gymnasiast
3261753510 Ignore missing STEX entries 2018-02-09 13:47:15 +01:00
Gymnasiast
b1ab852fb7 Add object_entry_get_type() 2018-02-09 13:47:15 +01:00
Ted John
142facb8a3 Remove Memory::Duplicate and Memory::DuplicateArray (#7142) 2018-02-07 19:56:46 +00:00
Gymnasiast
34a6b5ef92 Remove __cplusplus ifdefs 2018-02-05 16:20:15 +01:00
Gymnasiast
778ba466c5 Remove almost every extern C block 2018-02-05 16:20:15 +01:00
Ted John
0c71855769 Replace Memory::Copy with std::copy 2018-02-04 12:40:24 +00:00
Ted John
7851446a6f Replace Memory::Set with std::fill or similar 2018-02-04 12:35:02 +00:00
Michael Steenbeek
9bd812c855 Move most of _legacy.c to C++ (#7117) 2018-02-02 23:11:41 +01:00
Gymnasiast
1b2c1a4d83 Fix #7111: Path items appear twice in build menu
Issue caused by #7106 - fixed it for banners, but forgot to fix it for path bits as well.
2018-02-01 11:39:34 +01:00
Gymnasiast
4f647c24da Fix mistake in RCT1 object list [ci skip] 2018-01-31 22:09:12 +01:00
Gymnasiast
d6d9627d08 Make official object translations consistent, fix bug 2018-01-31 21:17:27 +01:00
Michael Steenbeek
b4018d398c Add more object source filters 2018-01-31 13:07:20 +01:00
duncanspumpkin
4d45053aec Name animation flags 2018-01-30 12:53:50 +00:00
duncanspumpkin
eb5f8485fa Name further entry flags 2018-01-30 12:53:50 +00:00
duncanspumpkin
addf087918 Rename additional_animation to animation as it makes more sense
Label all vehicle animation types based on loading relevant parks
2018-01-30 12:53:50 +00:00
duncanspumpkin
00a9ab1b17 Name every remaining vehicle entry offset!
Removed redundant comments as some were incorrect and its clear from the code now that the flags are named
2018-01-30 12:53:50 +00:00
duncanspumpkin
5401e69b50 Name vehicle animation offsets 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
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
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
a116bb530f Remove unused ORI_RIDE_FLAG_SEPARATE 2018-01-09 21:35:10 +01:00
Michael Steenbeek
6a88d6e04d Move and rename RCT{1,2,12}.h 2018-01-09 13:36:41 +01:00
Michael Steenbeek
7d5de63484 Refactor rct_research_item, refactor access to rct_research_item
This takes away a lot of the bitshift and bit mask trickery previously used.
2018-01-07 15:33:44 +01:00
Michael Steenbeek
755add6c9a Compile localisation folder as C++ 2018-01-06 18:32:25 +01:00
Ted John
3dcbebcf68 Refactor drawing.c to C++ 2018-01-05 22:57:57 +01:00
Ted John
02c58a6c5a Remove custom base Exception class 2018-01-05 18:11:47 +00: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
Michał Janiszewski
4d0c88fb94 Mark constructors explicit (#6928) 2018-01-04 01:12:34 +00: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
Gymnasiast
23d70a4ac9 Compile ride.c as C++ 2017-12-31 20:43:17 +01:00
Michael Steenbeek
c846d98516 Fix English descriptions of path additions and banners 2017-12-22 16:59:11 +01:00
Michael Steenbeek
2e79aaf54c Fold vehicle name into regular name 2017-12-22 15:28:41 +01:00
Hielke Morsink
3770b46e46 Replace 1 and 0 constants with bool where applicable 2017-12-21 23:47:30 +01:00
Hielke Morsink
628039dd8a Use range-based for loops in libopenrct2 2017-12-21 23:47:30 +01:00