Commit Graph

7964 Commits

Author SHA1 Message Date
Ted John ca27018231 Fix x86 build 2016-12-16 01:25:04 +00:00
Ted John 7ddc7a6664 Remove old title sequence code 2016-12-16 01:25:04 +00:00
Ted John 9ce926db92 Fix sequence command editor window 2016-12-16 01:25:04 +00:00
Ted John e74cb7ac2a Fix LOAD commands after removing a park from sequence 2016-12-16 01:25:04 +00:00
Ted John 2c0786eb24 Refactor platform calls to File 2016-12-16 01:25:04 +00:00
Ted John 921c7596df Fix deleting parks from sequence 2016-12-16 01:25:04 +00:00
Ted John 5443ff61cc Fix add park to sequence 2016-12-16 01:25:04 +00:00
Ted John 55fc9c8a4a Refactor widget enum 2016-12-16 01:25:03 +00:00
Ted John 67637ab2da Fix duplicate saving to wrong directory 2016-12-16 01:25:03 +00:00
Ted John 0ae369ff62 Fix deleting of commands 2016-12-16 01:25:03 +00:00
Ted John a0c8c80126 Fix moving commands around and saving the sequence 2016-12-16 01:25:03 +00:00
Ted John 20ea3edef2 Fix rebase errors 2016-12-16 01:25:03 +00:00
Ted John 11a2b98e58 Remove title editor specific code from loadsave window
This involved removing any logic performed in loadsave for loading saved games and moving them to callback routines for all uses.
2016-12-16 01:25:03 +00:00
Ted John 877080f00c Fix creation of new title sequence 2016-12-16 01:25:03 +00:00
Ted John 975cb43137 Fix creation of new title sequences 2016-12-16 01:25:03 +00:00
Ted John a66ce50db8 Fix duplicate sequence 2016-12-16 01:25:03 +00:00
Ted John 2810d09dc6 Fix loading of saved games from title editor 2016-12-16 01:25:03 +00:00
Ted John 3ea81e3b8b Get rename and delete working 2016-12-16 01:25:03 +00:00
Ted John 821b091b25 Clean up title editor some more 2016-12-16 01:25:03 +00:00
Ted John 63c93f22b3 Fix seeking 2016-12-16 01:25:03 +00:00
Ted John 20d2ff56f8 Refactor title editor window 2016-12-16 01:25:02 +00:00
Ted John afdd45f3cc Refactor title sequence player to new class 2016-12-16 01:25:02 +00:00
Ted John ccd8cff296 Get title sequence editor kind of working 2016-12-16 01:25:02 +00:00
Ted John 867eeb91a6 Implement zip writing and title sequence saving 2016-12-16 01:25:02 +00:00
Ted John be2dd99703 Extract zip handling to interface 2016-12-16 01:25:02 +00:00
Ted John 52ffd5b521 Reinstate support for title sequence folders 2016-12-16 01:25:02 +00:00
Ted John bf34920a0b Handle broken title sequences 2016-12-16 01:25:02 +00:00
Michał Janiszewski 80bab643f8 Fix compilation errors with GCC 2016-12-16 01:25:02 +00:00
Ted John e62629c6e3 Scan user path as well for sequences 2016-12-16 01:25:02 +00:00
Ted John a9cfd01c6e Fix sequence selection 2016-12-16 01:25:02 +00:00
Ted John 2686348bba Sort sequences correctly 2016-12-16 01:25:01 +00:00
Ted John 3657ae1181 Refactor title.c, don't bother with byte script anymore 2016-12-16 01:25:01 +00:00
Ted John fb89826280 Get parks loading from ZIP working 2016-12-16 01:25:01 +00:00
Ted John 0c51dee94d Refactor a large amount of title sequence loading
Still not yet able to load parks from zip.
2016-12-16 01:25:01 +00:00
Ted John e6377b40ef Write new code for loading title sequence ZIPs 2016-12-16 01:25:01 +00:00
Ted John af653a654e Read script.txt from zip files 2016-12-16 01:25:01 +00:00
Ted John c8dbc24ceb Enable all C++ features for MSVC 2016-12-16 01:19:41 +00:00
Michał Janiszewski d9ca477655 Drop unused RCT_CALL* wrappers 2016-12-15 16:08:11 +01:00
Ted John a7a006f30d Remove obsolete assert 2016-12-14 10:34:22 +00:00
Ted John 15877fcc60 Fix code style 2016-12-14 00:36:12 +00:00
Ted John 56b17310ee Fix writing of string values to console 2016-12-14 00:32:06 +00:00
Ted John 62c088862b Fix case of openrct2.h 2016-12-14 00:32:06 +00:00
Ted John e4345c3d11 Refactor PlatformEnvironment 2016-12-14 00:32:06 +00:00
Ted John 3e21e56b9e Use correct directory base 2016-12-14 00:32:06 +00:00
Ted John 7811987ad1 Use PlatformEnvironment for track design repository 2016-12-14 00:32:06 +00:00
Ted John cc227b7761 Create repositories in OpenRCT2.c 2016-12-14 00:32:06 +00:00
Ted John 7410326fcc Refactor OpenRCT2.cpp 2016-12-14 00:32:06 +00:00
Ted John abc3835d7b Rename openrct2.c h to OpenRCT2.c h 2016-12-14 00:32:06 +00:00
Ted John 1c0e09f68a Use PlatformEnvironment for ScenarioRepository 2016-12-14 00:32:06 +00:00
Ted John c3285ef8f5 Use enum class instead of enum 2016-12-14 00:32:06 +00:00
Ted John e9c778e886 Use IPlatformEnvironment for ObjectRepository 2016-12-14 00:32:06 +00:00
Ted John fd6a750f4e Add PlatformEnvironment implementation 2016-12-14 00:32:06 +00:00
Ted John 590ecf2775 Add PlatformEnvironment interface and enums 2016-12-14 00:32:06 +00:00
Ted John 018c0d5082 Fix #4874: OpenRCT fails to launch if no .config folder exists...
Change platform_ensure_directory_exists to create the directory chain given, e.g. mkdir -p.
Based on https://gist.github.com/JonathonReinhart/8c0d90191c38af2dcadb102c4e202950.
2016-12-13 23:00:37 +00:00
Ted John 1935f79507 Don't return pointer to local variable 2016-12-13 21:48:27 +00:00
Michael Steenbeek 73a131e87f Merge branch 'develop' into pathfind_history_fixes 2016-12-12 13:44:19 +01:00
Duncan 35472fe6e2 Fix #4819. Prevent peep queue loops when next_in_queue broken. 2016-12-12 09:33:55 +01:00
Ted John cef2587119 Move RCT2 file copy into rct2.c 2016-12-11 12:16:47 +00:00
Ted John 0019827d6c Refactor sprite tween logic out openrct2.c 2016-12-11 12:16:47 +00:00
Ted John e9bafc2973 Refactor RCT2 interop code to new source 2016-12-11 12:16:43 +00:00
Ted John c6dda4e614 Fix #4863: Build fails when using VS 2017 RC 2016-12-10 00:36:59 +00:00
wolfreak99 d1d6be0b93 Clip all scenery images in scenery window to prevent overflow/overlap 2016-12-08 20:10:16 +01:00
n42k bd02f14699 Fix platform_get_locale_temperature_format() in windows.c 2016-12-08 12:09:21 +00:00
Yaroslav Tretyakov 51fcfe3379 Fix #4852: Clicking on the hook icon for a person does not return it to the original location (#4854) 2016-12-07 22:28:55 +01:00
Michał Janiszewski cbd64af113 Merge pull request #4835 from janisozaur/tests
Add tests
2016-12-04 18:55:02 +01:00
Michał Janiszewski d2e1857733 Fix #4793: Inventions list broken
This reverts commit 3f767ed8ff and replaces it with exact check that
doesn't trigger array-bounds GCC warning with `-O3`
2016-12-04 12:03:32 +01:00
duncanspumpkin 7917d189cb Readd addresses header to allow RCT2 builds 2016-12-03 07:19:43 +00:00
Ted John 7557d9ca07 Abort if assert is hit in tests 2016-12-02 21:49:44 +00:00
Ted John 433207dc81 Do not assert when testing 2016-12-02 17:18:45 +00:00
zaxcav 1df30e55d2 Fix CI errors
Missing #if on some debug code.
2016-12-02 13:18:20 +01:00
zaxcav 11174af00b Increment network version for pathfinding fixes. 2016-12-02 11:00:57 +01:00
zaxcav 5ff6199ba1 Changes/additions to the pathfinding logging messages.
Refactored some code into functions for enabling/disabling pathfinding debugging for a specific peep.

Some new log messages for improved clarity when debugging pathfinding.

Added a #define to independently enable/disable pathfinding debugging to be friendly to others using debugging builds.
2016-12-02 10:55:40 +01:00
zaxcav 2f4c5c4a06 Reset pathfind_goal when choose direction fails.
Currently pathfinding falls back to aimless movement in this case.

Resetting the pathfind_goal (which in turn will cause the pathfind_history to be reset) makes the pathfinding try again afresh the next time around.

Potentially useful for adjusting to path changes by the player and recovering from a stuck position due to earlier bad pathfinding.
2016-12-02 10:49:15 +01:00
zaxcav f0cf7c2763 Fix loop detection in heuristic search based on pathfind_history.
In the existing version, returning to a junction in the pathfind history is considered a loop.  This is not useful as it prevents the pathfinding from backtracking, which is what the pathfind_history is intended to allow.

Updated to consider it a loop only when returning to a junction with no more edges left to try.
2016-12-02 10:23:56 +01:00
zaxcav dd89a32016 Reset pathfind_history[i].direction when all directions have been tried.
When choosing a direction at a junction in pathfind_history (with no untried directions) the existing path finding falls back to aimless movement.

This change makes the pathfinding try again.

Useful for adjusting to path changes by the player and recovering from a stuck position in a savegame due to earlier bad pathfinding.
2016-12-02 10:20:49 +01:00
zaxcav b83ab8d6e7 Reset pathfind_history before the heuristic search function is called.
Now that the heuristic search uses the pathfind_history for loop detection it is important that when the pathfind_goal is reset the pathfind_history gets reset before calling the heuristic search.
2016-12-02 10:15:33 +01:00
zaxcav afcf48080c When choosing a direction, repair pathfind_history[i].direction.
Remove directions that are not permitted by the path element(s) at that location.
2016-12-02 10:10:23 +01:00
zaxcav 307ebc38be Fix initialisation of junctions added to pathfind_history.
Fix initialisation of junctions added to pathfind_history.
2016-12-02 09:57:19 +01:00
zaxcav c2d9c7a6d4 Make path finding aware of ALL path elements when choosing a direction.
This is applicable for overlaid paths placed with zero clearance.

Previously the pathfinding only used the first path element.

Notes:

1. Logic related to path slope still only uses the the first path element.  Overlaying path elements with the same base height but different slopes may cause pathfinding glitches.

2. The heuristic search already uses a similar approach - the inconsistency could have caused pathfinding glitches.
2016-12-02 09:50:39 +01:00
Ted John a08af1a253 Get tests to build for Windows and VS 2016-12-02 00:34:14 +00:00
Michał Janiszewski 1ae2ca54f7 Sort includes 2016-12-01 16:03:16 +01:00
Michał Janiszewski 37c9bbd513 Extract format_codes to its own file 2016-12-01 16:03:16 +01:00
Michał Janiszewski afdc1457d5 Move font-related code out from language.cpp 2016-12-01 16:03:16 +01:00
Michał Janiszewski 54e622659d Extract common parts from rct2.h to common.h 2016-12-01 16:03:16 +01:00
Michał Janiszewski e7254ca708 Fix call to `realpath` in `posix.c` 2016-12-01 14:33:23 +01:00
Marijn van der Werf 15a6575346 Update hooks to return CPU flags 2016-12-01 14:15:47 +01:00
Michał Janiszewski 4077e607b0 Merge pull request #4846 from janisozaur/include
Fix includes
2016-12-01 11:30:34 +01:00
Michał Janiszewski f486a1d302 Return valid value from `strlogicalcmp` even if `assert` is hit 2016-12-01 10:58:19 +01:00
Michał Janiszewski 070e41e656 Fix Windows builds due to missing header 2016-12-01 10:18:00 +01:00
Michał Janiszewski ecec752dec Remove some unused headers 2016-12-01 09:20:56 +01:00
Michał Janiszewski 7eb008b546 Ensure includes are used when needed 2016-12-01 09:09:15 +01:00
duncanspumpkin 6c8e0cc536 Fix #4838. Prevent leaving ghosts with small scenery
Issue was caused by placing two ghost scenery items when using the scenery placement tool. The ghost clean up code would only remove the first ghost and leave the second ghost. Mistake caused when refactoring. Incorrect use of NOT and AND.
2016-11-30 19:09:45 +00:00
Duncan a9eb93ce88 Merge pull request #4809 from duncanspumpkin/refactor
Refactor place scenery
2016-11-29 21:50:30 +00:00
duncanspumpkin 3f194991a1 Remove redundant variable 2016-11-29 19:01:46 +00:00
duncanspumpkin 329c8b1f76 Fix motion simulator vehicle colours.
Due to a mistake during implementation the vehicle colour of the motion simulator was the wrong way around. The trim colour was applied to the body and vice versa. Issue noticed by reddit user.
2016-11-28 17:51:37 +00:00
Michał Janiszewski 29a4277709 Refactor sawyercoding 2016-11-28 09:59:01 +00:00
Michael Steenbeek 30c61345d8 Fix special cases for ride photos when looking up uniform price, fixes #933 2016-11-28 10:27:42 +01:00
Michał Janiszewski 8627f6c456 Move utf-related functions to utf8.c
This makes utf8.c standalone (not requiring any external symbols)
2016-11-27 23:25:59 +00:00
Michał Janiszewski 1658ba7109 Fix compilation of LightFX with GCC 2016-11-27 21:43:11 +00:00
Krutonium 173303f30d Add PowerPC to list of architectures in version.h
PowerPC is not supported yet, but it's getting closer.
2016-11-24 13:10:10 +01:00
Michael Steenbeek 7ac7c1e852 Increase network version to prevent desyncs due to 90dbcdb 2016-11-22 22:39:20 +01:00
duncanspumpkin 90dbcdb3c1 Fix #4820. Fix banner signs build cost.
Issue was caused by an incorrect read (only 1 byte instead of 2) of the legacy banner data during object loading. Note this would have caused the scenery_tab_id and string table to possibly have corrupted data.
2016-11-22 19:36:24 +00:00
duncanspumpkin d09238ac0c Label known register uses 2016-11-22 18:48:32 +00:00
duncanspumpkin b6c73f8bef Refactor place scenery 2016-11-22 18:25:56 +00:00
Michał Janiszewski 2ec1fd0378 Prevent variable underflow in path_end_with_separator 2016-11-22 17:15:03 +01:00
Alexander Overvoorde 18d943533a Fixes #4808: Add land rights recalculation for loading save games
The feature of disabling the land rights buying buttons depends on the
land rights being accounted for, but the function that calculates these
was not called when loading saved games. Therefore it would often make
it impossible to buy land after loading a saved game.
2016-11-21 22:54:06 +01:00
Michał Janiszewski aef80b1a82 Validate parameters passed to game commands (#4814) 2016-11-21 10:37:10 +01:00
Marijn van der Werf 6b4def9156 Pass palette index to gfx_clear 2016-11-16 13:27:02 +00:00
Michael Steenbeek 736437aa6e Allow 3 cars per train on the Rocket cars 2016-11-16 13:25:37 +00:00
Marijn van der Werf ec6724b4d4 Name font flags 2016-11-16 13:24:39 +00:00
Marijn van der Werf 7b34e71135 Fix #1238: Track placement window cannot be themed 2016-11-15 19:37:21 +01:00
Gymnasiast e1c9b0a2c1 Fix import of RCT1 Lay-down Roller Coaster
To make matters confusing, what is called a Lay-down RC in RCT2 is called a Flying RC in RCT1. There is no relation with the Flying RC in RCT2
2016-11-14 22:25:49 +01:00
Ted John 4d7f52960d Merge pull request #4737 from Broxzier/copy_element
Copy/paste single elements
2016-11-14 21:24:40 +00:00
Gymnasiast a626a4ada4 Fix saves having multiple extensions 2016-11-14 22:06:09 +01:00
Michael Steenbeek bd9ab83710 Merge pull request #4779 from wolfreak99/load_game_or_sc6
Display and load sc6 files in "load game" browser
2016-11-14 21:14:49 +01:00
Gymnasiast 89f6a7eaf9 Raise Junior RC height limit to 14 units, fixes #4686 2016-11-14 19:38:04 +01:00
Michael Steenbeek ba1225cf6e Merge cheats in console, pathfinding improvements 2016-11-14 08:54:51 +01:00
Duncan 6a90f9eb40 Fix #4777: Check for enough free elements before placement
Previously multi tiled placements would only check for one free element before placing. This would cause a crash when it failed to allocate the next element on maps that were close to reaching their full capacity. Renamed sub_68B044 to map_check_free_elements_and_organise and gave it an argument value to check for enough free elements.
2016-11-13 22:44:08 +00:00
Marijn van der Werf 4039172fb7 Use more constants for drawing arguments 2016-11-13 22:29:03 +00:00
Michael Steenbeek 54d0624ded Skip null rides when checking for select-by-track-type, fixes #4796 2016-11-13 21:14:15 +01:00
Michał Janiszewski 3d5735c77e Rename map_get_corner_height 2016-11-13 20:10:32 +00:00
Michał Janiszewski 3f7fd56328 Remove trailing whitespace in sources 2016-11-13 20:32:55 +01:00
Michał Janiszewski 9fed68bf6f Merge OBJ_STRING_ID enums into one 2016-11-13 20:31:19 +01:00
Michał Janiszewski 0299844b13 Rename some static tables 2016-11-13 19:36:03 +01:00
Michał Janiszewski 5524979289 Add include guards to headers missing it 2016-11-13 19:36:03 +01:00
Michał Janiszewski a8b8b04dd4 Unify key modifiers definition 2016-11-13 19:36:03 +01:00
Michał Janiszewski 233ef1f735 Merge RCT2_LANGUAGE_* definitions into one 2016-11-13 19:36:03 +01:00
Michał Janiszewski 00dd35481e Remove unused enum from network.cpp 2016-11-13 19:36:03 +01:00
Michał Janiszewski dbdf4b248c Plug memleak in OpenGLDrawingEngine 2016-11-13 19:36:03 +01:00
Marijn van der Werf 1a8cb9fc57 Use more constants for text colours 2016-11-13 17:44:34 +00:00
Marijn van der Werf 022b481d66 Use constant for black strings 2016-11-13 17:20:30 +00:00
Michael Steenbeek 418c542cba Increase network version 2016-11-13 12:31:30 +01:00
Marijn van der Werf 3ab64a3cd5 Return after assert 2016-11-13 01:51:28 +01:00
Marijn van der Werf 1591c1d021 Add more sprite constants 2016-11-13 01:51:28 +01:00
Marijn van der Werf bb615c60ee Clean up translucent palettes 2016-11-13 01:51:28 +01:00
Marijn van der Werf 06b128bac7 Name more palettes 2016-11-13 01:51:27 +01:00
Marijn van der Werf 4f47808201 Name glass palettes 2016-11-13 01:51:26 +01:00
Marijn van der Werf 2109763267 Rename translucent palettes 2016-11-13 01:45:43 +01:00
Marijn van der Werf 1ce2242bb3 Start cleaning up filters 2016-11-13 01:45:43 +01:00
Broxzier ebc0a81e72 Guests turn around when trying to enter a copied park entrance 2016-11-12 11:27:59 +01:00
Ted John 7a4ef4073f Merge pull request #4789 from janisozaur/server-load-new-map
Fix #4755: Crash loading new map while running a server
2016-11-11 19:08:34 +00:00
TELK 7718acfde8 Fix #4775: File name of screenshot that is taken at 00:xx is named wrong
Use `GetLocalTime` instead of `GetSystemTime`
2016-11-11 17:55:41 +00:00
Michał Janiszewski b30454366f Add note about possible improvement of object sending
[ci skip]
2016-11-11 18:38:23 +01:00
Michał Janiszewski 0793b3bc11 Fix #4755: Crash loading new map while running a server 2016-11-11 18:27:40 +01:00
Marijn van der Werf 0496cf6bd8 Merge colour maps 2016-11-11 08:46:14 +00:00
Michał Janiszewski 65bb4977ce Fix #4769: peep renames broken 2016-11-10 22:49:18 +01:00
Marijn van der Werf 80ea7f7de5 Name `gfx_fill_rect_inset` flags 2016-11-10 17:54:33 +00:00
wolfreak99 2da3a7b830 Show td6/td4 in "track designs" file dialog 2016-11-10 10:43:19 -05:00
wolfreak99 64bbd78bb7 Show sc6/sv6/sc4/sv4 in "load landscape" file dialog 2016-11-10 10:43:18 -05:00
wolfreak99 7e0dfc9e0c Show sv6/sc6/sv4/sc4 in "load game" file dialog 2016-11-10 10:43:17 -05:00
Broxzier 9c1998320d Add tooltips to copy and paste buttons 2016-11-09 20:34:35 +01:00
Broxzier c60463c8a7 Show error message when map element limit is reached 2016-11-09 20:25:40 +01:00
duncanspumpkin 3da10b7d7d Use correct comparison for previous commit 2016-11-09 19:16:25 +00:00
Broxzier 109f1d094e [ci-skip] Function opening brackets on own line 2016-11-09 20:03:21 +01:00
Broxzier 2c334a1882 Clearing clipboard on load, and better UI feedback. 2016-11-09 20:03:20 +01:00
Broxzier ecc9637bbd Clearing tile inspector clipboard when loading a park 2016-11-09 20:03:19 +01:00
Broxzier 8c54b1208b Add copy/paste functionality to tile inspector 2016-11-09 20:03:18 +01:00
duncanspumpkin 2f6f728200 Fix #4714. Prevent invalid peep access on closed golf rides.
When a golf ride is closed it will remove the peep from the vehicle (the ball). Due to the way vehicles leave stations the vehicle would still travel to the next hole but when it tried to update the peeps action it would crash. This skips updating the peeps action but lets the ball still continue. This will cause a phantom ball to go around the golf course until all the vehicles are back in their closed state.
2016-11-09 19:00:09 +00:00
Ted John 4662b648d2 Merge pull request #4700 from IntelOrca/refactor/language-cpp
Refactor language.cpp
2016-11-09 18:38:24 +00:00
Ted John 953f479cd9 Fix #4762: Assertion in localisation (format_string_part)
The buffer overflow protection in format_string was not working correctly for several reasons. For windows builds this just so happened to write over gMapTooltipFormatArgs causing the assertion. Extra asserts have been added to check overflows in format_string.
2016-11-09 18:29:49 +00:00
wolfreak99 1f0b2aefb7 Fix #4771: Main Menu music not playing
When audio_init_ride_sounds is called, it calls audio_stop_title_music, but never calls audio_start_title_music. if you do an assert for gTitleMusicChannel it shows it is null. this fixes that. i will say though this is most definitely a band-aid fix, because if run audio_start_title_music in the audio_init_ride_sounds, it still doesn't play out loud. at least on my setup it doesn't.
2016-11-09 17:37:41 +00:00
Michał Janiszewski 867de18c96 Use json_is_true instead of json_boolean_value
This should lower required version of jansson, which would
let us use 2.5 in Trusty (current version in Travis-CI)

See https://github.com/akheron/jansson/issues/146
2016-11-09 13:19:12 +01:00
Michał Janiszewski 44e9129af5 Remove unused semicolons after end of function
[ci skip]
2016-11-09 13:15:46 +01:00
Ted John 7b5858cb92 Fix UTF-8 string literals, add BOM to language.cpp
MSVC requires source files to be in UTF-8 with BOM in order to compile them correctly as UTF-8.
2016-11-08 17:29:46 +00:00
Ted John 941d92dc2a Fix convert_multibyte_charset 2016-11-08 17:02:37 +00:00
Ted John c506f2730d Reformat language table 2016-11-08 17:02:37 +00:00
Ted John 894899630b Use UTF-8 literal strings 2016-11-08 17:02:37 +00:00
Ted John 3d1e4c10c1 Fix size argument in GetLanguagePath 2016-11-08 17:02:37 +00:00
Ted John 3af07f6e00 Remove unused constant 2016-11-08 17:02:37 +00:00
Ted John 91ef540c25 Fix gcc errors 2016-11-08 17:02:37 +00:00
Ted John b4e65ace52 Refactor font loading 2016-11-08 17:02:37 +00:00
Ted John 6461b21e09 Use more C++ functions 2016-11-08 17:02:37 +00:00
Ted John 6523081b84 Conform to C++ style 2016-11-08 16:59:46 +00:00
Ted John 216dc64342 Convert tabs to spaces in language.cpp 2016-11-08 16:59:46 +00:00
Michael Steenbeek 26c695bdd1 Use ColourMapA for looking up the mini preview background colour, fixes #1238 (#4766) 2016-11-07 12:35:14 +01:00
Michał Janiszewski 9c818ea2dc Reorder fields to reduce padding (#4758)
Reduces padding:
* In `rct_viewport` from 5 to 1
* In `rct_ride_entrance_definition` from 4 to 0
2016-11-06 21:06:02 +01:00
Michał Janiszewski b164c2be61 Extract openrct2_assert to guard.h (#4753)
* Extract openrct2_assert to Guard.hpp

`openrct2_assert` is not defined in util.c and including all of
openrct2.h is unnecessary.
2016-11-06 21:02:25 +01:00
Michał Janiszewski 43a7e6b854 Add missing static keyword to template-ised functions (#4750)
This fixes building with ICC
2016-11-06 21:01:07 +01:00
Michał Janiszewski 06b659db40 Replace malloc(0) with explicit NULL
From documentation on `void* malloc( size_t size );`:
> If size is zero, the behavior is implementation defined (null pointer
may be returned, or some non-null pointer may be returned that may not
be used to access storage).

Both `free()` and `realloc()` understand `NULL`, so use that to avoid
implementation-defined behaviour
2016-11-06 21:00:47 +01:00
Michał Janiszewski fe3b15c2f1 Mask translucent bit out from colour
Fixes #4765
2016-11-06 20:51:38 +01:00
Matte A c029515d76 Changing some default configs to true (#4540) 2016-11-06 19:12:42 +01:00
Michael Steenbeek fc9884092a Merge pull request #4764 from janisozaur/check-ride-type
Prevent checking of flags of invalid ride type
2016-11-06 18:40:56 +01:00
Michał Janiszewski 512c7bcf51 Prevent crash when opening a window on invalid ride 2016-11-06 18:26:45 +01:00
Michał Janiszewski 7e326972a9 Prevent checking of flags of invalid ride type
Such case can happen with following function call chain in stack trace:
* `game_command_create_ride` ride.c:6234
* `ride_create` ride.c:6070
* `rideTypeShouldLoseSeparateFlag` rct1.c:88
2016-11-06 18:03:26 +01:00
Michael Steenbeek 71dc1314c2 Merge pull request #4672 from wolfreak99/cheats_in_console
disable_clearance_checks and disable_support_limits in console
2016-11-06 17:40:14 +01:00
Michael Steenbeek d9c19479d1 Merge pull request #4688 from zaxcav/pathFindLoopDetection
Add pathfinding loop detection based on peep->pathfind_history
2016-11-06 17:34:31 +01:00
Ted John c268b51521 Merge pull request #4757 from janisozaur/memory
Ensure all memory allocated with Memory is valid
2016-11-06 11:28:30 +00:00
Michał Janiszewski 2c6c99dfe0 Add user-friendly information about failed allocation 2016-11-06 11:59:30 +01:00
Michał Janiszewski c9a1ce593c Fix wrong return value in Stopwatch::GetElapsedTicks 2016-11-05 22:40:28 +00:00
Michał Janiszewski e4e6f2f68a Ensure all memory allocated with Memory is valid 2016-11-05 23:12:35 +01:00
Duncan a4f9d41f57 Merge pull request #4746 from marijnvdwerf/fix/supports
Fix scenery segments
2016-11-05 10:38:45 +00:00
wolfreak99 410ce9fd66 prefix console commands with "cheat_" 2016-11-05 05:14:17 -04:00
wolfreak99 28773b4c40 Change sandbox mode, clearance check, and support limit cheats to take parameter as value 2016-11-05 05:14:12 -04:00
wolfreak99 102af2f8ca rewrite to use value returned from game_do_command 2016-11-05 04:34:19 -04:00
Michael Steenbeek ea66b4ca84 Merge pull request #4749 from Overv/develop
Fix #4747: Fix available land rights not being recounted when using sandbox tools
2016-11-04 22:56:12 +01:00
Alexander Overvoorde 9be47d11ed Fix #4747: Fix available land rights not being recounted when using sandbox tools
This commit fixes the game command set_land_ownership missing a land
rights recount call. This would cause problems when the user changes
land ownership with the sandbox mode tools.
2016-11-04 22:51:35 +01:00
Michał Janiszewski b6525c298e Verify access to terrainEdgeTypeStringIds 2016-11-04 22:21:37 +01:00
wolfreak99 369b85fc51 Sync cheats in console across multiplayer, add "sandbox_mode" 2016-11-04 13:58:47 -04:00
wolfreak99 4368d67f6e disable_clearance_checks and disable_support_limits in console 2016-11-04 13:58:44 -04:00
Michał Janiszewski 3653baf720 Remove needless const for returned values 2016-11-04 09:44:13 +01:00
Marijn van der Werf 0a431cf918 Fix #4698: Scenery blocks wrong segments 2016-11-03 21:58:50 +01:00
Michael Steenbeek b5630a5a5e Merge pull request #4701 from Overv/implement-disabled-land-rights
Resolves #4559: Changes land rights buttons to be disabled if no tiles for sale remain
2016-11-03 19:42:08 +01:00
duncanspumpkin cc0803d466 Prevent crash #4694. Crash in ride_get_entrance with no station
Issue is being caused by deleting the station track without removing the station track entry in the ride struct. This will prevent the crash but this should not happen in practice.
2016-11-03 18:23:42 +00:00
Marijn van der Werf 5d2b5f4d5c Make `NO_RCT2` builds possible again 2016-11-02 22:39:58 +01:00
duncanspumpkin 8466de7cbf Fix #4689. Object selction tabs sometimes flicker.
Issue caused by switching between tabs when half way through tab animation. The frame number would not be reset until the next frame and this would cause a split second glitch when moving from a long animation tab to a short animation tab. Issue fixed by reseting the frame number when switching tabs.
2016-11-02 19:08:12 +00:00
Duncan cc0c552fa1 Merge pull request #4743 from duncanspumpkin/fix_bins
Fix #4725: Filled bins incorrectly displayed
2016-11-02 18:30:38 +00:00
Michał Janiszewski 1f0adb95da Check value of DEBUG_LEVEL_X macro, not just definition
DEBUG_LEVEL_X macros are always defined to 0 or 1, this could prevent
some optimisations from compilers, especially inlining
`get_current_rotation()`.
2016-11-02 08:19:25 +00:00
Michał Janiszewski a7cd10a7f7 Cache rotation value in scenery_paint 2016-11-01 22:23:40 +01:00
duncanspumpkin 6caa6d9a3f Fix #4725: Filled bins incorrectly displayed
The bins were incorrectly displaying their filled status on some
rotations. This was caused by two mistakes. The first mistake was only
rotating the status by 1 place when it was 2 bit the second was due to
rotating it the wrong direction. This was likely caused by the implementor
not realising that there were two 'rol' commands but due to the inverted
nature of this it would end up being two 'ror's.
2016-11-01 19:23:00 +00:00
Ted John b568f002d4 Merge pull request #4729 from xavery/bitcount-use-cpu
Use POPCNT, if available, to count the number of set bits
2016-11-01 13:26:39 +00:00
Daniel Kamil Kozar 55f1d3aac6 Fixes to the new bitcount implementation
Use Intel-standardized _mm_popcnt_u32 instead of Microsoft-specific
__popcnt, replace assert with openrct2_assert, replace bitcount's argument
with uint32.
2016-11-01 11:45:17 +01:00
Hielke Morsink ab1708a970 Fix quarter-scenery cluster selection 2016-11-01 09:46:30 +00:00
Yaroslav Tretyakov 9540e804b3 Fix #4728: Crash when trying to remove invalid provisional track piece 2016-11-01 08:14:46 +00:00
Ted John a9a1f54f8a Fix centreing of title menu buttons 2016-10-31 22:24:02 +00:00
Alexander Overvoorde bb059a2741 Resolves #4559: Changes land rights buttons to be disabled if no tiles for sale remain
This commit changes the land rights button in the park window to be
disabled if there are no more land rights and construction rights for
sale. It also disables the individual land rights and construction
rights buttons in the land rights window itself if that specific type of
tile is no longer for sale.

This is implemented by introducing two new global variables called
gLandRemainingOwnershipSales and gLandRemainingConstructionSales. These
are updated by map_count_remaining_land_rights() to contain the number
of land rights and construction rights that remain for sale. This
function is called when a scenario is loaded and whenever the game
command to buy land rights or construction rights is invoked.

It also introduces three new tooltip strings that explain why the
buttons are disabled.
2016-10-31 20:21:10 +01:00
Yaroslav Tretyakov 12bd31bc52 Fix #4726: Checking wrong x value 2016-10-31 08:20:52 +00:00
Daniel Kamil Kozar b68b6f731b Use bool instead of int for bitcount_popcnt_available's return value 2016-10-31 01:06:18 +01:00
Daniel Kamil Kozar d7606c8fa3 Remove void from argument lists in new bitcount_ functions
Keep it in line with the rest of the C code.
2016-10-31 00:58:22 +01:00
Daniel Kamil Kozar 46b6ff35a0 Initialise the pointer to bitcount_fn in a new early initialisation function
In order to avoid the overhead of checking whether the function pointer
to bitcount's actual implementation has been initialised every time
bitcount is called, initialise it at application startup.
2016-10-31 00:45:30 +01:00
Daniel Kamil Kozar bc101f4151 Use POPCNT, if available, to count the number of set bits
Replace the current implementation of bitcount() with a one that uses the
POPCNT instruction available in most newer CPUs. Also, replace the basic
implementation with a one based on a lookup table, which has much better
performance than the old one.
2016-10-31 00:13:19 +01:00
Michał Janiszewski 593230b19c Rename 65DDD1 to turns_ratings 2016-10-30 22:09:59 +01:00
Michał Janiszewski ccc3297424 Rename 65E1C2 to sheltered_ratings 2016-10-30 22:08:51 +01:00
Michał Janiszewski ff8fa26eab Fix argument values to ride_ratings_apply_65E1C2 2016-10-30 22:06:35 +01:00
Michał Janiszewski 5585a3e67d Fix #4722: warnings with clang 3.9 2016-10-30 21:57:14 +01:00
Ted John 66cd816922 Refactor and fix stex disabling tab 1 on objective options 2016-10-30 01:12:41 +00:00
Ted John 33a07f86be Fix #4724: Not all rides show up in preserved rides tab 2016-10-30 01:03:26 +00:00
Daniel Kamil Kozar 2894bea5dd fix realpath() return value in platform_resolve_openrct_data_path
realpath() returns NULL on error, so the existing code treated its success as a
critical error. this commit fixes this.
2016-10-29 20:06:05 +02:00
Ted John 43ec7febff Fix #4711: Cannot open System Dialogue Window when saving game
Another regression from e5ff7412e4, we want to append an extension, not a directory.
2016-10-29 14:55:14 +01:00
Ted John 09c37d6465 Fix #4713: preserved rides tab in the wrong tool?
Ride check for showing the preserved rides tab was the wrong way round.
2016-10-29 14:48:28 +01:00
zsilencer eb187db49b Fix #4704, #4708: Crash when painting money effect 2016-10-28 12:34:53 -06:00
zsilencer 3d712ddc58 Give names to _currentTrackSelectionFlags flags 2016-10-26 16:19:56 -06:00
zsilencer 1b47bdd180 Fix desync caused by provisional track piece peep interaction 2016-10-26 15:38:54 -06:00
zsilencer 24bd56af02 Fix desync caused by provisional ride entrance/exit peep interaction 2016-10-26 15:01:50 -06:00
Ted John 5699b9e4ed Merge pull request #4685 from marijnvdwerf/fix/paint-5
Combine Junior RC and Water RC drawing
2016-10-25 12:14:03 +01:00
Ted John aef32c0fba Merge pull request #4696 from IntelOrca/render/night-lights
The light effects mod branch #3798 by @JeroenDStout has become quite out of date. I plan to properly implement it, but first I want to merge in what we have already, so that I can branch off develop again and rebase (currently rebasing this branch is too difficult, far too many commits).

Most code that this is merging is protected by the __ENABLE_LIGHTFX__ directive, so it should not make any difference until its time to enable it via a new pull request.

I have isolated it as much as possible to lightfx.c.
2016-10-25 12:12:48 +01:00
Ted John 07f5682392 Remove lightfx debug stuff 2016-10-24 18:52:42 +01:00
Ted John ebe4ca4df4 Rename lightfx guard 2016-10-24 13:06:44 +01:00
Ted John ca47770825 Move rendering to lightfx.c and protect all areas with guard 2016-10-24 13:05:44 +01:00
Ted John 3d529ff6b8 Fix more memory leaks in FileScanner 2016-10-24 12:23:27 +01:00
Ted John adb2ae616c Windows: Call FreeConsole if one was attached. 2016-10-23 23:10:30 +01:00
Michał Janiszewski 6c4ff285b4 Fix memory leak in FileScanner 2016-10-23 22:58:18 +02:00
Michał Janiszewski 73aede6052 Fix memory leak in TrackDesignRepository 2016-10-23 22:46:59 +02:00
Michał Janiszewski a75c1f1bc4 Fix memory leak in FileScanner 2016-10-23 22:28:35 +02:00
Michał Janiszewski 8894be6a6d Tie _tooltipText size to that of gCommonStringFormatBuffer 2016-10-23 22:28:35 +02:00
zaxcav 86ae14c65d Add pathfinding loop detection based on peep->pathfind_history
The heuristic search currently only inludes detection of loops in the current search path - i.e. from where the peep is now.

The peep->pathfind_history includes (limited) junctions that the peep has already passed through for the current search goal to get to their current location. Consider search paths through these junctions as loops as well.

This will prevent peeps getting stuck in some path layouts where looping back through a junction they already walked through and then proceeding via an alternative path (such that there is no loop in the current search path) hits the search limits on a continuing path that is closer to the goal than simply continuing on along the path which then turns (temporarily) away from the goal.

This prevents _some_ cases of alternate, longer routes to nearer tiles being returned as a better result than a route that goes through that same tile (with less steps) and then continues on to end overall further from the goal though closer to getting to the goal (as was previously documented in PR #4527).

The network version is incremented in this PR.
2016-10-23 18:55:47 +02:00
Ted John 315c0e91ad Fix #4574: Changing the game language makes the scenery window wonky 2016-10-23 17:49:21 +01:00
Ted John 94a9c94c1f Fix saving in editor mode
Fixes #4572: Don't create .sv6 autosaves in track designs manager, roller coaster designer and scenario editor
Fixes #4573: "Save this before quitting?" in scenario editor saves to .sv6, not .sc6
2016-10-23 17:42:11 +01:00
Ted John 9ee865a8da Fix #873: Unable to save track with colon symbol in name of ride
Add protection for saving any file with invalid path characters in save dialog.
2016-10-23 17:12:55 +01:00
Ted John 7611b04ad1 Add --console switch for Windows
Windows subsystem does not work like console subsystem which makes it almost impossible to obtain `stdout` until the application has finished. This adds a `--console` switch to make the game either attach to an existing console or show a new one and redirect the C streams to it.
2016-10-23 16:16:20 +01:00
Marijn van der Werf e8e2039832 Fix GCC 2016-10-23 14:52:32 +02:00