For now, we use the nearest-edge to nearest-edge distance for min-range
checks (following much discussion on D981).
This was missed when committing it in c219ee54b2.
UnitMotion was already correctly not using opposite edge checks.
Differential Revision: https://code.wildfiregames.com/D2031
This was SVN commit r22416.
The reason was that the unit immediately tried gathering nearby instead
of going to the unit's last known position.
Related to D1997.
Differential Revision: https://code.wildfiregames.com/D1996
This was SVN commit r22414.
Due to an issue in 4a15cc3b9f, animals incorrectly tried going towards
the roaming point instead of away from it.
With that fixed, MovementUpdate still did not trigger as the min and max
range were the same.
Use -1 as max range (= infinite) instead since we want to move
arbitrarily away.
Having an infinite max range was broken in c219ee54b2, this
re-implements that.
Further, other calls with equal min and max range have been changed
likewise.
This does not entirely fix whales, which run in other problems because
of their large roaming range.
Differential Revision: https://code.wildfiregames.com/D1980
This was SVN commit r22413.
ea208f19a3 introduced an "IsInjured" function, used in the GUIInterface.
Mirages must mock this function and this was missed in the original
diff.
Tested By: wowgetoffyourcellphone
Differential Revision: https://code.wildfiregames.com/D2018
This was SVN commit r22411.
- put modification each on an own line
- space/tab correct
- space correct objects
- remove trailling 0's
Partially requested by: Stan
Patch By: Nescio
Differential Revision: https://code.wildfiregames.com/D1953
This was SVN commit r22408.
It helps to test/debug patches like D1847.
Reviewed By: wraitii
Differential Revision: https://code.wildfiregames.com/D1972
This was SVN commit r22395.
When adding a batch of unit, these in-training units get added to the
production queue and to the entity limit count.
These in-training units need to be removed from the entity limit counts
when spawning them, or we would be double-counting them. This was done
when creating the cached entities, but this was too early: entities
might fail to spawn, for example when there is no room around the
foundation.
Change that so the entity limit count is now decremented right before
giving spawned entities the correct owner (which triggers EntityLimits
OnGlobalOwnershipChanged, which adds the spawned entities to the entity
limit count).
Additionally, add Init to TrainingRestrictions so that the test setup
doesn't complain. Other components have an empty Init instead of
checking for Init in the test setup (and 61/67 have an Init function) so
it seems more standard this way.
Reported By: elexis
Reviewed By: wraitii
Patch By: Angen
Tests By: wraitii
Differential Revision: https://code.wildfiregames.com/D1879
This was SVN commit r22375.
0c20afdfda made states more caller-independent but did not change some
callsites to be compatible with that. This fixes those.
This does not fix chasing entirely however since unitMotion does not
always recognize that the target moved enough that the entity will never
be in range.
This will be fixed upstream.
Differential Revision: https://code.wildfiregames.com/D1968
This was SVN commit r22367.
4fda917f46 introduced mistakes in range checks which sometimes broke
garrisoning and repairing.
Reported By: gameboy
Differential Revision: https://code.wildfiregames.com/D1963
This was SVN commit r22353.
UnitAI is now solely in charge of moving and stopping, making UnitMotion
behaviour easier to predict, which will ultimately help with unitAI
development. It might temporarily make units more resilient than before
however.
UnitMotion also tells UnitAI that it's arrived with "MoveCompleted"
messages, but these actually could be wrong - unitAI could decide that
we didn't want to stop after all - so change the name for something less
misleading.
Differential Revision: https://code.wildfiregames.com/D1886
This was SVN commit r22351.
"MoveStarted" messages were sent by UnitMotion when the unit started
moving (sort of) or failed to do so. This was used by formations and
guarding but was not really necessary as this can be done in "enter" or
in a timer.
Differential Revision: https://code.wildfiregames.com/D1885
This was SVN commit r22350.
These functions were placed in UnitMotion, which had nothing to do with
range checks and made them available only to moving entities for no
particular reason.
This patch also adds support for square-square range checks and
shape-shape distance checks.
Modified from a patch by bb on top of work from wraitii.
Differential Revision: https://code.wildfiregames.com/D981
This was SVN commit r22345.
Reuse the timer code in the gathering sub-state to avoid broken
duplication.
Reported By: minohaka
Test By: Angen
Differential Revision: https://code.wildfiregames.com/D1956
This was SVN commit r22342.
0c20afdfda had two issues:
- some of the unitAI code did not return true when switching states in
the "enter" phase
- missed a return false in unitMotion.cpp
This fixes the issue noticed by @bb.
Differential Revision: https://code.wildfiregames.com/D1947
This was SVN commit r22339.