Commit Graph

415 Commits

Author SHA1 Message Date
Ted John 45d32bec68
[Plugin] Add API for taking captures and giant captures of the park 2020-05-09 13:55:24 +02:00
Ted John 51ed760409 Fix FileWatcher header file 2020-04-26 14:35:09 +01:00
Ted John 127dd1543e Disable FileWatcher for macOS 2020-04-26 14:35:08 +01:00
Ted John 2f525e0539 Apply more code review comments 2020-04-26 14:35:07 +01:00
Ted John d480fb8daa Apply suggestions from code review
Co-Authored-By: Tulio Leao <tupaschoal@gmail.com>
Co-Authored-By: Michael Steenbeek <m.o.steenbeek@gmail.com>
2020-04-26 14:35:07 +01:00
Ted John 62d15e44db Fix mingw build 2020-04-26 14:35:07 +01:00
Ted John e6341f0a42 Get scripting compiling on clang 2020-04-26 14:35:03 +01:00
Ted John 4109b2c55a Fix build errors 2020-04-26 14:35:01 +01:00
Hielke Morsink e8bdb95f13 format new files
Since many of the changes were made before the clang-format changes went live, the new source files used a different format still. This PR applies the new style to all the new source files.
2020-04-26 14:35:00 +01:00
Hielke Morsink c064614280 Use new copyright/license notice 2020-04-26 14:35:00 +01:00
Ted John 5ba96a34ac Fix FileWatcher for Windows 2020-04-26 14:35:00 +01:00
Ted John 1fd33dd86a Use new FileWatcher class 2020-04-26 14:35:00 +01:00
Ted John 834cfad502 Create new FileWatcher class 2020-04-26 14:34:59 +01:00
FlukiestEmperor 23d295924d
Fix Android filesystem compilation error when using NDK revision 19+
When attemping to build with ndk 19+ I get the following error: error: undefined reference to 'std::__ndk1::__fs::filesystem::path::__extension() const'

Looking at this issue here https://github.com/android/ndk/issues/609 and https://android.googlesource.com/platform/ndk/+/master/docs/Roadmap.md#package-management it's stated that the ndk does not support std::filesystem.
2020-04-24 13:08:44 +02:00
Michael Steenbeek f5e2efac77
Close #11390: Write OpenRCT2 build hash to screenshot metadata (#11423) 2020-04-24 04:00:17 +02:00
Michał Janiszewski 2323cc1596
Use named casts instead of old-style casts
Change prepared with clang-tidy and google-readability-casting check
2020-04-22 17:09:29 +02:00
Michał Janiszewski 5f97637d5e Only suggest final when using non-LTO builds
In LTO builds GCC issues the suggestion-warning from linking stage,
when pragmas are already gone and do nothing.
2020-04-21 13:31:01 +02:00
Michael Steenbeek 4f86d0115c
Merge pull request #10866 from Gymnasiast/refactor/more-tile-element-prep
Refactor/more tile element prep
2020-03-06 09:25:32 +01:00
Michał Janiszewski 92e5958ab6
Improve WinNT 5.1/MinGW support (#10869) 2020-03-05 19:35:23 +01:00
Gymnasiast 3ed7694495
Move tile element-specific flags 2020-03-04 22:01:09 +01:00
ζeh Matt 12ab1e9633
Fix #10713: Correctly encode network ride id over network (#10802)
It byte swapped uint16_t and then during decode byte swapped it as uint32_t, now it always uses uint32_t for ride/player id. I could use the underlying type but that would require to re-create all replays again.

Closes #10713
2020-02-21 18:11:26 +01:00
Tulio Leao 0c4623a39f
Replace typedef aliasing by using (#10712) 2020-02-17 11:43:47 +01:00
Michał Janiszewski 38907fd0c7
Fix memory leaks around PNG/sprite handling (#10711) 2020-02-16 07:25:30 +01:00
Ted John 4e032aeff0 Improve WinHttp code 2020-02-08 18:11:08 +00:00
Ted John 4af69555d1 Improve WinHttp logic / code 2020-02-08 17:47:03 +00:00
Ted John be9cb19df5 Replace cURL with WinHttp implementation on Windows
This reduces the number of third party dependencies for Windows builds. WinHttp is quite a nice straight forward API so doesn't involve too much extra code.
2020-02-08 17:47:03 +00:00
Ted John b76092eda3 Fix mingw 2020-02-05 22:39:22 +00:00
Ted John d6da718717 Link to bcrypt instead of ncrypt 2020-02-05 21:24:31 +00:00
Ted John 0cc02f397e Fix guards on crypto implementations 2020-02-05 08:04:05 +00:00
Ted John 57a758b9c0 Get all crypto tests passing 2020-02-05 02:09:19 +00:00
Ted John e2a541bff4 Get import / export of public key working 2020-02-05 00:36:41 +00:00
Ted John c8ef6233aa Add CNG implementation of crypto functions 2020-02-04 22:49:43 +00:00
Gymnasiast ca2f37ae7f
Remove opt::optional polyfill
std::optional is supported by Xcode 10. The non-polyfill variant was already used in our code, so this is not likely to break anything that wasn't broken before.
2020-02-01 22:25:03 +01:00
Michael Steenbeek 77d18a664b
Implement #10358: Clean up leftover references to openrct2.website 2020-01-13 20:20:49 +01:00
ζeh Matt 2242a72b29 Add assertion failure reason to the Backtrace service integration (#10562) 2020-01-13 19:22:45 +01:00
Ted John 171969f5fb Fix #10496: Game can't handle path with non-english string 2020-01-11 00:43:00 +00:00
Tulio Leao 6cdbb901a5 Fix C26439 SPECIAL_NOEXCEPT 2019-12-27 15:05:27 -03:00
nia 1f220f2d62 Simplify OS-specific FileStream code (#10270)
Define ftello/fseeko to ftello64/fseeko64 only on Linux,
these functions are Linux-specific extensions.

Define ftello/fseeko to _ftelli64/_fseeki64 on MSC.

Otherwise, just use the standardized ftello/fseeko, and avoid
duplicating code for different names of the same function.

This allows this code to be reused on e.g. NetBSD without piling
on additional #ifdefs for any other POSIX operating systems.
2019-12-19 18:34:31 +01:00
duncanspumpkin df5d5f4eb1 Fix the logging once and for all 2019-12-15 16:48:14 +00:00
duncanspumpkin cfb4bba721 Remove todo and clang format where required
Change array type to avoid additional code

Make CI's happier
2019-12-15 08:21:32 +00:00
duncanspumpkin 7dbf0353ff Serialise scenery, mazes, entrances 2019-12-15 08:21:32 +00:00
duncanspumpkin 83503f4c69 Serialise track design. Start work on making it work
Fix track designs issuing extra game actions
2019-12-15 08:21:32 +00:00
tjwrona1992 5f41e9df38 Add missing include for std::max to fix VS16.4.0P2 compilation (#10282)
* Fix errors where "std::max" was not recognized while compiling with the latest Visual Studio (2019 16.4.0 Preview 2.0) due to a missing "#include" statement.

* Ran clang-format.
2019-11-24 08:12:50 +01:00
Paweł Bylica 7e7e088d8e
Use fs::path for some implementations in Path 2019-11-21 13:40:21 +01:00
Paweł Bylica 45002d723a
Add core/FileSystem.hpp for accessing std::filesystem
This file enables access to std::filesystem as `fs` namespace
or injects third-party drop-in replacement on build configs
where std::filesystem is not available.
2019-11-21 13:40:20 +01:00
ζeh Matt f6a23fd5f5 Add compile time selection for copying data with specialised paths (#9331) 2019-11-09 15:54:43 +01:00
Michał Janiszewski afc92ee15a
ifdef-out WinNT 6.0+ APIs (#10198)
Occasionally I need to build a binary compatible with WinNT 5.1, e.g.
when testing out Wine or ReactOS. There are just a few minor changes
required to have a working build, but as they are not part of the
repository, I always end up doing them from scratch. I would like to
upstream them instead so I don't have to recreate them each time, even
if this is not the most common use case.
2019-11-08 23:16:15 +01:00
Richard Fine 0e04dbeea1 Allow SwapBE to swap non-uint types
If we want to have more semantically meaningful types (like Direction), it's useful to be able to support those in the DataSerializer too. Swapping bytes for entire structures is probably never going to make sense, but for types that are pure wrappers around integer types, we want to be able to swap them as if they were the integer they wrap.
2019-09-01 18:40:11 +01:00
Gymnasiast 6e200459d3
Refactor some accessors to tile element type and flags fields 2019-08-24 22:42:47 +02:00
r0 54dc91511e Avoid redefining JobPool::AddTask 2019-08-19 19:03:27 +02:00
ζeh Matt 7730b35d82
Merge pull request #9571 from ZehMatt/replay-cleanup
Replay cleanup
2019-08-05 18:31:03 +02:00
Ted John 6fff2079f9 Refactor ride name to dynamic args and std::string 2019-07-29 19:18:16 +01:00
Matt 8ab0ca4f8f
Fix DataSerialiser returning the wrong stream object 2019-07-27 16:06:26 +02:00
Ted John a1d9e52046 Rename ToUtf16 to ToWideChar
This is more correct as wchar_t size can differ, for example Linux typically uses 32 bits for wchar_t where as Windows uses 16 bits.
2019-07-22 23:44:03 +01:00
Ted John 6f61c94dbd Remove old widechar <-> utf-8 conversion function 2019-07-22 23:44:03 +01:00
duncanspumpkin 96ec0123ca Refactor and clean up for CI's. 2019-06-11 18:43:23 +01:00
duncanspumpkin 3162d4dc75 Implement TileModifyAction
Further work moving game commands into the game action framework
2019-06-11 18:42:52 +01:00
aw20368 df263eb1f6 Fix #5896 Fences not always removed when building a tracked ride through (#9341)
Fence removal did not account for track direction. Added the rotation for the track/fence intersection test.
2019-06-04 23:27:36 +02:00
ζeh Matt f7bd6d516a Fix #9267: Only check if a file is a directory before opening it (#9269) 2019-05-16 08:05:09 +01:00
ζeh Matt 0ff19f071f Fix #9240: crash when passing directory instead of save file 2019-05-13 21:34:58 +02:00
Ted John f8e3abcf4e Remove by-reference string_view 2019-05-12 00:51:33 +01:00
Ted John 123a8eacad Get the server list showing LAN servers 2019-05-12 00:51:33 +01:00
ζeh Matt c8f822ea70
Gamestate snapshots (#8819)
* Add initial interface.

* Implement move operator in MemoryStream

* Add pod array serialisation traits.

* Add push_back with move semantics to CircularBuffer

* Initial implementation of GameStateSnapshots

* Add GameStateSnapshots to Context.

* Add mp_desync console command.

* Compare sprite data and fill change list.

* Minor changes.

* Proof of concept.

* Calculate offset instead of using offsetof

* Implement game state difference detection

* Update mp_desync console command.

* Fix identification of sprite remove/add.

* Fix crash when only one peep in park when using mp_desync

* Output state differences into user directory desync folder.

* Add desync debugging as an option.

* Add information to network status when a desync report was created.

* Cast to proper type for %llu.

* Update xcode project

* Add more information to the diffed data.

* Remove client-only relevant fields.

* Cleanup.

* Add better name output for misc sprites

* Add srand0 and tick information to the output

* Bump up network version

* Cleanup

* Set desync_debugging to false as default

* Apply suggestions
2019-05-11 21:31:34 +02:00
ζeh Matt cd8c67ddac
Implement SetCheatAction. (#8990)
* Implement SetCheatAction.

* Bump up network version
2019-05-04 15:28:38 +02:00
Tom Lankhorst 63a38412aa Add `optional` header 2019-05-02 22:53:19 +02:00
hokasha2016 6022521118 Fix #7871: String::StartsWith() returns true if source is shorter than match 2019-04-20 18:55:27 +02:00
Matt 37c3809744 Implement partial multicore rendering 2019-03-31 15:50:55 +02:00
Aaron van Geffen 2af13904c5 Update copyright notices for 2019. (#8903) 2019-03-17 07:16:15 +00:00
duncanspumpkin 540be7c7be Provide a conversion from old game command.
Note doesn't handle footpath scenery or clear direction mode
2019-03-04 16:57:21 +00:00
duncanspumpkin ef69c01da5 Create FootpathSceneryRemoveAction to split up footpath place 2019-03-04 16:57:21 +00:00
duncanspumpkin e128a78b91 Fix formating and other issues
Refactor as per comments.

Simplified some of the code as well

Use constants
2019-03-02 07:24:42 +00:00
duncanspumpkin 7f586f50e1 Move all callees to the game action framework. Fix CoordXY bug 2019-03-02 07:24:41 +00:00
duncanspumpkin 650e8291d0 Start moving track place into GameAction framework 2019-02-19 12:30:33 +00:00
Michał Janiszewski 838289abce Mark functions as static 2019-02-10 00:20:34 +01:00
duncanspumpkin 44cd8c3150 Refactor. Add CoordsXY to data serialiser 2019-02-08 14:08:26 +00:00
Matt 598ea08529 Update copyright. 2019-02-07 18:50:58 +01:00
Matt 0d1c8b8d31 Fix CircularBuffer push_back method. 2019-02-07 18:50:58 +01:00
Matt a26e9231cf Simplify CircularBuffer 2019-02-07 18:50:58 +01:00
Matt e4f1b12fa4 Add CircularBuffer. 2019-02-07 18:50:58 +01:00
Tom Lankhorst 045692993a
Make template params adhere to code style 2019-02-03 21:16:09 +01:00
Tom Lankhorst 422d5f2ef1
Replace '_N' by '_num' 2019-02-01 21:54:00 +01:00
Tom Lankhorst 1e65db371b
Use single underscore prefix for template parameters 2019-02-01 21:51:01 +01:00
Tom Lankhorst dfe7f0614c
Consistency 2019-02-01 21:00:19 +01:00
Tom Lankhorst 16691b22ba
Use state struct 2019-02-01 19:29:43 +01:00
Tom Lankhorst 2ea347f15f
MSVC SFINAE compatibility 2019-02-01 15:50:09 +01:00
Tom Lankhorst 1a81d60609
Expose gScenarioRand, add <algorithm> 2019-02-01 14:48:45 +01:00
Tom Lankhorst 6a42a95495
Refactor random engine
Introduce RotateEngine and Rct2Engine, FixedSeedSequence and Rct2Seed.
Adhere respectively to requirements `RandomNumberEngine` and `SeedSequence`.
Can be used with C++11 adaptors and distributions in <random>.
2019-02-01 14:32:04 +01:00
Tom Lankhorst 4c015edaf6 Templatise `rorN` and `rolN` with `N` in {8, 16, 32, 64} 2019-01-28 10:55:24 +01:00
IntelOrca b9fd90ffd3 Implement ClearAction. 2019-01-07 09:04:51 +01:00
Michał Janiszewski 7e769ed662 Fix #7536: Android build fails to start (#8554)
This was a regression from #7435 which introduced threads and caused JNI
to misbehave and fail to load our expected classes. Provide a workaround
based on the description in https://stackoverflow.com/a/16302771 which
stores a main thread's class loader and uses that in neighbouring
threads.
2019-01-04 19:48:26 +01:00
Matt fc4e45562d Use stringstream to log integral values. 2019-01-02 06:39:59 +01:00
Matt a8254aa292 Add 64 bit serialisation support. 2019-01-02 05:18:36 +01:00
Matt ccc3227113 Cleanup. 2018-12-29 19:23:27 +01:00
Matt f6dbf5f1a2 Add std::array serialiser support. 2018-12-29 19:23:27 +01:00
Matt 000a9694f9 Fix DataSerialiser not accepting temporary values. 2018-12-29 19:23:27 +01:00
Matt a6efef1e81 Add support to record and replay game commands/actions. 2018-12-29 19:23:27 +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 354d973a48 Use std::size instead of Util::CountOf 2018-11-23 21:59:08 +01:00
ζeh Matt 1abb31a159 Implement game action logging. (#8138) 2018-11-20 06:04:42 +01:00
Michał Janiszewski 180655dafa
Fix printf format specifiers (#8160) 2018-10-26 06:09:12 -07:00
Michał Janiszewski d5be45e27a
Add missing argument to format (#8082) 2018-10-11 06:20:01 +02:00
Ted John b9c2fdedd1 Resolve absolute path when indexing files
This ensures scenarios are displayed with their full path in the scenario select window rather than as specified in config or command line.
2018-09-08 22:17:21 +01:00
Michael Steenbeek 13c326eb50
Fix part of #7415: Korean scenario descriptions are mangled
OpenRCT2 used to incorrectly write UTF-8 to SV6 names and descriptions. This fixes reading such scenarios. It should also fix the game crashing when attempting to load such a scenario.

What this doesn't do is add support for the encoding that vanilla used for CJK, or add support for creating scenarios with Korean descriptions. That will only be feasible when switching to our own format.
2018-08-13 15:53:44 +02:00
Linus Unnebäck 2b3370228b
Remove the last usage of Math.hpp 2018-08-12 16:47:12 +01:00
Linus Unnebäck fd07be587a
Remove Math::Clamp in favour of std::clamp 2018-08-12 16:47:12 +01:00
clang-format d787872cbe Indent preprocessor directives 2018-07-23 16:00:23 +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
clang-format 3a4a11f738 clang-format core 2018-07-23 16:00:03 +02:00
Hielke Morsink ce59ed0ba2 Fix include order and defines for Windows builds 2018-07-23 15:57:59 +02:00
Øystein Dale de464e2783 Use a better constructor in StringBuilder::GetStdString 2018-07-18 23:57:11 +02:00
Øystein Dale 934e53869c Fix memory leaks in localisation
Assigning a pointer to std::string appears to only perform a copy and
does not transfer ownership of the pointer, thus the allocated memory is
will never be freed.

Implement a method to construct an std::string from a StringBuilder to
avoid memory leaks when retreiving the contents of a StringBuilder and
storing it in a std::string.
2018-07-18 00:07:48 +02:00
Ted John f728a5074a
Fix #7765: Crash when opening ride list window on Windows Vista (#7781)
It has been reported that Windows Vista crashes in LCMapStringEx when
using LOCALE_NAME_INVARIANT even though it is documented as supported.

As a counter measure, use LOCALE_NAME_USER_DEFAULT for the time being.
2018-07-14 08:52:12 +01:00
Aaron van Geffen f963f969c1
Fix compilation on Linux, macOS. (#7732) 2018-06-26 11:16:03 +02:00
Ted John 0f2ccebfe7 Fix #7533: Screenshot is incorrectly named in CJK
For Windows, convert path to UTF-16 before passing to fstream constructor.
2018-06-25 18:14:55 +01: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 7373987f0a
Merge pull request #6978 from tobiaskohlbau/refactor/network
HTTP: Refactor into modern C++
2018-06-12 21:50:46 +01:00
pkubaj 7fbbce5712 Include cstddef
This fixes compilation on FreeBSD and LLVM 6.0.
2018-06-12 14:38:59 +02:00
Tobias Kohlbau 62c25d88fb HTTP: refactor http into modern C++
Signed-off-by: Tobias Kohlbau <tobias@kohlbau.de>
2018-06-11 10:24:19 +02:00
Michał Janiszewski 1d28826b79 Fix -Wdocumentation and add it to default warnings 2018-06-11 09:52:54 +02:00
Aaron van Geffen ee4b8c11ae Prevent invoking a copy constructor in some ranged for loops. 2018-06-08 22:29:42 +02:00
Michał Janiszewski 320eee0d59
Fix -Wunreachable-code-break and add it to deafult warnings (#7634) 2018-06-06 22:30:21 +02:00
Hielke Morsink 5d0022a5cb Remove argument list from zero-initializers with zero/false/nullptr value 2018-06-04 19:50:46 +02:00
Ted John a413d43cda Fix mingw 2018-06-01 22:44:25 +01:00
Aaron van Geffen 53b66fd250 Add Crypt files to Xcode project. 2018-06-01 22:41:42 +02:00
Ted John ae81af7965 Fix Linux 2018-06-01 21:28:27 +01:00
Ted John 72293f2208 Implement new Crypt code and remove CNG for now 2018-06-01 21:27:34 +01:00
Ted John b8d37548ed Implement PEM writing for CNG implementation 2018-06-01 21:27:34 +01:00
Ted John 9467438c1c Implement PEM reading for CNG implementation 2018-06-01 21:27:34 +01:00
Ted John 3b2b15c0f3 Implement CNG implementation bar pem reading 2018-06-01 21:27:34 +01:00
Ted John 9e214258c3 Finish OpenSSL RSA implementation 2018-06-01 21:27:33 +01:00
Ted John fe7e8a17de Start implementing RSA for OpenSSL 2018-06-01 21:27:33 +01:00
Ted John 865bfb7b1b Refactor implementations to different files 2018-06-01 21:27:33 +01:00
Ted John ea22c672d0 Only reuse CNG object if Windows 8+ 2018-06-01 21:27:33 +01:00
Ted John 320b149b58 Change Windows builds to use CNG API 2018-06-01 21:27:33 +01:00
Ted John f880290b00 Create WinSSL implementation and refactor to class 2018-06-01 21:27:33 +01:00
Aaron van Geffen b836ad050d Rewrite CodePageFromUTF8 as CodePageFromUnicode. 2018-05-22 19:51:34 +02:00
Aaron van Geffen 3fd75906b6 Fix String::ToUtf8 and String::ToUtf16 on Linux.
wchar_t typically uses UTF-32 codepoints on Linux, unlike Windows, which uses UTF-16.
2018-05-22 19:51:34 +02:00
Aaron van Geffen bab66d1eaf Fix MinGW compilation. 2018-05-22 17:37:07 +02:00
Ted John 71a2cb46d2 Fix ToUpper tests on Windows
LCMapStringEx does not unfold ligatures if there is no uppercase equivalent.
2018-05-22 17:37:07 +02:00
Aaron van Geffen 13e35285f1 Replace non-Windows versions of ToUtf8 and ToUtf16 with ICU calls. 2018-05-22 17:37:07 +02:00
Ted John 6109a9bf17 Improve Windows implementation of ToUpper 2018-05-22 17:37:07 +02:00
Ted John 085d85585a Use Windows API for utf8-utf16 conversions 2018-05-22 17:37:07 +02:00
Aaron van Geffen 8e919d2f84 Change ICU variant of String::ToUpper for string_view argument. 2018-05-22 17:37:07 +02:00
Ted John 386ab1b0fa Add windows implementation for ToUpper 2018-05-22 17:37:07 +02:00
Fusxfaranto a91dd6a356 Implement ICU support for uppercasing, with tests. 2018-05-22 17:37:07 +02:00
Aaron van Geffen f29b42cc26 Allow converting strings between code pages in both directions.
Co-authored-by: Fusxfaranto <fusxfaranto@gmail.com>
2018-05-22 17:37:07 +02:00
Aaron van Geffen ea80f0ea56 Split off GetIcuCodePage to its own function. 2018-05-22 17:37:07 +02:00