1
0
forked from 0ad/0ad
Commit Graph

6967 Commits

Author SHA1 Message Date
b4626359f5 Provide ScriptInterface CreateObject and CreateArray functions to replace Eval calls following 7c2e9027c2, 1c0536bf08 and later.
Differential Revision: https://code.wildfiregames.com/D2080
Previous version reviewed By: Krinkle
Comments By: historic_bruno, wraitii
This was SVN commit r22528.
2019-07-22 19:35:14 +00:00
32e8ed51aa UnitMotion - Send messages to UnitAI when obstructed, to allow stopping early when walking and avoiding pathfinding lag.
As reported by #5521, Ordering units to walk to a point in a forest can
lag terribly, as units will end up computing long short paths in the
forest, which can result in `ComputeShortPath` calls that individually
take upwards of 80ms.

This can be alleviated by allowing units to stop a bit earlier. A23
handled this in UnitMotion directly, but it's better to handle this in
UnitAI to avoid surprises and to make it customisable on a per-state
level.

This diff further speeds up using the short pathfinder by starting with
a smaller search range, limiting the max-range more and moving the range
slightly towards the goal.

This also refactors UM sending messages to UnitAI so that we may in the
future push more information (in particular, the entity_id that a unit
was obstructed by could be interesting for COMBAT).

This doesn't fix the possibility of lag, but it reduces its occurrence
to levels that should be similar to A23 and thus acceptable enough.

Tested By: Freagarach
Fixes #5521

Differential Revision: https://code.wildfiregames.com/D2105
This was SVN commit r22526.
2019-07-22 18:07:24 +00:00
51419d7092 Correct uncaught MapReader and MapGenerator throw statements following 2b138f47db and 2180862d40.
Differential Revision: https://code.wildfiregames.com/D2089
Reviewed By: historic_bruno
This was SVN commit r22521.
2019-07-21 01:35:39 +00:00
41ee485e68 Remove unused GUIManager SGUIPage members from 7c2e9027c2 and 4b1297b328.
This was SVN commit r22520.
2019-07-21 01:29:08 +00:00
13209c3183 Revert 09916ce6cb which broken jenkins build.
This was SVN commit r22519.
2019-07-20 13:10:53 +00:00
09916ce6cb Fix incorrect use of setlocale() in cppformat CStr tests following 61db02790c
Reported By: elexis
Differential Revision: https://code.wildfiregames.com/D2013
This was SVN commit r22518.
2019-07-20 12:57:03 +00:00
cca7627d88 Improvements to simulation hotloading before the SM upgrade, refs #4893.
SM45 will enforce property attributes described at
https://developer.mozilla.org/en-US/docs/Mozilla/Projects/SpiderMonkey/JSAPI_reference/Property_attributes.
We thus cannot hotload properties with the DontDelete attribute.
Fix an oversight in the hotloading code.
Rename a confusing parameter.

Reviewed By: wraitii
Differential Revision: https://code.wildfiregames.com/D1844
This was SVN commit r22516.
2019-07-19 21:58:58 +00:00
feb88a337a Pass arbitrary arguments to GUI events / SendEventToAll and remove loading screen progess workaround, refs D1716, 6d792365aa, bd3bd084c0, 4b1297b328, db5d4bb5f1.
Differential Revision: https://code.wildfiregames.com/D1754
Reviewed By: Itms
Comments By: leper
This was SVN commit r22515.
2019-07-19 21:15:04 +00:00
498d58e24d Fix reported memory leaks in the glooxwrapper following 61261d14fc
Differential Revision: https://code.wildfiregames.com/D2093
Reviewed By: elexis
This was SVN commit r22514.
2019-07-19 19:46:48 +00:00
6230bbea24 Update of the scripting tests. Test some modding features and update JS::Value integer limits.
Reviewed By: wraitii
Differential Revision: https://code.wildfiregames.com/D1850
This was SVN commit r22513.
2019-07-19 15:41:27 +00:00
3a839517ce Fix the -Wclass-memaccess compiler warning in the pathfinders Grid.h, refs #5294.
Differential Revision: https://code.wildfiregames.com/D2099
Reviewed By: historic_bruno, wraitii
This was SVN commit r22511.
2019-07-19 12:52:10 +00:00
e6f960bca6 Makes wxWidgets 3.0 dependency explicit in the game build.
Removes a few non-behavioral workarounds for older versions.

Refs #5502, #2891.
Accepted By: asterix
Comments by: vladislavbelov
Differential Revision: https://code.wildfiregames.com/D2076
This was SVN commit r22508.
2019-07-19 04:52:03 +00:00
6fc2114b58 Unit Motion - Improve handling of obstructed paths.
Units right now try going to their next long waypoint using the
short-range pathfinder. This works, but it tends to leads to units
clumping together when shuttling for example.

By switching to short paths earlier, and by scrapping the long waypoints
when doing so, we can make movement more natural until we have unit
pushing.

Some cleanup in how the short-path domain range gets handled, and
increase the max-range by one tile to improve rare cases.

Differential Revision: https://code.wildfiregames.com/D2095
This was SVN commit r22507.
2019-07-18 20:00:38 +00:00
9f8fb83a89 Removes deprecated 'register' storage class from mongoose. Refs #3068
This was SVN commit r22503.
2019-07-18 06:28:51 +00:00
fc32e28c0a Fixes some ambiguous calls of abs().
Fixes #5515.
Reviewed By: elexis
Differential Revision: https://code.wildfiregames.com/D2091
This was SVN commit r22500.
2019-07-17 22:39:30 +00:00
213c56e3e6 Improvements to the translators credits script.
Port the script to Python 3, fix some bigs in it, and remove whitespace
from the output.

Reviewed By: bb
Differential Revision: https://code.wildfiregames.com/D1810
This was SVN commit r22499.
2019-07-17 21:32:11 +00:00
dbebe0a39a Fix max-range approach when treating a target as a circle.
As reported by @bb in #5512, catapults and other big-range units might
not approach targets correctly when trying to get in range.
To be sure that we will be in range of a square obstruction approximated
as a circle, we need to consider the inscribed circle and not the
circumscribed circle.

Reported by: bb
Fixes #5512

Differential Revision: https://code.wildfiregames.com/D2086
This was SVN commit r22495.
2019-07-17 18:08:47 +00:00
e8f4ae36a7 MapGenerator to delete its ScriptInterface directly after last use, refs 64efbfeae3, D2085.
Differential Revision: https://code.wildfiregames.com/D2084
Reviewed By: historic_bruno
This was SVN commit r22489.
2019-07-17 00:07:10 +00:00
f41e4082d9 Fix missing return in previous (65b02395b3), use underscore as recommended by Vladislav.
This was SVN commit r22488.
2019-07-17 00:00:05 +00:00
65b02395b3 Remove Vector2D/Vector3D prototype workaround from EngineScriptConversions.
Fixes #5376, refs #2394.
Differential Revision: https://code.wildfiregames.com/D1991
Patch By: Krinkle
Comments By: Vladislav, wraitii
This was SVN commit r22487.
2019-07-16 21:52:49 +00:00
7e2512a739 Fix undefined behaviour introduced in 5c642611c4
5c642611c4 introduces undefined behaviour: for vertices that are part of
non-AA squares, the value of "quadOutward" is undefined. This fixes that
by again setting it to QUADRANT_ALL by default, as it was pre
5c642611c4. This led to OOS.

Reviewed By: elexis
Fixes #5508

Differential Revision: https://code.wildfiregames.com/D2082
This was SVN commit r22483.
2019-07-15 18:05:03 +00:00
a6f30c14d5 Provide microsecond precision in the RandomMapLogger too, refs 7a91d330d3.
This was SVN commit r22481.
2019-07-15 14:44:53 +00:00
4f62cc3ee7 Remove the unused variable proto from the ComponentManager in e9e05f4efc.
Add two missing error reports.
Move sanity check prior to the first variable use.

Differential Revision: https://code.wildfiregames.com/D1817
Patch By: Angen
This was SVN commit r22476.
2019-07-14 14:13:15 +00:00
b43904aae1 Unit Motion - optimisations to avoid recomputing paths too often
Three changes:
- Assume a certain incertain based on distance to the target, to avoid
recompute paths every turn when the target is far way and moving.
- Handle cases where the target is unreachable to the long-range
pathfinder and we would be recomputing every turn.
- If we went straight, assume we don't need to recompute a path.

These together make moving entities recompute paths far less often,
speeding up the game.

Differential Revision: https://code.wildfiregames.com/D2066
This was SVN commit r22474.
2019-07-14 11:08:15 +00:00
5c642611c4 Vertex pathfinder - fixes to quadrant optimisation to ensure units don't take detours around obstructions.
Compute the outward quadrants once and for all instead of setting them
dynamically, because there is no reason why we should always arrive from
the same quadrant as the first time we see a vertex.
Don't consider quadrants for the start-vertex, because of the edge
expansion (which can put us in illegal quadrants)

These result in (much) better paths, the tradeoff being that we now look
at some more vertices.

Fixes #5476

Differential Revision: https://code.wildfiregames.com/D1908
This was SVN commit r22473.
2019-07-14 10:19:18 +00:00
69f7a48dd9 Fix UB following 57362f7fa3, which could cause a crash when serialising.
Since m_ExpectedPathTicket.m_Type is uninitialised before being used,
serialisation could fail with an out of bouds error. This fixes it by
giving it an (arbitrary) default value.

Reported by: gameboy
Confirmed and debugged by: Angen
Reviewed By: Angen
Differential Revision: https://code.wildfiregames.com/D2074
This was SVN commit r22470.
2019-07-14 09:24:37 +00:00
5fe08f1471 Actually use variable added in 80d9a44ab5. Refs #5501.
This was SVN commit r22468.
2019-07-14 05:15:51 +00:00
80d9a44ab5 Fixes #5501 null pointer exception in AtlasUI on Windows.
Contrary to wxWidgets documentation, wxMenuEvent::GetMenu() can return
NULL when the system menu is accessed on wxMSW, see
https://trac.wxwidgets.org/ticket/18443.

This was SVN commit r22467.
2019-07-14 05:02:43 +00:00
7300dd186e Cleanup MapGenerator.cpp, use VfsPath, create RegisterScriptFunctions, add header comments, register TERRAIN_TILE_SIZE directly.
Refs 7a17a3152c, #4034, #4964.
Differential Revision: https://code.wildfiregames.com/D2068
VfsPath change accepted by historic_bruno.

This was SVN commit r22466.
2019-07-13 21:41:09 +00:00
e06285279a Vertex pathfinder: add the domain edges back to improve behaviour (reverts c42160ec10)
This adds back the "domain" edges to the short/vertex pathfinder.
Without these edges, units could use points far away from the path
search that they inaccurately thought were reachable, leading to some
pathing oddities in rare cases.

Reviewed By: temple
Differential Revision: https://code.wildfiregames.com/D443
This was SVN commit r22465.
2019-07-13 16:01:10 +00:00
055c848c1a Unit Motion - improve PathResult/Obstructed move handling
Reorder code flow, handle long paths and short paths in a more explicit
manner, and only fail after a certain number of failed path computations
to avoid going idle too easily.

Make sure WALKING orders in UnitAI stop when the move fails to avoid
units being stuck.

Differential Revision: https://code.wildfiregames.com/D1907
This was SVN commit r22464.
2019-07-13 15:53:21 +00:00
3c2f15ee8b Fix lineendings.
This was SVN commit r22460.
2019-07-12 17:40:40 +00:00
d5a3437882 Unify the magic number indicating the number of impassable tiles at the map edge redundant in the Pathfinder, RangeManager and MapGenerator.
Refs #4034, #4636.
Differential Revision: https://code.wildfiregames.com/D2061
Reviewed By: wraitii
This was SVN commit r22459.
2019-07-12 16:38:51 +00:00
dcf5bad7fd Unit motion - Check the return value of ComputeGoal and handle failure cases
As reported by @Freagarach on #5496, there can be broken behaviour as
UnitMotion::PathResult may call RequestLongPath with an uninitialised
path goal when ComputeGoal fails.

To fix this, check the return value everywhere and react accordingly in
case of failure.

Fixes #5496

Differential Revision: https://code.wildfiregames.com/D2063
This was SVN commit r22458.
2019-07-12 16:16:13 +00:00
57362f7fa3 UnitMotion - remove m_PathState, which is redundant with other variables.
m_PathState kept 3 pieces of information that can be deduced using other
variables:
 - whether the entity was following a path. This can be better deduced
by checking if the entity has short/long waypoints.
- whether a path is currently being requested. This can be better
deduced by checking the value of m_ExpectedPathTicket
- whether the requested path is long or short. This can be stored
directly alonside the path request ticket number, making it more obvious
why it exists.

With these changes, m_PathState can be removed.

Differential Revision: https://code.wildfiregames.com/D1903
This was SVN commit r22456.
2019-07-12 14:49:32 +00:00
e674da7e5e Unit Motion - Remove m_FinalGoal in favour of recomputing when necessary.
It is generally better to use the movement request data as that is our
actual target and goals are just a representation of that at any given
time. Where a PathGoal is required, compute this lazily.

This allow failing easily in MoveToX() functions if the goal cannot be
computed.

Differential Revision: https://code.wildfiregames.com/D1902
This was SVN commit r22452.
2019-07-10 18:57:53 +00:00
54f7a09a54 Unit Motion - make sure units that die while moving don't keep their obstruction
Introduced by 70e22e2923. PositionChanged messages sent between
MT_Destroy handling in CmpObstruction and the actual destruction of the
component could re-recreate an obstruction, which would then live
forever in the obstruction manager.

This prevents that by de-activating the obstruction when it is
destroyed, so that further PositionChanged messages do nothing.

Differential Revision: https://code.wildfiregames.com/D2060
This was SVN commit r22451.
2019-07-10 18:43:21 +00:00
bbc2e84160 Unit Motion - combine Goal computation logic from MoveToPoint and MoveToTarget
MoveToPoint and MoveToTarget both compute a goal from a move request.
They can be combined to reduce duplication and streamline the code.

Differential Revision: https://code.wildfiregames.com/D1984
This was SVN commit r22450.
2019-07-10 18:41:17 +00:00
7d610d3412 Remove redundant checks in HandleObstructedMove performed already by PathResult
HandleObstructedMove contains logic to drop long waypoints, should they
be occupied by units (because that can get the pathfinder stuck, since
the long-range pathfinder can find a path, but not the vertex one).

However PathResult already drops waypoints this way, so this code can be
removed for simplification.

Differential Revision: https://code.wildfiregames.com/D1981
This was SVN commit r22448.
2019-07-09 19:59:43 +00:00
4ca448a686 Fix Formation walking / other orders with the new UnitMotion
This fixes a number of issues with formations:
- Gives the controller an obstruction. This fixes the bug where units in
formations can't gather from a tree.
- Stop special-casing formation members in PathResult. This fixes
formation members being stuck in-place when they run in an obstruction.
- Makes sure units stay in Formation.IDle when they are idle so that
D1337/D1901 can work correctly in the IDLE state.
- Warn if animals enter this state.
- Make sure that formation members that end up in INDIVIDUAL.IDLE go
back to FORMATION.IDLE for sanity and for better housekeeping (refs
#3144 - fixed completely upstream).

Differential Revision: https://code.wildfiregames.com/D2048
This was SVN commit r22447.
2019-07-09 19:58:44 +00:00
a1dc9cadd8 UnitMotion / AI - remove the special 'move' animation, make UnitMotion inform the visual actor directly.
Use UpdateMovementState to inform the visual actor of the unit's speed,
which cill update the movement animation accordingly.
The removes the need for UnitAI to handle movement animation using the
special "move" state.

Differential Revision: https://code.wildfiregames.com/D1901
This was SVN commit r22446.
2019-07-09 19:56:28 +00:00
09e129bce2 Adds an tool to pick water high by terrain click in Atlas.
Reviewed By: trompetin17
Differential Revision: https://code.wildfiregames.com/D2037
This was SVN commit r22445.
2019-07-09 18:16:55 +00:00
8a32b0b3d4 Fix some gcc 8 and gcc 9 compiler warnings that were thrown 4500 times.
Refs #5294
Differential Revision: https://code.wildfiregames.com/D2055
Reviewed By: Vladislav
This was SVN commit r22443.
2019-07-09 00:18:48 +00:00
7cf6244110 Formation animation refactor - use animation variants instead of special move override.
The animation overrides are a little awkward. Instead, use animation
variants, which allow defining different animations (and props and such)
easily for different units in a formation.
This lets us clean up the special C++ code to override the walk
animations.

It continues the work started by 8446b92f1b.

Original Patch By: temple
Differential Revision: https://code.wildfiregames.com/D1337
This was SVN commit r22442.
2019-07-08 18:23:44 +00:00
3c3f85ce98 Unit Motion - remove m_State
Following D1899/98f609df1d, we have logic that can handle calling
MoveSucceeded() even if we don't go through the special STATE_STOPPING
state, and following D1898/8ac104b07a we no longer need STATE_STOPPING
for animation sync either.

m_State can therefore be entirely removed as it is redundant with other
information.

Differential Revision: https://code.wildfiregames.com/D1900
This was SVN commit r22441.
2019-07-08 18:09:21 +00:00
01161e3451 Fix build without precompiled headers following the Atlas UTF8 fix in 800bf0da24 and ThreadUtil include removal in ba736916fc.
Differential Revision: https://code.wildfiregames.com/D2043
Reviewed By: Vladislav, wraitii
This was SVN commit r22437.
2019-07-07 21:52:52 +00:00
da2f644428 Adds a possibility to disable saving of replay in autostart mode.
Reviewed By: elexis
Differential Revision: https://code.wildfiregames.com/D2017
This was SVN commit r22432.
2019-07-03 21:36:40 +00:00
99a341f379 UnitMotion - account for target's movement in ComputeTargetPosition (improve chasing behaviour).
After the recent UM changes, units sometimes chase/flee forever as they
can never actually get in range.
This is because moving to the current target's position is not enough
when the target is moving.

By accounting for the target movement's in ComputeTargetPosition, the
behaviour is much improved.

Differential Revision: https://code.wildfiregames.com/D1987
This was SVN commit r22431.
2019-07-03 18:09:31 +00:00
58018a1056 UnitMotion - rename CheckTargetMovement to PathingUpdateNeeded for clarity, and improve the logic.
This new version compares the final waypoint with the target's
obtruction shape and uses reachability checks to know if we will be in
range or not.

Differential Revision: https://code.wildfiregames.com/D1983
This was SVN commit r22430.
2019-07-03 18:06:53 +00:00
f990cd2381 Ensure units do get in attacking range since that range can change over time because of elevation differences.
This is a partial revert of 4fda917f46, which skipped the
"MoveToTargetAttackingRange" in APPROACHING. I (incorrectly) assumed
that the original order was still perfectly fine, but in fact the
attacker's max range may have changed as that depends on the relative
elevation between attack and target - and so the original order might
never get us in range!
This was introduced originally in 8c74df2acd.

Add a comment to clarify this.

Further, this makes sure UnitMotion still is aware that it has a target
even if it is in range from the beginning, as that could lead
to stuckiness (and did when chasing sometimes). This was done in D1984
anyways.

Fixes #5478.

Differential Revision: https://code.wildfiregames.com/D2035
This was SVN commit r22429.
2019-07-03 18:05:11 +00:00