Commit Graph

108 Commits

Author SHA1 Message Date
Ted John 7dc170ef85 Use shared_ptr for long-life objects
Use unique_ptr and shared_ptr for IContext, IPlatformEnvironment, IUiContext, and IAudioContext.
2018-05-11 20:37:48 +01:00
Hielke Morsink 8d10bfb5a1 Add namespace closing comments 2018-05-04 22:54:43 +02:00
Hielke Morsink bc44792da9 Pack nested namespaces together 2018-05-04 22:54:43 +02:00
Michał Janiszewski 9e1dfffee8 Remove unnecessary checks for __cplusplus 2018-03-14 22:11:30 +01:00
Michał Janiszewski 764520076f
Reduce header inclusion
* Update includes in PlatformEnvironment.cpp

* Update includes in ParkImporter.h

* Update includes of OpenRCT2.h

* Update includes in Intro.h

* Remove unused include from Input.cpp

* Update includes of Imaging.h

* Update includes in Game.h

* Update includes in Editor.h

* Update includes of Context.cpp

* Update includes in Cheats.cpp, CmdlineSprite.cpp

* Update includes of some source files

* Update includes in some cpp files

* Update includes in some cpp files

* Update includes in TextureCache.h

* Fix tests

* Update includes in Font.cpp

* Update includes in LightFX files

* Update some includes

* Fix GCC builds

* Update some includes

* Update some includes

* Update includes in FontsFamilies.*

* Update includes of Console.h

* Improve includes in Window.h

* Improve headers in Viewport.h/Window.h

* Fix MSVC build

* Fix network-less builds

* Reduce inclusion of Map.h
2018-03-13 13:14:02 +01:00
Michael Steenbeek ca5a1e1f34 Testpaint and MSVC fixes 2018-02-15 22:26:50 +01:00
Michael Steenbeek 45e892e5b5 Allow passing BigCoordsXY into map_get_surface_element_at() 2018-02-15 22:26:50 +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
Michał Janiszewski 0e032c9ca4 Avoid shifting negative values in Audio.cpp (#7147)
Rather than shifting negative values, which invokes undefined behaviour,
use a multiplication.
2018-02-08 07:47:35 +00:00
Gymnasiast 778ba466c5 Remove almost every extern C block 2018-02-05 16:20:15 +01:00
Ted John 6d63729a40 Fix MSVC 2018-01-18 22:59:30 +00: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
Ted John f18595a1c1 Refactor viewport.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
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
Gymnasiast 23d70a4ac9 Compile ride.c as C++ 2017-12-31 20:43:17 +01:00
Marijn van der Werf 0048ef091f Refactor direct access to window list 2017-12-25 15:06:06 +01:00
Hielke Morsink 628039dd8a Use range-based for loops in libopenrct2 2017-12-21 23:47:30 +01:00
Michael Steenbeek 1a9975d683 Compile util and cheats as C++ 2017-12-14 10:03:21 +01:00
Michael Steenbeek 6dc49d643a Compile files in base dir as C++ 2017-12-13 08:03:48 +01:00
Hielke Morsink 79aa4a99cf Use range-based for loops 2017-12-08 11:06:43 +01:00
Michael Steenbeek ce8d9cc71b Rename map_element to tile_element 2017-10-31 19:59:06 +01:00
Michał Janiszewski 8fd2266bda Refactor includes (#6512)
* Refactor Intent.h inclusion

* Use forward declaration of ITcpSocket

* Remove unused include

* Forward declare rct_ride_entry

* Remove unused headers

* Forward-declare rct_drawpixelinfo

* Remove unused headers

* Lower header include from header to source file

* Reduce included headers

* Reduce includes
2017-10-19 10:01:05 +02:00
Michael Steenbeek 7f9c25a7a9 Use constant for LOCATION_NULL, split off location stuff to Location.h 2017-10-13 22:23:07 +02:00
Michael Steenbeek 0fb5f186ee Do not hardcode music length 2017-10-02 21:40:49 +02:00
Michał Janiszewski 00fd18809c Move extern "C" {} blocks to headers (#6282) 2017-09-18 17:05:28 +02:00
Michał Janiszewski d698ad1100 Convert NULL -> nullptr in C++ 2017-08-15 11:51:56 +02:00
Michał Janiszewski 32407868cc Fix C mangling 2017-08-10 13:42:27 +02:00
duncanspumpkin 18d082053e Rename cpp files to use TitleCase 2017-08-04 18:12:54 +02:00
Ted John 8b2eb8a13e Move screen variables to OpenRCT2.h 2017-07-29 20:29:29 +01:00
Ted John e6e503a853 Move path related functions to Context.cpp
- rct2_init_directories
- get_file_path
2017-07-29 20:29:26 +01:00
ζeh Matt d45044239e Fix #5977: Custom music files not showing up in music list 2017-07-24 17:08:10 +02:00
rwjuk 2fb1e40f1a Guard against nullptr in AudioMixer.cpp 2017-07-05 09:32:50 +02:00
Gymnasiast 2f3b5d1c7a Add IDs for null sound IDs 2017-06-25 20:45:38 +02:00
Michael Steenbeek 1f00469b26 Replace free+null with SafeFree, allow freeing NULL
free(NULL) is perfectly fine, no need to check
2017-06-22 12:49:33 +02:00
Ted John 7e9f7df7d1 Use standard platform defines 2017-06-12 18:01:51 +01:00
Ted John 47e6f1d139 Rename our version of SDL_MIX_MAXVOLUME to MIXER_VOLUME_MAX
Keep an assert to make sure its the same as SDL in the mixer. If SDL changes it, we can either change ours or convert the number proportionally.
2017-06-10 17:14:07 +01:00
Ted John 94e982289e Fix openrct2-cli build
By using a dummy audio context, we can now make openrct2-cli start a headless instance without any SDL2 calls. SDL2 is still a dependency until we remove out the input code to openrct2-ui.
2017-06-04 00:18:26 +01:00
Michał Janiszewski 79d76759bb Fix #5516: Update copyrights for 2017
Not all files were necessarily _changed_, but all were touched, see
https://github.com/OpenRCT2/OpenRCT2/pull/4932
2017-06-01 21:55:10 +02:00
Ted John ee9aa55083 Fix more warnings 2017-05-29 22:38:45 +02:00
Michał Janiszewski e670a386ba Add cmath include to AudioMixer for std::pow 2017-05-29 22:38:44 +02:00
Ted John 0440c3deea Clean up audio.cpp 2017-05-29 22:38:43 +02:00
Ted John e426c70bbc Get moved audio code linking 2017-05-29 22:38:43 +02:00
Ted John d206d181f2 Move audio code to UI project 2017-05-29 22:38:43 +02:00
Ted John 175606ae52 Create new audio context interface 2017-05-29 22:38:43 +02:00
Ted John bd9839ff50 Get the game working
Mostly just needed to resolve screen size which is now retrieved via ui context.
2017-05-29 22:38:43 +02:00
Ted John f736e8ff96 Move more platform code to UiContext 2017-05-29 22:38:42 +02:00
Ted John 75e0c94082 Fix mute / unmute logic 2017-04-30 18:03:25 +01:00
Ted John fb2c835d52 Include new config header 2017-02-18 15:45:10 +00:00
Ted John 6efb94bbe4 Prevent C++ exceptions when getting custom.wav info 2017-02-12 13:32:39 +00:00
Ted John 7671b21682 Convert audio.c to C++ so RWops can be removed 2017-02-12 10:40:32 +00:00
Ted John 0d51bdde3f Fix broken code alignment 2017-01-14 23:40:46 +00:00
Broxzier 60603ae10a Use types from common.h 2017-01-14 12:37:31 +01:00
Michał Janiszewski 0a36af19e4 Mark classes as final to help devirtualisation 2017-01-13 12:12:50 +01:00
Ted John ab4bb3101c Use static inline 2017-01-12 18:29:29 +00:00
Ted John e67d8b4122 Use inline instead of static for header C functions 2017-01-12 12:28:19 +00:00
Ted John 25bc798ff8 Move contents of src into project sub directory 2017-01-04 17:44:12 +00:00