Commit Graph
100 Commits
Author SHA1 Message Date
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 5106738160 Merge branch 'develop' into feature/pathfinderLayers 2015-11-09 19:20:13 +03:00
ArseniyShestakov 96897acc46 CWillLastDays: add condition for permanent durations
Accidentally missed them in pull request
2015-11-09 19:05:22 +03:00
ArseniyShestakov b8ccb5916c Merge pull request #139 from ArseniyShestakov/fixDaysBonusDuration
Bonus system: N_DAYS duration support and new CWillLastDays selector
2015-11-09 17:17:12 +03:00
ArseniyShestakov 7f0b0bd1b5 Bonus system: use updateBonuses in battleTurnPasseed 2015-11-09 15:48:07 +03:00
ArseniyShestakov ee1c5e452f Bonus system: add CWillLastDays selector 2015-11-09 15:01:58 +03:00
ArseniyShestakov 5bfbd8526b Bonus system: fix N_DAYS bonus duration 2015-11-09 14:18:36 +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 74198a537b CGameHandler::setOwner: fix InfoWindow text on last town loss 2015-11-09 00:54:59 +03:00
ArseniyShestakov 866a0a1fc0 VCAI: little improvement for 2a59cb6191 2015-11-08 23:02:59 +03:00
ArseniyShestakov a49950e958 Fix 2292. Fix chat on adventure map, increase maxOutputPerLine 2015-11-08 22:16:58 +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 2fb73c55e1 CPathfinder: use node action in isMovementAfterDestPossible checks 2015-11-08 04:41:06 +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 842da69a3e CAdvMapInt::tileHovered cleanup function a bit more 2015-11-08 03:33:01 +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 7eebcb9d60 Artifacts: replace few more ints by ArtifactID 2015-11-07 11:46:58 +03:00
ArseniyShestakov bd12989ad6 Artifacts: use ArtifactID instead of ints 2015-11-06 21:54:51 +03:00
ArseniyShestakov 148355908d CPathfinder: get rid of FoW variable and bunch of small fixes 2015-11-05 15:04:56 +03:00
ArseniyShestakov 9fe442537b Pass on EPathfindingLayer and small fixes for code around it 2015-11-05 12:46:44 +03:00
ArseniyShestakov 5f3e9deda7 CPathfinder: deny transit over whirlpools when hero not protected 2015-11-05 11:34:01 +03:00
ArseniyShestakov a1290f548b CPathfinder: only allow water walking over accessible tiles 2015-11-05 11:25:41 +03:00
ArseniyShestakov 62dc070c0a moveHero: add transit validation and avoid embarking on transit
Hero shouldn't embark into boat when attempt to transit over air layer.
2015-11-05 10:50:47 +03:00
ArseniyShestakov c188ff0a92 doMoveHero: dont stop movement on guarded tiles when transit used 2015-11-05 10:37:22 +03:00
ArseniyShestakov 3de94a8b99 CPathfinder: don't allow future movement after guarded tile
There is two exceptions:
 - Hero start movement from guarded tile.
 - Hero that embarking into boat that standing on guarded tile.
In other cases future movement is impossible.
2015-11-05 10:22:38 +03:00
ArseniyShestakov ac12a0735e Plumbing on client and server to make flying actually work 2015-11-05 10:02:13 +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 934c682733 CPathfinder: always add air and water layer nodes to queue
It's should be possible to go into air layer from visitable object (but opposite isn't allowed).
And when walking on water player can't really interact with any object at all so future movement always possible.
2015-11-04 11:53:52 +03:00
ArseniyShestakov 595deda270 CPathfinder: rename functions to better represent what they doing 2015-11-04 11:47:43 +03:00
ArseniyShestakov 8b6b4e2e0b Fix header case for Linux to Windows cross compilation using MingGW 2015-11-03 14:40:36 +03:00
ArseniyShestakov dfd70849e9 CPathfinder: restore selective tile initialization to initializeGraph
This way we can avoid layer checks when calculating paths by ignoring unitialized tiles entirely.
Also at this point pathfinder and movement actually works for everything except flying.
2015-11-03 03:25:12 +03:00
ArseniyShestakov c85c7f4b61 CPathfinder: always initialize all nodes within initializeGraph 2015-11-03 01:29: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
ArseniyShestakov 4b64bec711 EPathfindingLayer: copy other code from ETerrainType for debugging 2015-11-02 13:25:01 +03:00
ArseniyShestakov 2b6e1498d2 Pathfinding: change argument order for getPath and AUTO layer as default
This still need investigation, but likely most of external code shouldn't be aware of layers in order to work properly because only LAND and SAIL can be targeted and single tile can't have both of these layers.
2015-11-02 11:14:32 +03:00
ArseniyShestakov b8253206c7 Pathfinding: make related code aware that layers exist 2015-11-02 11:06:06 +03:00
ArseniyShestakov 118039a368 Pathfinding: add copy-pasted EPathfindingLayer 2015-11-02 11:05:26 +03:00
ArseniyShestakov a0a55974ea Fix issue 2320. Town events for buildings should now work 2015-10-28 08:46:43 +03:00
ArseniyShestakov c4ea0c7ff2 CPathfinder: don't include RegisterTypes 2015-10-27 17:42:31 +03:00
ArseniyShestakov 92fee1bdbf CPathfinder: shorten options struct declaration 2015-10-27 03:50:38 +03:00
ArseniyShestakov 6b34eb729e Move all pathfinding-related code into new file 2015-10-27 03:34:47 +03:00
ArseniyShestakov 9e8427a078 CPathfinder: update comment for isSourceGuarded condition 2015-10-27 00:22:40 +03:00
ArseniyShestakov 01257efc02 CPathfinder: get rid of curPos and pass on initializeGraph 2015-10-26 20:17:10 +03:00
ArseniyShestakov 68bd37aa45 Store penalty in value of FLYING_MOVEMENT and WATER_WALKING 2015-10-26 18:30:11 +03:00
ArseniyShestakov 44ca00cd16 CPathfinder: rename functions 2015-10-25 19:11:00 +03:00
ArseniyShestakov a536691781 CPathfinder: fix typos and more code cleanups 2015-10-25 17:01:28 +03:00
ArseniyShestakov 4f7c3ec60f Minor formatting fixes within pathfinder-related code 2015-10-24 15:50:00 +03:00
ArseniyShestakov 939b3c05a1 CPathfinder: use struct instead of enum for options
Suggested by @DjWarmonger as better alternative from performance standpoint while struct still more organized than bunch of variables.
Other reason of change it's that in future we may need non-boolean options, e.g for patrol movement and some new pathfinder usages.
2015-10-24 15:34:27 +03:00
ArseniyShestakov 6934c6bc95 CPathfinder: move check into isBetterWay lambda
It's must be of course used for teleporters too.
2015-10-24 14:54:15 +03:00
ArseniyShestakov 5a04f05b9b CPathfinder: move one more check into isMovementPossible 2015-10-24 12:09:57 +03:00
ArseniyShestakov 6ebe2abc1a Fix penalties for FLYING_MOVEMENT and WATER_WALKING 2015-10-23 20:50:52 +03:00
ArseniyShestakov fc6f62e633 getMovementCost: get rid of useless flying parameter 2015-10-19 07:27:00 +03:00
ArseniyShestakov 498eb1d032 Fix typos 2015-10-19 05:16:18 +03:00
ArseniyShestakov 3663b952ea Fix issue 2276. Refugee Camp shouldn't be guarded 2015-10-16 06:45:06 +03:00
ArseniyShestakov 226650582d Move base movement cost to GameConstants 2015-10-16 03:03:40 +03:00
ArseniyShestakov 3466e0fae7 getTileCost: one more pass over code and formatting fix 2015-10-15 15:17:21 +03:00
ArseniyShestakov 46c7e8e36d Add list ending comment as suggested by @alexvins
This way we can add new bonuses without changing last line in list and avoid possible issues of extra concatenating.
2015-10-15 12:20:53 +03:00
ArseniyShestakov 25da9f249e Move NO_TERRAIN_PENALTY to the end of list to avoid save breakage 2015-10-15 11:44:59 +03:00
ArseniyShestakov c3c31e90ff Castle gate: only allow teleport to own Inferno towns
This is how that works in H3. And on server side it's checked already anyway.
Though it's must be possible to teleport from ally Inferno to your own if both have Castle Gate.
2015-10-15 05:28:28 +03:00
ArseniyShestakov 0d83f6fedd Fix issue 1877. Allow to buy heroes in ally towns
Also removed TODO because check already implemented in CGameHandler::hireHero
2015-10-15 04:00:21 +03:00
ArseniyShestakov 596e0d7b40 Fix issue 1230. Implement Nomads sandwalker bonus 2015-10-15 01:11:15 +03:00
ArseniyShestakov 52a52dcfd9 Implement NO_TERRAIN_PENALTY bonus
Penalty of specified terrain type is ignored if hero have this bonus
2015-10-15 01:09:02 +03:00
ArseniyShestakov 9954dfb33a CPathfinder: move flying into options and add walk on sea 2015-10-12 19:03:08 +03:00
ArseniyShestakov 41c4323818 CGHeroInstance: add canFly and update canWalkOnSea
canWalkOnSea shouldn't check for FLYING_MOVEMENT because it's two separate mechanics that apply different limitations.
2015-10-12 18:52:23 +03:00
ArseniyShestakov 0faedde6b9 CPathfinder: store pathfinding options in set instead of variables
There is plenty of variables now and in future I'm going to add more more once pathfinder become usable for all kind of things.
2015-10-12 10:29:39 +03:00
ArseniyShestakov 886042dc11 CPathfinder: clean calculatePaths of code unsused for pathfinding
Map graph initialization should be there as well because it's needed for path checking.
This change wouldn't affect anything since currently CPathfinder object created from scratch every time.
2015-10-12 08:31:35 +03:00
ArseniyShestakov 213d8c2258 CPathfinder: turn checkDestinationTile into function
This code was only kept as lamba to access guard related variables that is now gone.
2015-10-12 08:22:31 +03:00
ArseniyShestakov 1beacf2260 CPathfinder: move guard checks into functions 2015-10-12 08:13:10 +03:00
ArseniyShestakov cd7c5acbc4 CPathfinder: move embark special case code down
It's not affect cost calculations any way so let it's be in same order as it's used in condition under it.
2015-10-12 07:26:13 +03:00
ArseniyShestakov c6f9cd1e52 CPathfinder: move passability checks into renamed goodForLandSeaTransition
There no need in dedicated function for embark / disembark and other conditions belong there perfectly.
This function is going to check what movements are plain impossible so we don't have to bother check their cost.
2015-10-12 07:10:33 +03:00
ArseniyShestakov ee4305cd6d CPathfinder: move destTopVisObjID where it's belongs to 2015-10-10 19:02:21 +03:00
ArseniyShestakov 13c2b5e2d8 CPathfinder: separate teleporter exits and neighbour tile code
This way code that handle real neighbour tiles is more readable and teleport exits don't have to go via all checks they ignore anyway.
2015-10-10 17:17:41 +03:00
ArseniyShestakov f15065fdc5 CPathfinder: separate neighbours code into getNeighbours
This is first step to make this code usable outside of calculatePaths.
2015-10-10 16:09:40 +03:00
ArseniyShestakov 76cd002f07 Remove unused variable found by valgrind 2015-09-23 11:09:15 +03:00
ArseniyShestakov ffb8e6a696 Garrison: fix more issues introduced in pull #115
After 8cad23956c there was several issues remaining:
* Last creature would remain even for town garrisons.
* Impossibility to move last stack even within same garrison.
* Impossibility of partially merge of last stack into other hero stack.
All fixed. However last stack merge to other hero will now make split window appear instead of auto merge.
2015-09-23 08:12:43 +03:00
ArseniyShestakov 0914bb3edf RPM: build with RelWithDebInfo instead of Release 2015-04-04 05:01:33 +03:00
ArseniyShestakov c3ea9637dd Debian: change rules to use SDL2 and update changelog for 0.98 2015-04-03 04:54:12 +03:00
ArseniyShestakov 8ecf0b7bfc Merge pull request #95 from Mixaill/version-bump
Version bump for Linux and RPM update
2015-04-03 04:46:09 +03:00
ArseniyShestakov 323c4e1637 RMG Options: make "Computer only teams" buttons work as expected
Button "0" should be always enabled and if "Computer only players" set to "0" we should also computer only team count to "0" if it's not random.
2015-03-16 16:02:52 +03:00
ArseniyShestakov 448fbe44e9 Improve CButton::block and fix CToggleGroup->selectedID
CToggleGroup. Originally when I added initialization for selectedID I didn't find out that -1 is used for "random" buttons. So as result I fixed uninitialized variable usage, but break initial button state change in RMG options because setSelected ignore state change request because it's see -1 button already marked as selected.
2015-03-16 15:55:36 +03:00
ArseniyShestakov 120301ecc8 Split army: dont highlight down garrison slots if there no visiting hero
Before UI always highlighted all slots in both town garrisons even if there no visiting here and you can't actually set army on these slots.
Now garrison slots only highlighted if they're owned by us or our ally. If there no visiting hero in town then only suitable upper garrison slots will be highlighted.
2015-03-16 02:04:18 +03:00
ArseniyShestakov 078bf6c69c CSelectionScreen: always use isHost and isGuest when suitable 2015-03-15 19:33:58 +03:00
ArseniyShestakov c4000f2ac7 Multiplayer: always display flags in lobby, but block them for guest 2015-03-15 19:24:03 +03:00
ArseniyShestakov 783dcfea2e CMapGenOptions: fix crash when computer only limit is used
Currently when there is computer only players set resetPlayersMap may try to change settings for more than 8 players which obviously cause crash.
Now if any of "players and computer limit" or "computer limit" is set to random we automatically set total limit to 8 players.
2015-03-14 22:19:24 +03:00
ArseniyShestakov eeff8f3ea4 Multiplayer: add sync for RMG options in lobby
Sadly I'm not yet find proper way to block all buttons in CToggleGroup without make them invisible so it's still possible to press buttons for guest. Though CRandomMapTab::updateMapInfo is now disabled for guest so even if guest going to press multiple buttons it's not going to cause crash for him.
2015-03-13 23:33:46 +03:00
ArseniyShestakov 67aa869a33 Multiplayer: make chat history visible in lobby and improve CTextBox
Now we'll also play sound when new message added.
CTextBox::setText now will automatically change text height for slider.
2015-03-13 18:45:07 +03:00
ArseniyShestakov 1f1f61cf15 Custom campaigns list: redraw parent as we use it's background
This one fix issue 2057
2015-03-13 18:06:19 +03:00