Commit Graph

43 Commits

Author SHA1 Message Date
c17e7ee92f Adds a helper function to pick entities with a given component and a given filter on screen.
Reviewed By: wraitii
Commented By: Stan, elexis
Differential Revision: https://code.wildfiregames.com/D2207
This was SVN commit r22939.
2019-09-20 07:45:55 +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
8ace8034a2 Fix mirages (and any other entity that blocks something but not BlockConstruction) blocking foundation construction following 29492badb7 / D21.
Clean the code by removing the animal hardcoding in the Foundation
component and adding a flag DeleteUponConstruction to the Obstruction
component.

Have locked gates and upgraded entities equally delete entities when
transforming.
Add a workaround for trees inside walls on random maps.

Reviewed by: temple
Differential Revision: https://code.wildfiregames.com/D1415
Refs #4268

This was SVN commit r21624.
2018-03-26 15:18:53 +00:00
29492badb7 Delete sheep corpses when starting to build a foundation,
so that units don't try to gather forever while not being able to reach
it and
so that the sheep corpse can't be selected and seen anymore.

Differential Revision: https://code.wildfiregames.com/D21
Fixes #4268
Based On Patch By: wraitii
Reviewed By: temple
Previously Reviewed By: Itms
This was SVN commit r21597.
2018-03-21 01:44:15 +00:00
340cda5d57 Use obstruction rather than footprint in dock placement
Differential Revision: https://code.wildfiregames.com/D1163
Reviewed by: wraitii
Comments by: mimo, s0600204
Fixes: #4843

This was SVN commit r20954.
2018-01-22 02:34:46 +00:00
be1a205f91 Add support for const methods in components and make those that can be const const.
Reviewed By: Itms
Differential Revision: https://code.wildfiregames.com/D75
This was SVN commit r19156.
2017-01-20 02:25:19 +00:00
417c84870c Actually remove trailing tabs from source/.
This was SVN commit r18991.
2016-11-23 14:09:58 +00:00
6149dd3841 Actually remove trailing whitespace for non-header files as well.
This was SVN commit r18989.
2016-11-23 13:02:58 +00:00
6471a54c9f Refactor GetEntityCollisions to make it clear what the function actually does since the new pathfinder
This was SVN commit r17992.
2016-04-06 17:36:47 +00:00
8dde1cda94 Style cleanup, and remove a wrong TODO.
This was SVN commit r16974.
2015-09-02 17:40:31 +00:00
128a603287 Use the terrain-only grid for terrain edges in the short pathfinder algorithm. This grid is updated on each terrain change, whereas the passability grid is updated once a turn. This caused OOS on rejoin, fixes #3292.
However, using the terrain-only grid reveals one discrepancy between the
short pathfinder (which uses unit radii) and the long one (which uses
unit clearances). So I implemented the change proposed by sanderd17 in
#3294, which is removing unit radius and using only the pathfinder
clearance. Refs #3294
Now some tweaking has to be done in the templates, so that units get a
passability class suited to their apparent size. In the meantime the
unit motion is quite bugged.

This was SVN commit r16867.
2015-07-18 08:37:49 +00:00
6581796103 New long-range pathfinder.
Based on Philip's work located at
http://git.wildfiregames.com/gitweb/?p=0ad.git;a=shortlog;h=refs/heads/projects/philip/pathfinder
Includes code by wraitii, sanderd17 and kanetaka.

An updated version of docs/pathfinder.pdf describing the changes in
detail will be committed ASAP.

Running update-workspaces is needed after this change.

Fixes #1756.
Fixes #930, #1259, #2908, #2960, #3097
Refs #1200, #1914, #1942, #2568, #2132, #2563

This was SVN commit r16751.
2015-06-12 18:58:24 +00:00
6aa99d762f Add a new spatial subdivision, based on an old patch by wraitii.
This subdivision is faster but less precise, so range queries get more
entities and are a bit slower (up to 1ms approx.), but the overall gain
on a simulation update is always positive and can reach 10ms per frame.

For now, this new subdivision is only used by the range manager,
integrating it in the obstruction manager might be sensible.

Refs #2430

This was SVN commit r16540.
2015-04-14 21:33:43 +00:00
49e2ecea63 Automatically convert all CLogger format strings from wchar_t* to char*.
Done with:

  ag -ls 'LOG(MESSAGE|MESSAGERENDER|WARNING|ERROR)' source | xargs sed
-i 's/LOG\(MESSAGE\|MESSAGERENDER\|WARNING\|ERROR\)(L/LOG\1(/g'

This was SVN commit r16183.
2015-01-22 20:31:30 +00:00
298115f4c5 Fix units chasing each other. Fixes #1537
This was SVN commit r14449.
2013-12-30 16:07:19 +00:00
05422ad545 Avoid slightly-expensive QueryInterface() calls
Add CEntityHandle which wraps an entity_id_t and also has a pointer to a
per-entity array of IComponents. QueryInterface/CmpPtr on a handle just
involve a couple of pointer dereferences instead of a map lookup.

This requires sizeof(void*) per registered interface type per entity,
which is currently ~0.5KB per entity, which shouldn't be a problem.

This was SVN commit r13825.
2013-09-11 20:41:53 +00:00
041855e547 Allow building walls along the shore. Patch by sanderd17. Fix #1610.
This was SVN commit r13542.
2013-07-07 22:44:47 +00:00
3f00d4d997 Change some size() > 0 to Based on patches by kuranes and Markus. Refs #1852, #1923.
This was SVN commit r13413.
2013-05-21 22:11:47 +00:00
ca92e50048 Adds notification tooltips for building placement, fixes #921.
Tweaks info tooltip borders and padding to improve readability.

This was SVN commit r13191.
2013-02-24 00:12:41 +00:00
613f845095 Improve gate closing behaviour when locked or with no allies nearby. Fixes #1551.
This was SVN commit r12337.
2012-08-09 19:06:01 +00:00
be31d3a9e7 Added a function for finding colliding entities with identical control groups. Refs #1529.
This was SVN commit r12269.
2012-08-03 16:36:40 +00:00
692795e56e Added engine-side obstruction group sanitizing, saving, and loading. Refs #1566
This was SVN commit r12258.
2012-08-01 21:38:13 +00:00
51b9fa6186 Uses xml attributes instead of elements for obstructions shapes.
This was SVN commit r12093.
2012-07-12 20:00:38 +00:00
2c5933912c Gates. Adds UI buttons, replaces wall section with a gate, defines and create obstruction shapes, detects friendly units and eventually disable door's "block movement" flag, allows us to lock / unlock the door by disabling "block pathfinding" flag. Needs icons, play sound, animations. Fixes #1385, refs #619.
This was SVN commit r12081.
2012-07-08 16:25:33 +00:00
vts
d67d2e2370 Updated some documentation in CmpObstructionManager
This was SVN commit r11766.
2012-05-05 23:10:25 +00:00
vts
490182ddd0 Wall placement. Closes #786.
This was SVN commit r11760.
2012-05-05 19:22:22 +00:00
08bd07ddd6 Adds safe bool operator to ICmpPtr, replacing the null() method, based on patch by leper. Also changes bool operator in AtSmartPtr to safe bool. Fixes #1077.
Changes some CmpPtr variable names for consistency.

This was SVN commit r11036.
2012-02-08 02:46:15 +00:00
609f1643d5 Fix -Wconversion warnings in simulation code.
Cast to smaller integer types explicitly.
Generally avoid platform-dependent types (size_t) in simulation code.
Use float versions of math.h functions, not double.

This was SVN commit r10017.
2011-08-16 11:18:32 +00:00
f378e2e651 Implements building restrictions (by terrain, territory, category, and distance). See #41. Fixes #804, #287.
Implements build limits. See #687.
Implements autorotation for dock placement.
Fixes unit spawning to consider terrain passability. See #893.
Adds new passability criteria based on distance from shore.
Updates build restrictions on some templates.
Changes unit spawning search to 4 tiles away from foundation.
Changes garrison/training spawn failure to nicer UI notification.

This was SVN commit r9970.
2011-08-06 08:11:05 +00:00
edd8ef2bf2 Fix units in formation blocking construction and not moving out of the way (see #779).
Make non-movement-blocking buildings (e.g. farms) not require units to
move out of the way.

This was SVN commit r9510.
2011-05-13 20:32:41 +00:00
f4f36af852 Block new buildings being placed on top of existing not-yet-started foundations. Fixes #740.
This was SVN commit r8980.
2011-02-24 21:49:24 +00:00
b8925fbbc9 # Support AI construction of buildings.
Pass terrain passability data to AI scripts.
Expand pathfinder passability data to 16 bits per tile, to allow more
classes.
Support 16-bit ints in serializer.
Partially support JS typed arrays.
Allow foundations to be placed on top of units (fixes #499).
Stop farms and fishes blocking movement (fixes #534).
Add obstruction flags to allow finer control over what they block.
Associate entity IDs with obstruction shapes, to allow finding colliding
entities.
Support moving to the edge of a target entity with inactive obstruction.
Support foundation entities in AI.
Support playing as non-hele civs.

This was SVN commit r8899.
2011-02-10 16:06:28 +00:00
c3b734775b Simplify component interface: remove explicit context parameter, use GetSimContext() instead.
This was SVN commit r8867.
2011-01-16 14:08:38 +00:00
e13196e7a2 Fix serialization of most components
This was SVN commit r8449.
2010-10-23 19:59:40 +00:00
2b57f4f998 # Initial support for formation movement.
Support asynchronous path queries.
Allow escaping when stuck in impassable terrain tiles.
Split Update message in multiple phases, to cope with ordering
requirements.
Support automatic walk/run animation switching.

This was SVN commit r8058.
2010-09-03 09:55:14 +00:00
0cd0a1f584 # Add auto-attacking of nearby enemies.
Add general range-detection code.
Avoid unnecessarily computing 3D entity positions.

This was SVN commit r7817.
2010-07-29 20:39:23 +00:00
dff694f0f0 Fix units spawning on top of each other.
Add type-safety to prevent that kind of bug happening again.

This was SVN commit r7691.
2010-07-04 17:19:38 +00:00
4fe991074f Expose Footprint::GetShape and TemplateManager::FindAllTemplates to scripts.
Make CSimContext accessible to all component code, so they don't all
have to save their own copies of it.

This was SVN commit r7490.
2010-05-01 09:48:39 +00:00
cfae58928f # New unit movement system, which does a far better job of approaching targets and avoiding obstacles.
Add short-range vertex-based pathfinder.
Integrate new pathfinder into unit motion code.
Change obstruction system to get rid of circles, and differentiate
structures from units.
Make PositionChanged messages synchronous.
Try to prevent some accidental float->int conversions.

This was SVN commit r7484.
2010-04-29 23:36:05 +00:00
dd809f83e8 # Add documentation of the entity template XML file format.
Simplify the format a bit.
Use less <interleave> in the RNG so that error reports become
understandable.
Fixes #491.

This was SVN commit r7478.
2010-04-23 16:09:03 +00:00
40688ec5df # Initial support for automatic validation of entity template XML.
Add RelaxNG schemas for all current components.
Add -dumpSchema command-line option to dump the combined entity schema.
Add a Perl script to validate entity templates against the schema.
See #413.

This was SVN commit r7452.
2010-04-09 19:02:39 +00:00
baead3409e Move Position.h to a better location.
Update some files I forgot in previous commits.

This was SVN commit r7361.
2010-03-17 23:13:21 +00:00
6a2d237aad # Initial pathfinder integration in new simulation system
Minor extra terrain overlay features

This was SVN commit r7293.
2010-01-29 21:13:18 +00:00