Commit Graph

64 Commits

Author SHA1 Message Date
atlimit8
8ad1140921 Reduce ICrushable trait lookup & drop -SubCell suffix.
Replace `a.HasTrait<ICrushable>()` with a.TraitsImplementing<ICrushable>().Any() or equivalent.
2014-08-30 04:43:57 -05:00
atlimit8
e29b9edfc1 Changes to map.cs, rename IPositionable.IsLeaving{ => Cell}, add IPositionable.GetValidSubCell 2014-08-29 23:30:16 -05:00
atlimit8
63c28ee4d7 Refactored in new enum SubCell 2014-08-29 23:00:53 -05:00
atlimit8
b2c9064545 Refactored [sub-]cell availability logic in IPositionable & ActorMap
Moved the logic from IPositionable.CanEnterCell & integrated sub-cell selection.
Added IPositionable.IsMovingFrom(CPos location, int subCell = -1) - to detect transient actors
Renamed IPositionable.{GetDesiredSubcell => GetAvailableSubcell} - since it checks for available sub-cells
Reduced IPositionable.CanEnterCell to one method that usually uses IPositionable.GetAvailableSubcell
Added actor checking to ActorMap.{HasFreeSubCell, FreeSubCell, AnyUnitsAt} - used by [sub-]cell availability logic
2014-08-29 23:00:53 -05:00
atlimit8
ff7ad53dee Fixed UnloadCargo stacking using new subcell API exposure 2014-08-29 23:00:53 -05:00
Alexander Fast
070d00c678 Fixes year numbers in license text in file headers. 2014-08-21 11:27:52 +02:00
atlimit8
4b7537bb13 Moved MobileInfo.SubCellOffsets to Map (dropping static) & added Map.SubCellsDefaultIndex 2014-08-04 18:09:26 -05:00
atlimit8
43478dd500 enum SubCell => int & Dictionary<SubCell, WVec> => WVec[] 2014-08-04 18:09:26 -05:00
Paul Chote
d7f1b1c9e2 Remove CVec -> WVec conversion. 2014-06-27 23:30:41 +12:00
Paul Chote
7b52fa52b6 Replace CPos.CenterPosition -> Map.CenterOfCell. 2014-06-27 23:30:40 +12:00
Paul Chote
b6d1d26eeb Add World parameter to Util.BetweenCells. 2014-06-27 23:30:40 +12:00
Paul Chote
086ec07eb6 Add World parameter to Target.FromCell. 2014-06-27 23:30:40 +12:00
ScottNZ
90894aa03e Use var everywhere 2014-06-15 22:17:34 +12:00
RoosterDragon
b733465f33 General uncontroversial cleanup:
- Made private methods static where possible (runtime can elide checking the object for null).
- Declared attribute classes as sealed (allows reflection on attributes to complete faster).
- Moved some static cctor's into field initializers (static cctor's are slower than static field initializers).
- Made classes static if they contained only static methods (can't create instances of useless objects).
- Use inferable Exts.Lazy and not new Lazy<T>().
- Added required STAThread attribute to CrashDialog.
- Removed unused parameters in private methods.
- Added Serializable attribute to exceptions.
- Added parameter name in calls to ArgumentNullException.
- Use of as operator instead of is + cast.
- Changed (x as Foo).Bar anti-pattern into ((Foo)x).Bar. Results in sensible cast exceptions on error rather than null dereferences.
- Removed unused method in NullShader.
2014-05-23 15:50:54 +01:00
Paul Chote
4935266945 Merge FileFormats dll into Game and reorganise namespaces. 2014-04-17 01:20:47 +12:00
Ian T. Jacobsen
3c80024113 Made Move::NotifyBlocker handle traits appropriately 2014-02-09 15:50:49 +00:00
Matthias Mailänder
b5fcb297af Merge pull request #3726 from pchote/cloak-fix
Cloak fixes
2013-08-23 09:27:56 -07:00
Paul Chote
bc5c11e44f Check ITargetable when deciding target validity. Fixes #3659. 2013-08-22 19:29:05 +12:00
Matthias Mailänder
d167eaea04 SetVisualPosition to the final position
to avoid movement glitches
2013-08-20 20:42:01 +02:00
Matthias Mailänder
d272377d66 Fixed division through zero in moveFractionTotal
closes #3710
2013-08-19 20:39:45 +02:00
Paul Chote
4f3c9aa0af Introduce Target.Type property. 2013-08-11 22:23:52 +12:00
Paul Chote
c3f04cc32e Convert non-aircraft positioning to world coords.
This removes the incomplete and unused hover code
on Mobile, which would be more trouble that it is
currently worth to carry over.
2013-07-21 17:35:47 +12:00
Paul Chote
6a435752fd Remove *PxPosition from IOccupySpace/IPositionable. 2013-07-21 17:35:46 +12:00
Paul Chote
3e9bc63d4e Prevent things from tweaking mobile position directly. 2013-07-21 17:35:45 +12:00
Paul Chote
0676116d77 Convert Move and related plumbing to world coordinates. 2013-07-21 17:35:45 +12:00
Paul Chote
abdfac6e85 More style fixes for Move. 2013-07-21 17:35:45 +12:00
Paul Chote
a263fd879d Account for sub-cell offsets in FindUnitPathToRange. Fixes #2417. 2013-07-10 21:23:30 +12:00
Paul Chote
b10a5d27a0 Tidy up Move. 2013-07-10 20:34:19 +12:00
Paul Chote
91698678a2 Use WRange for Mobile.MoveWithinRange. 2013-07-10 19:59:03 +12:00
Paul Chote
8fe0eb73e2 Ensure a valid target in move. 2013-07-08 23:40:21 +12:00
Paul Chote
9eaeeffae9 CenterLocation.ToCPos() -> CenterPosition.ToCPos(). 2013-07-08 21:52:26 +12:00
Paul Chote
82b7854ed7 Make MobileInfo.SubCellOffsets static. 2013-07-08 21:52:25 +12:00
Matthias Mailänder
2abde381a7 Exposed PathSearch.owner and removed Player argument from PathFinder functions. 2013-03-10 07:33:31 +01:00
James Dunne
ba1a36f26e Units heading in generally opposite directions are now considered blockers; this fixes pathing deadlocks. 2012-07-05 23:53:31 -05:00
James Dunne
9c9a16d80e Path planning no longer considers moving friendly units as blockers. 2012-07-05 23:52:34 -05:00
James Dunne
1fa70d259f Removed INudge in favor of INotifyBlockingMove. 2012-06-24 20:26:01 -05:00
James Dunne
845379e577 Harvesters no longer block each other during low-ore contention and wait for a random amount of time while idle to search for more resources. 2012-06-24 20:26:00 -05:00
James Dunne
80123b6aa4 Many harvester behavior improvements; summary below.
Implemented Harvester territory marking with a simple resource claim system in ResourceClaimLayer trait added to World.
Added customCost for PathSearch to support new Harvester search preferences.
Explicit delivery order forces harvester to always deliver to that refinery.
Explicit harvest order frees harvester from forced delivery refinery and allows for auto-balancing.
Harvesters auto-balance refinery choice such that no more than 3 harvesters are linked to any one refinery at a time.
Harvesters try very hard to not block the refinery dock location.
Harvesters try to avoid enemy territory when searching for resources.
Group-select harvest order intelligently disperses harvesters around the order location.
Fixed PathFinder caching to not be a sliding window. This is a correctness issue. Sliding window causes no-route paths to be cached permanently in tight move loops and doesn't allow eventual progress to be made. This may have negative performance implications.
2012-06-24 20:26:00 -05:00
James Dunne
9c49143534 New types for cell and pixel coordinate position/vectors. 2012-06-21 15:36:59 -05:00
unknown
21ab0b461c Added straightforward hover behavior for all units. Give a unit a nonzero Altitude: in its Mobile: block and the WithShadow: trait to make it hover. 2012-06-18 20:53:38 +12:00
Chris Forbes
2bc260c833 move Activity from OpenRA.Traits.Activities namespace to OpenRA.Traits 2011-10-06 23:11:58 +13:00
Chris Forbes
55036cd58c fix trailing whitespace everywhere 2011-09-26 08:40:39 +13:00
Chris Forbes
36f6e503ef clean up some of the noise in Move 2011-08-15 14:48:17 +12:00
Paul Chote
19ead53223 Add a WarnCrush method to ICrushable which is called when a crusher begins to enter the cell. 2011-07-15 20:10:21 +12:00
Paul Chote
74d13286a8 Add a force flag to nudging which skips the ownership and idle checks 2011-07-15 20:10:21 +12:00
Paul Chote
64b88819a9 Add plumbing to support ownership checks in MobileInfo.CanEnterCell. 2011-07-14 21:00:50 +12:00
Paul Chote
d4baf2d757 Refactor UnitInfluence trait -> world.ActorMap 2011-05-22 19:32:53 +12:00
Chris Forbes
4f76876f05 remove one of the Move constructors 2011-04-17 19:22:21 +12:00
Paul Chote
4f83e994d0 Tidy up Activity.Cancel(), make Tick abstract 2011-04-16 13:18:22 +12:00
alzeih
0a67c68c45 GetTargetQueue -> GetTargets + Exts 2011-04-16 12:57:55 +12:00