1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-19 21:13:05 +01:00
Commit Graph

655 Commits

Author SHA1 Message Date
Ted John
1083ccebd0 Merge pull request #4847 from zaxcav/pathfind_history_fixes
Further pathfinding fixes
2016-12-28 12:58:19 +00:00
Broxzier
6c29bdbf21 CppCheck fixes 2016-12-24 13:10:03 +01:00
Ted John
c5899139d7 Move scenario sources to sub directory 2016-12-16 01:25:05 +00:00
Ted John
abc3835d7b Rename openrct2.c h to OpenRCT2.c h 2016-12-14 00:32:06 +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
0019827d6c Refactor sprite tween logic out openrct2.c 2016-12-11 12:16:47 +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
zaxcav
1df30e55d2 Fix CI errors
Missing #if on some debug code.
2016-12-02 13:18:20 +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
Michał Janiszewski
1ae2ca54f7 Sort includes 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
aef80b1a82 Validate parameters passed to game commands (#4814) 2016-11-21 10:37:10 +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
Michael Steenbeek
ba1225cf6e Merge cheats in console, pathfinding improvements 2016-11-14 08:54:51 +01:00
Michał Janiszewski
3f7fd56328 Remove trailing whitespace in sources 2016-11-13 20:32:55 +01:00
Broxzier
ebc0a81e72 Guests turn around when trying to enter a copied park entrance 2016-11-12 11:27:59 +01:00
Michał Janiszewski
65bb4977ce Fix #4769: peep renames broken 2016-11-10 22:49:18 +01: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
zsilencer
e2e4201112 Validate peep game command which caused crash from invalid sprite index 2016-10-22 01:53:33 -06: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
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
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
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
duncanspumpkin
8b196234e9 Flip the calcs 2016-10-19 21:30:08 +01:00
duncanspumpkin
430d1c4bcd Re-refactor peep calculate satisfaction 2016-10-18 21:53:01 +01:00
zsilencer
541ae91d67 fix pickup commands to work with hiring staff 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
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
00e907d007 Merge pull request #4414 from Broxzier/extended_tile_inspector
Extended tile inspector
2016-10-16 21:12:21 +01:00
Manuel Vögele
ec8d37eead Fix #1943: Placing Handyman/Security Guard/Mechanic In Multiplayer Causes Crash
Open staff window on multiplayer clients when hiring new staff instead of a random visitor.
2016-10-13 22:02:10 +01:00
Michał Janiszewski
f1cbb7935d Fix left shifts that may overflow 2016-10-13 19:48:42 +01:00
zaxcav
7718300881 Correct mistakes in merging conflicts. 2016-10-12 16:17:36 +02:00
zaxcav
113c41b976 Moved declaration of rideIndex to before first use. 2016-10-12 15:57:55 +02:00
zaxcav
e2b830f7b9 Pathfinding checks all map elements on each tile.
Use of zero clearance will no longer block the path finding when paths and other map elements are placed in the same tile at the same height.

Pathfinding recognises map elements for shops, so peeps can find shops again.

Pathfinding recognises the park entrance, so peeps can leave the park again.
2016-10-12 15:10:34 +02:00
Michał Janiszewski
a80461da80 Fix #4553: crash due to accessing invalid sprite
Assertion gets hit when trying to get invalid sprite from
remove_peep_from_queue
2016-10-12 08:18:41 +01:00
Broxzier
a68dc7afb8 Add fence and banner info to tile inspector
This commit also renamed a flag, and corrected the use of one. The
flags in question are WALL_SCENERY_BANNER, WALL_SCENERY_2_FLAG4, and
WALL_SCENERY_2_FLAG5.
2016-10-11 23:27:04 +02:00