1
0
forked from 0ad/0ad
Commit Graph

19799 Commits

Author SHA1 Message Date
81cd2f1cdf Fix walk-to-target and other movements with max-range "0" for target entities
Entities may never get to a distance of "0" when trying to reach other
entities, as that would mean they are right next to each other, or even
overlapping, which can fail.
Always give some leeway to distance when trying to move to a target with
no specified max-range.

This fixes WalkToTarget orders which resulted in units being stuck on
mines or on dropsites occasionally.

Reported by: elexis
Fixes #5510

Differential Revision: https://code.wildfiregames.com/D2087
This was SVN commit r22496.
2019-07-17 18:11:15 +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
7d73af990d Disables GnuTLS Native Language Support in build-osx-libs.sh, refs #5503
This was SVN commit r22494.
2019-07-17 14:51:57 +00:00
7f453a2bd0 Fixes silent download errors in build-osx-libs.sh. Fixes #5490.
This was SVN commit r22493.
2019-07-17 14:32:26 +00:00
01fd8a3654 Cleans up build-osx-libs.sh whitespace. Fixes #5486.
For consistency, long argument lists have been broken into multiple
lines after the first argument, with suitable indentation.

This was SVN commit r22492.
2019-07-17 14:20:40 +00:00
ecae8469ba Move domestic wolf from templates/trigger/ to templates/gaia/, refs cd6c31e76e, 79fb493da3, D176.
Differential Revision: https://code.wildfiregames.com/D1904
Patch By: Nescio
This was SVN commit r22491.
2019-07-17 14:14:53 +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
bb
29a8852ea4 Rename "CauseSplashDamage" to the more generic "CauseDamageOverArea"
Patch By: Freagarach
Comments By: wraitii, Nescio
Differential Revision: https://code.wildfiregames.com/D2065
This was SVN commit r22486.
2019-07-16 15:14: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
3e8205d7bf Moar lineendings.
This was SVN commit r22478.
2019-07-15 02:18:51 +00:00
e1bde4c337 Fix tests following 945d1ba2e6
945d1ba2e6 broke formation regression tests because there now needs to
be a timer call after the units become idle for behaviour to trigger.

Differential Revision: https://code.wildfiregames.com/D2077
This was SVN commit r22477.
2019-07-14 14:57:38 +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
945d1ba2e6 Fix IDLE-related infinite loops by moving stateful calls to IDLE.timer.
The game currently has several infinite loops, and the stack trace is
always a variation on the same pattern that units go through IDLE as a
default state, immediately try another order (possibly entering a new
state), failing, and goes back to IDLE.

IDLE.Timer is a general workaround for this issue. It wastes a turn
every time a unit goes idle, so should a better solution be found for
the general problem of infinite loops in UnitAI, it should be removed.

This revert 8bab09d37c which was intended as a safety net, but couldn't
protect againt infinite loops between two different states.

Fixes #5460

Differential Revision: https://code.wildfiregames.com/D2041
This was SVN commit r22475.
2019-07-14 11:40:27 +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
d0e6111ea1 Enable eslint rule no-floating-decimal and remove all superfluous floating decimal points.
Differential Revision: https://code.wildfiregames.com/D2003
Patch By: Krinkle
This was SVN commit r22472.
2019-07-14 10:03:10 +00:00
e53fb0a8d7 Make sure hunting units don't forget about the initial herd position (fix for 8a38cfb7cf)
Units move the InitPos of the heard to the last known position when
going through Order.Gather, which they do multiple times when hunting,
thus making them mistakenly move the herd position and unable to find it
back.

Differential Revision: https://code.wildfiregames.com/D2073
This was SVN commit r22471.
2019-07-14 09:38:17 +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
Alexandermb
3823023434 Sync trader_cart_idle Animation with the horse idle animation lenght in order to work properly.
Mentioned by @Angen

https://wildfiregames.com/forum/index.php?/topic/25397-committed-horse-update-20-retexture/page/4/&tab=comments#comment-379288

This was SVN commit r22463.
2019-07-13 14:37:24 +00:00
bb
ac5b7fdc34 Add periods and caps to the JSDOCs in Damage.js
This was SVN commit r22461.
2019-07-12 19:39:18 +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
a573460c65 Updates library LICENSE.txt for libsodium and macOS patches
This was SVN commit r22457.
2019-07-12 15:25:12 +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
1ecac53a38 Fixes GnuTLS build on macOS.
Fixes macOS linker warning "PIE disabled absolute - addressing not
allowed".

Updates nettle to 3.5.1, GnuTLS to 3.6.8, gloox to 1.0.22.
Disables TCP fast open feature of GnuTLS (requires 10.11, no SDK build
support).
Fixes GnuTLS detection of GMP by adding it to LIBS flag.
Disables getaddrinfo on gloox 1.0.22. Lobby connections failed during
server hostname resolution.
Adds --with-pic to GMP build to force consistent PIC usage.
Adds -N flag to patch commands to avoid reapplying them.
Removes unneeded build flags.
Documents --enable-fat configure flag: GMP and nettle detect
CPU-specific features, fat binaries let us build and run them on
different CPUs (see D1772).

Fixes #5453, 5489. Refs #5481.
Tested by: kali0ad, trompetin17
Reviewed by: elexis, trompetin17
Differential Revision: ​https://code.wildfiregames.com/D2057
This was SVN commit r22455.
2019-07-11 21:48:50 +00:00
1918fd11d4 fixing Build atlasUI inside xcode missing libpng, libjpeg
Refs #5493
Differential Revision: ​https://code.wildfiregames.com/D2062
Reviewed By: historic_bruno
This was SVN commit r22454.
2019-07-11 16:13:57 +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
54ffd9df94 Various Unit AI fixes following UM / UAI changes
- Garrisoning cleanup (return true in some cases in ENTER when we do
change the state)
- Fix animal walking speed until D1901 lands
- Fix trading behaviour which occasionally bugged out.

Differential Revision: https://code.wildfiregames.com/D2045
This was SVN commit r22440.
2019-07-08 18:06:37 +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
bb
61a346e55b Add damage container also in the examples, following f4babd9b34
Reviewed By: Nescio
Patch By: Freagarach
Differential Revision: https://code.wildfiregames.com/D1995
This was SVN commit r22436.
2019-07-05 18:15:42 +00:00
a70374b1da Improvements to gather order when out or resources and fix 8a38cfb7cf
8a38cfb7cf introduced an issue, as it expected "this.order.data.initPos"
to always exist. But going through `GatherNearPosition` did not set it.

Fix this by setting that variable in `GatherNearPosition`.
Use the opportunity to still fallback to the unit's position if the
variable were to not exist for some reason (defensive programming
against future changes).
Re-enable "return resource" behaviour as the final fallback case - The
GatherNearPosition call previously always passed thus this no longer
triggered.

Possible follow-up: try gathering near the dropsite found.

Differential Revision: https://code.wildfiregames.com/D2039
This was SVN commit r22434.
2019-07-04 19:55:09 +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