Commit Graph

7964 Commits

Author SHA1 Message Date
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
Marijn van der Werf b868cccea2 Remove `pragma mark` 2016-10-23 14:41:47 +02:00
Marijn van der Werf 551962123a Reorganise file to minimise diffs 2016-10-23 14:40:11 +02:00
Marijn van der Werf 7d3cd99c0c Combine Junior RC and Water RC drawing 2016-10-23 14:13:11 +02:00
Ted John 712e062bcc Only load tracks if cache is invalid 2016-10-23 01:12:17 +01:00
Ted John 9eaf887546 Fix track manager issues 2016-10-23 00:42:22 +01:00
Ted John 25a7b98be0 Omit . and .. from linix file scanning too 2016-10-22 23:09:45 +01:00
Ted John a9db9528ae Fix bitwise and expression 2016-10-22 22:36:45 +01:00
Ted John a2efab7c45 Add unix file scanner implementation 2016-10-22 22:36:45 +01:00
Ted John cdc45a2848 When renaming, don't change extension 2016-10-22 22:36:45 +01:00
Ted John 7834afb34a Re-write FileScanner for easier cross platform and multiple patterns 2016-10-22 22:36:45 +01:00
Ted John 9118f24778 Rename FileEnumerator to FileScanner 2016-10-22 22:36:45 +01:00
Ted John 16626eabb8 Convert FileEnumerator to IFileScanner 2016-10-22 22:36:45 +01:00
Ted John a17748eb41 Fix typo 2016-10-22 22:36:45 +01:00
Ted John 42d8324997 Prevent delete or rename on RCT2 tracks 2016-10-22 22:36:45 +01:00
Ted John 29f75a71fb Use new item structure with std::string 2016-10-22 22:36:45 +01:00
Ted John e666028e02 Convert track repository to C++ 2016-10-22 22:36:45 +01:00
Michał Janiszewski 88ccfad303 Merge pull request #4615 from janisozaur/mediate-network-objects
Mediate network objects
2016-10-22 15:46:03 +02:00
Ted John f3b0044c8a Merge pull request #4659 from IntelOrca/refactor/painting
Refactor some of the paint and draw functions to pass parameters instead of using globals as the first steps towards nicer paint code and multi-threaded paint code.
2016-10-22 14:30:45 +01:00
Ted John 84e8b00900 Merge pull request #4678 from marijnvdwerf/fix/paint-4
Track Paint fixes: segment support height
2016-10-22 14:22:03 +01:00
Ted John 3e260fcfc5 Merge pull request #4677 from marijnvdwerf/fix/paint-3
Track Paint fixes: general support height
2016-10-22 14:21:28 +01:00
Ted John d15a179eae Rename / refactor paint quadrant variables 2016-10-22 14:20:57 +01:00
Marijn van der Werf 1ce7f38785 Fix various segment heights 2016-10-22 14:42:31 +02:00
Marijn van der Werf 1ebfba60d9 Fix right vertical loop 2016-10-22 14:42:30 +02:00
Ted John 60df18ee0f Refactor paint_arrange_structs 2016-10-22 13:35:21 +01:00
Ted John 86dd18a65d Rename paint functions 2016-10-22 13:35:21 +01:00
Ted John 504257ce08 Refactor paint_init 2016-10-22 13:35:21 +01:00
Ted John e4429641a4 Refactor viewport_paint_column 2016-10-22 13:35:21 +01:00
Ted John b81fe09469 Reformat sub_688217 2016-10-22 13:35:21 +01:00
Ted John 67e9ccb1fc Refactor paint_ps_money_effects 2016-10-22 13:35:21 +01:00
Ted John 1f810375a8 Refactor paint_attached_ps 2016-10-22 13:35:21 +01:00
Ted John 2aa0271222 Refactor paint_quadrant_ps 2016-10-22 13:35:21 +01:00
Ted John ce58c2e4e7 Merge pull request #4674 from marijnvdwerf/fix/paint-2
More various track paint fixes
2016-10-22 12:30:00 +01:00
zsilencer e2e4201112 Validate peep game command which caused crash from invalid sprite index 2016-10-22 01:53:33 -06:00
zsilencer b184a16d8c Fix bug that caused sign text to be deleted on client without permission in multiplayer 2016-10-22 01:45:44 -06:00
Marijn van der Werf 5c0279f3e1 Fix general support heights 2016-10-22 02:42:02 +02:00
Marijn van der Werf 6f2b20d3c0 Fix lay down rc station tunnels 2016-10-22 01:51:55 +02:00
Marijn van der Werf b2177b137e Fix helix tunnels 2016-10-22 01:49:32 +02:00
Marijn van der Werf ce5831f9b4 Fix upward single-tile turns 2016-10-22 01:36:50 +02:00
Marijn van der Werf 76188d2c4c Fix station drawing 2016-10-22 00:22:05 +02:00
Michał Janiszewski 18ff83fd6c Fix forward declaraction of ObjectRepositoryItem 2016-10-21 11:22:17 +02:00
Michał Janiszewski 8b5024a893 Update network version 2016-10-21 11:22:17 +02:00
Michał Janiszewski 194c9aed01 Refactor scenario_write_packed_objects and friends 2016-10-21 11:22:17 +02:00
Michał Janiszewski 65c6cd5412 Implement review suggestions 2016-10-21 11:22:17 +02:00
Michał Janiszewski 5ebc95e0b2 Mediate objects to send over from server 2016-10-21 11:22:17 +02:00
Michał Janiszewski f3a2eb0247 Allow selecting only subset of loaded objects for export 2016-10-21 11:22:17 +02:00
Michał Janiszewski 3a0e3c04e1 network send map refactor 2016-10-21 11:22:17 +02:00
Ted John 2aac1dd4e3 Merge pull request #4620 from marijnvdwerf/clean/testpaint-1
Start cleanup of testpaint
2016-10-21 08:50:07 +01:00
Duncan 81bb6cb950 Merge pull request #4649 from zsilencer/multiplayer
Guest+staff pickup and balloon pop commands
2016-10-20 12:46:27 +01:00
Duncan a572ecf477 Merge pull request #4576 from zaxcav/fixPathFind
Pathfinding checks all map elements on each tile.
2016-10-20 12:42:48 +01:00
Duncan 912080c473 Merge pull request #4529 from zaxcav/adjacentStationRatingBonus
Check for adjacent station(s) when applying rating bonus.
2016-10-20 12:42:36 +01:00
Duncan 811111b08e Merge pull request #4585 from zaxcav/fixPeepHappiness
Fixes to peep happiness, hunger, thirst, thoughts.
2016-10-20 12:38:15 +01:00
Ted John 12cddd10bd Merge pull request #4653 from marijnvdwerf/paint/fix-1
Various paint fixes
2016-10-20 12:25:14 +01:00
zaxcav b85e53e898 Replace hex number with decimal number per PR review comments. 2016-10-20 11:08:14 +02:00
zaxcav 989a8fc4bc Update comment with new limits of ride satisfaction following commit 7f58c89. 2016-10-20 11:06:56 +02:00
zaxcav d36c756ee7 Spelling corrections in code comments. 2016-10-20 11:06:56 +02:00
zaxcav b92cddf536 Bump network version. 2016-10-20 11:03:54 +02:00
zaxcav 68f89c6b07 Comment peep update code related to updating happiness, etc. 2016-10-20 11:03:54 +02:00
zaxcav 6011429630 Fix potential under/over-flow of happiness, hunger, thirst in peep generation. 2016-10-20 10:45:15 +02:00
zaxcav dfd27efaba Correct condition on running out of money thought. 2016-10-20 10:45:15 +02:00
Duncan b0c500e79b Merge pull request #4655 from duncanspumpkin/satisfaction
Re-refactor peep calculate satisfaction
2016-10-20 08:42:15 +01:00
zsilencer d83df63acf Increment network version 2016-10-19 16:24:14 -06:00
zsilencer 3617c2cb93 Code review 2016-10-19 16:20:13 -06:00
zsilencer 986c2ab97e Fix bug - prevent firing of staff while being picked up 2016-10-19 16:20:05 -06:00
Marijn van der Werf f2033b0d93 Fix #3561: Tunnels drawn incorrectly 2016-10-19 21:45:19 +01:00
duncanspumpkin 8b196234e9 Flip the calcs 2016-10-19 21:30:08 +01:00
Michael Steenbeek 0abb53f6ae Merge pull request #4582 from wolfreak99/create_folder
"Create folder" button for save dialog
2016-10-19 11:06:45 +02:00
wolfreak99 ca19ececd6 Create folder button
Fixed remarks

Update comments to plural usage
2016-10-19 02:48:02 -04:00
LRFLEW 2392e2658a Replace spinlock in main game loop 2016-10-18 22:13:10 +01:00
duncanspumpkin 430d1c4bcd Re-refactor peep calculate satisfaction 2016-10-18 21:53:01 +01:00
Yaroslav Tretyakov 82b18ddaf3 Fix #4644: steam particle sprite crash 2016-10-18 20:59:53 +01:00
Ted John 7ca8b3d278 Refactor viewport_paint 2016-10-18 20:59:32 +01:00
zsilencer 541ae91d67 fix pickup commands to work with hiring staff 2016-10-18 13:40:50 -06:00
zsilencer db3aa2b656 Add balloon popping as game command 2016-10-18 13:40:50 -06:00
zsilencer d74efb23fe Add picking up peeps/staff as game command 2016-10-18 13:40:49 -06:00
Marijn van der Werf 0c82651d97 Fix Lay Down RC 2016-10-18 19:37:56 +02:00
Marijn van der Werf 18a2cf1f73 Fix mine train coaster 2016-10-18 19:37:56 +02:00
Marijn van der Werf d678495f8b Fix Flying RC 2016-10-18 19:37:56 +02:00
Marijn van der Werf bd7b2c536e Fix 'left corkscrew up' track 2016-10-18 19:37:56 +02:00
Marijn van der Werf 75ab5548f7 Fix Dinghy Slide 2016-10-18 19:37:56 +02:00
Marijn van der Werf 2666088ce4 Fix station covers 2016-10-18 19:37:56 +02:00
Alexander Overvoorde 9c52e36332 Fix #4648: Fix title music playing during intro sequence
The title screen music already started playing during the intro sequence
if it was enabled. This commit changes the behaviour such that the title
music only starts playing once the title screen actually shows up.
2016-10-18 17:35:51 +01:00
Michael Steenbeek 2efe0a8843 Merge pull request #4642 from HaasJona/toilet
Reduce toilet volume
2016-10-18 17:41:41 +02:00
Ted John a9908b80c9 Add debug assistance 2016-10-18 13:35:33 +01:00
Michał Janiszewski ead79360c8 Add architecture info to crash dump file name 2016-10-18 12:25:57 +01:00
Ted John d773d14473 Add light instead of lerp 2016-10-17 23:28:02 +01:00
Ted John 8da6654fc6 Mix lights into hw texture 2016-10-17 22:56:08 +01:00
Ted John 1ddb95874a Add lightfx_get_palette 2016-10-17 22:54:25 +01:00
Ted John 6d45c5ac5e Fix footpath lights 2016-10-17 22:51:18 +01:00
Jonathan Haas e0a166d3a3 Reduce volume of toilet sound 2016-10-17 21:42:32 +02:00
Ted John c4f67e9d95 Use lightfx palette transform 2016-10-17 20:34:53 +01:00
Ted John 2bf4ded732 Merge pull request #4638 from OpenRCT2/janisozaur-mingw-test
Configure MinGW to consume Vista+ APIs
2016-10-17 12:10:59 +01:00
Marijn van der Werf 70654e9ee5 Extract tunnel/segment resetting 2016-10-17 12:43:13 +02:00
Marijn van der Werf 8034f6f427 Extract method interception to seperate class 2016-10-17 12:43:13 +02:00
Michał Janiszewski 46021ed2bf Fix self-assignment in ScenarioRepository 2016-10-17 11:59:10 +02:00
Michał Janiszewski 7f5b70ea78 Move WINVER definition before including common.h 2016-10-17 09:52:26 +02:00
Michał Janiszewski 33c3432556 Update MinGW to use APIs from WINVER 0x0600 2016-10-17 09:46:08 +02:00
zaxcav 8741a40674 Remove hacks for pathfinding to the ride exit.
When sending a mechanic to a ride exit/entrance, the original pathfinding was setting the goal to the path next to the exit/entrance with goal.z set to the exit/entrance height. This is wrong when the path slopes up to the exit/entrance. Consequently the original pathfinding included a hack to allow the mechanic to enter the exit/entrance from the goal tile.

The changes in PR #4527 (commit f3cf23f) will ignore the relevant tile when the height is wrong, preventing the original hack from working. To fix this the height of paths sloping up was adjusted in the heuristic search ... which inadvertently broke pathfinding for other goals on such a sloped path (such as the start of a ride queue that slopes up).

To fix, set the goal to the ride exit/entrance itself, make the heuristic search aware of ride exits (code existed but was commented out; entrances are already there for rides without queues) and remove both the original hack and the (incorrect) heigh adjustment made in PR #4527.

Fixes issues #4626, #4629.
2016-10-17 09:31:28 +02:00
Ted John 55cae4a230 Fix compile errors 2016-10-17 00:03:32 +01:00
Ted John b64f8861f4 Merge branch 'stout-expanded-rendering-2' into render/night-lights 2016-10-16 23:40:59 +01:00
Ted John dd3db116f7 Merge pull request #4606 from IntelOrca/refactor/scenario-sources
Refactor scenario sources and scenario list to C++
2016-10-16 22:27:34 +01:00