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
7eebcb9d60
Artifacts: replace few more ints by ArtifactID
2015-11-07 11:46:58 +03:00
DjWarmonger
17071c6ec8
Merge pull request #125 from ArseniyShestakov/newMovementSystem
...
Okay, time to merge this.
2015-10-31 13:56:22 +01: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
Vadim Markovtsev
e4b1ef1405
Add "override" to virtual overriden methods
2015-10-13 21:05:36 +03:00
ArseniyShestakov
9954dfb33a
CPathfinder: move flying into options and add walk on sea
2015-10-12 19:03:08 +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
AlexVinS
2cb6cb7baa
Remove useless durationType selector
...
* duration is a mask, equality comparison is not enough
2015-06-02 07:12:02 +03:00
ArseniyShestakov
32009690eb
initTowns: only add Tovern by default to player-owned towns
...
Neutral towns with default buildings set should never get Tovern automatically.
This one fixes issue 2090.
2015-03-12 18:47:32 +03:00
ArseniyShestakov
f2a237ce6c
CPathfinder: move allowed teleport check into lambda
...
This also fix accidental whirlpool usage as previously I messed up code a bit.
2015-03-11 23:53:35 +03:00
ArseniyShestakov
17f3f94ca6
CGSubterraneanGate: fix pairing and always assign all gates to channel
...
Before gates on underground layer didn't had any channel assigned and of course any function that attempt to check -1 channel caused crash.
Also I find out that at point postInit executed It's possible to get mutable gamestate via gameState() callback so we don't need to pass it there.
2015-03-11 17:17:21 +03:00
DjWarmonger
ec879046ca
Merge pull request #93 from ArseniyShestakov/feature/pathfindingTeleports
...
Okay let's do this!
2015-03-10 09:04:25 +01:00
ArseniyShestakov
5c6633f8ad
CPathfinder::addTeleportWhirlpool: check that obj isn't nullptr
2015-03-09 15:32:09 +03:00
ArseniyShestakov
00b0af7306
CGameInfoCallback: now actually drop excludeId argument
2015-03-09 14:20:34 +03:00
ArseniyShestakov
930a8b49da
CPathfinder: move complicated check into lambda
2015-03-09 04:24:12 +03:00
ArseniyShestakov
8f8d237d5d
Use isTeleportChannel callback functions to check teleport channel type
2015-03-09 02:13:40 +03:00
ArseniyShestakov
530b63f7c4
CPathfinder: add all new code for pathfinding via teleporters
...
Each kind of teleporter have own function that determine if it's should or shouldn't be used.
For now Monolith with bidirectional channels and Subterranean Gate are united.
2015-03-08 17:13:26 +03:00
ArseniyShestakov
c9eba40fe6
Updated CGTeleport and new CGMonolith / CGSubterraneanGate / CGWhirlpool
...
Now CGTeleport is not publicly available handler, but generic class for teleport channels usage.
Teleport channels are stored as part of information about the map.
2015-03-08 16:11:23 +03:00
AlexVinS
685deddac1
Start spell-relatet files reorganisation
...
* moved existing files to separate directory
-> todo: split mechanics
2015-02-26 08:39:48 +03:00
DjWarmonger
5b8180e327
Cleaning logs.
2014-12-25 12:58:15 +01:00
DjWarmonger
7735e193f0
Merge branch 'develop' into experimental/serializerrefactoring
2014-12-22 19:17:40 +01:00
AlexVinS
3bca68fd2d
Initial refactoring
...
* reduce registerTypes* templtates instantiation
2014-12-21 17:29:42 +03:00
DjWarmonger
c538370c5d
Players will be always able to see their owned heroes and other objects. Fixes #1959 .
2014-12-21 13:56:32 +01:00
AlexVinS
34ffdb5981
small cleanup
2014-11-06 14:28:34 +03:00
DjWarmonger
d280b0ac9f
Cleaned some logs.
2014-11-01 09:52:56 +01:00
Ivan Savenko
fc16c8d207
Merge branch 'optimization/swiftAI' into develop
...
Conflicts:
lib/CGameState.cpp
2014-09-21 22:31:29 +03:00
DjWarmonger
5cb6eaa252
Fixed major RMG bug.
2014-09-21 20:57:42 +02:00
Ivan Savenko
c4fc8f08c0
Moved assertions before variable is used
2014-09-21 18:25:52 +03:00
Ivan Savenko
6c0c03d74b
Refactoing of pathfinder <-> client/AI interaction to remove dependency on selected hero
...
- finished removal of server-side setSelection
- disabled some broken code (AI & cheats). TODO: fix
2014-09-21 16:42:08 +03:00