1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-11-24 08:32:34 +02:00
Commit Graph

54 Commits

Author SHA1 Message Date
Ivan Savenko
c3ce4b25df Removed all #include's of CMap.h from headers.
To all - please, avoid #include's in headers as much as possible
This kills incremental build compile times
2015-12-02 21:05:10 +02:00
ArseniyShestakov
df4515901d CPathfinder: fix special movement boundary check
Forgot to fix it for water walking after fe12b8f664
2015-11-23 14:11:08 +03:00
ArseniyShestakov
2632389aaf CPathfinder: bring FoW reference back to avoid performance loss
This one is revert 148355908d
2015-11-22 21:06:37 +03:00
ArseniyShestakov
6dacb84404 CPathfinder::addNeighbours: avoid allocating new vector each time 2015-11-22 07:32:33 +03:00
ArseniyShestakov
8217eb3a82 CPathfinder: split isLayerTransitionPossible into two functions
This way we can avoid usage of getNode for layers that clearly can't be used.
2015-11-22 06:16:16 +03:00
ArseniyShestakov
a1fe2ebc44 Pathfinding: restore gamestate usage to avoid overhead
Also when possible pass TerrainTile pointers to getMovementCost instead of using getTile.
2015-11-21 14:31:30 +03:00
ArseniyShestakov
438a444443 CGHeroInstance: move native terrain check into getNativeTerrain
That make it easier to use that code independently in TurnInfo
2015-11-21 13:32:45 +03:00
ArseniyShestakov
5ae6225ebc TurnInfo: implement internal bonus cache for most used bonuses
Bonus system even with caching add too big overhead so we'll only use it once for these bonuses.
Still I'm like it to be transparent for external code so it's a bit hacky code.
2015-11-21 10:00:09 +03:00
ArseniyShestakov
adeefe903a CGPathNode: apply suggested optimizations
Also make EPathfindingLayers ui8 too
2015-11-19 03:08:57 +03:00
ArseniyShestakov
ab9680a7d9 CPathfinder: handle event object properly everywhere
Also add forgoted check for AdvmapInterface to avoid possible crash.
2015-11-17 07:09:01 +03:00
ArseniyShestakov
e9636a8d37 CPathfinder: add TODO and ideas for available options 2015-11-17 04:33:21 +03:00
ArseniyShestakov
fe12b8f664 Pathfinding: re-introduce EAccessibility::FLYABLE
That let us get rid of really hacky code in initializeGraph and also fix flying over tiles that aren't visible.
2015-11-17 03:59:02 +03:00
ArseniyShestakov
578aa2acd4 Pathfinding: don't use gamestate directly as it's not needed 2015-11-16 21:22:11 +03:00
ArseniyShestakov
d524b4eabe CPathfinder: get rid of addNeighbours coord argument 2015-11-16 19:54:17 +03:00
ArseniyShestakov
8f72d73241 CPathfinder: update teleport code and use TurnInfo for whirlpools 2015-11-16 19:14:18 +03:00
ArseniyShestakov
0949283cb9 Pathfinding: pass PathfinderOptions to helper and avoid changing them
Original idea behind options is that options should only be set on pathfinder object creation (or via some special method in case pathfinder become persistent).
2015-11-16 18:43:02 +03:00
ArseniyShestakov
3185b64fb0 CPathfinder: rename cObj and dObjt to ctObj and dtObj
This way it's more clear that it's pointer to object on tile and not path node.
It's important because air layer nodes don't have visitable objects while tile under them can have one.
2015-11-16 17:41:23 +03:00
ArseniyShestakov
6dd9572644 CPathfinder: cleanup checks for source node visitable object 2015-11-16 17:36:58 +03:00
ArseniyShestakov
aa59ad05ed CPathfinder: don't access map->guardingCreaturePositions directly 2015-11-13 23:32:52 +03:00
ArseniyShestakov
d2baa5b0d0 Pathfinding: move isLayerAvailable into TurnInfo 2015-11-12 14:40:56 +03:00
ArseniyShestakov
abc4ea272f TurnInfo: store all bonuses and use TileInfo for everything
Currently this going to break ONE_WEEK bonuses because those don't work with CWillLastDays selector.
2015-11-12 14:30:29 +03:00
ArseniyShestakov
9ed9d94009 TurnInfo: first step towards better abstraction 2015-11-12 05:20:32 +03:00
ArseniyShestakov
d76b2b7ca8 CPathsInfo: rework nodes multi_array allocation 2015-11-12 00:05:20 +03:00
ArseniyShestakov
46b923713b Pathfinding: rework isLayerTransitionPossible and fix formatting 2015-11-11 22:08:15 +03:00
ArseniyShestakov
f1311abd0b CPathfinder: move node action code into getDestAction 2015-11-11 19:51:08 +03:00
ArseniyShestakov
4aaf6191a5 CPathfinder: implemented originalMovementRules option 2015-11-10 21:07:27 +03:00
ArseniyShestakov
2b6851b3d2 Pathfinding: use unique_ptr for hlp and fix few rules 2015-11-10 19:15:59 +03:00
ArseniyShestakov
9a63735c24 CPathfinderHelper: implement TurnInfo to avoid bonus re-checking
TurnInfo contain information about what movement-related bonuses and MP hero going to have on certain turn.
This way we can collect this information once for each turn so it's huge performance boost.
2015-11-10 14:26:45 +03:00
ArseniyShestakov
2ef9d7c3ec Rename getCost back to getMovementCost
Initially wanter to name main class differently and back then getCost make sense.
Then renamed class to CPathfinderHelper, but forgot to rename function back.
2015-11-10 02:30:05 +03:00
ArseniyShestakov
b2e1ee5363 CGameState: move two pathfinding-related functions to CPathfinderHelper
Both getMovementCost and getNeighbours have nothing to do with gamestate.
2015-11-10 02:15:27 +03:00
ArseniyShestakov
d3c8ca7c1c Pathfinding: implement duration checking for fly and water walking
Now pathfinder take into account different bonuses for different tuns. So if you only have FLYING_MOVEMENT bonus from Fly spell for one turn then pathfinder will only let you use air layer within one turn only.

That work for cost calculations too. Let's say you have two bonuses:
 - FLYING_MOVEMENT with 20% penalty for next 2 turns
 - FLYING_MOVEMENT with 40% penalty for 5 turns
Now pathfinder using correct penalty for each turn so movements in air layer going to be more expensive on 3-5 turns.
2015-11-09 19:57:26 +03:00
ArseniyShestakov
45e4cf354e Revert "Pathfinding: do path calculation in separate thread"
This reverts commit f376b27999.
2015-11-09 09:35:56 +03:00
ArseniyShestakov
f376b27999 Pathfinding: do path calculation in separate thread 2015-11-08 19:19:48 +03:00
ArseniyShestakov
9cf35d1bfd CPathfinder: support for Castle Gate
No support for client / server implemented yet.
2015-11-08 10:06:24 +03:00
ArseniyShestakov
be37e1cd8b CPathfinder: add const to appropriate methods 2015-11-08 08:39:00 +03:00
ArseniyShestakov
f590b364c5 Pathfinder: shorten EPathfindingLayer to ELayer 2015-11-08 08:27:51 +03:00
ArseniyShestakov
4af9c7c29d CPathfinder: add one turn boundary for flying and water walking
Now when oneTurnSpecialLayersLimit is enabled hero won't be able to stop on blocked or water tiles between turns.
It's default H3 mechanics so it's enabled by default.
2015-11-08 07:44:00 +03:00
ArseniyShestakov
4973a1ec90 CGPathNode: get rid of land member as it's now obsolete
CTerrainRect::showPath behaviour changed so it's will only add cross path graphics on embark/disembark and path ending.
We want continuous paths for flying and water walking even when land<-> water transition occur.
2015-11-08 04:01:58 +03:00
ArseniyShestakov
160fa38254 Client: change cursor using node action information of pathfinder 2015-11-08 03:10:48 +03:00
ArseniyShestakov
82048cbf2d Pathfinder: implement new feature - node action
No action going to simplify isMovementAfterDestPossible and should be as well useful for cost calculations.
It's can be also used by client interface to show appropriate cursors and path.
2015-11-08 00:26:41 +03:00
ArseniyShestakov
bd8eec7fb8 CGPathNode: move resetting code into separate function 2015-11-07 22:16:45 +03:00
ArseniyShestakov
d8a612f5d6 CPathsInfo: use boost::multi_array for storing graph of nodes 2015-11-07 22:02:57 +03:00
ArseniyShestakov
3f2cdf3137 CPathfinder: implement priority queue and node locking 2015-11-07 21:11:07 +03:00
ArseniyShestakov
148355908d CPathfinder: get rid of FoW variable and bunch of small fixes 2015-11-05 15:04:56 +03:00
ArseniyShestakov
f4dea88e3b CPathfinder: get rid of hero object usage when it's not needed 2015-11-04 15:38:15 +03:00
ArseniyShestakov
1bc335323d CPathfinder: add lightweightFlyingMode option suggested by @alexvins 2015-11-04 15:05:22 +03:00
ArseniyShestakov
330c1666fc CPathfinder: move isLayerTransitionPossible and remove outdated comment 2015-11-04 12:29:51 +03:00
ArseniyShestakov
595deda270 CPathfinder: rename functions to better represent what they doing 2015-11-04 11:47:43 +03:00
ArseniyShestakov
400152caee CPathfinder: draft implementation of layers logic; not yet works 2015-11-02 16:03:03 +03:00
ArseniyShestakov
9c1c7d0caf Pathfinding: move getNode into CPathsInfo 2015-11-02 14:04:26 +03:00