1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-12 10:03:53 +02:00
Commit Graph

3048 Commits

Author SHA1 Message Date
AlexVinS
bffdc2813d revert some project changes 2016-01-27 15:21:29 +03:00
DjWarmonger
94ecc3f520 Compilation fix. MVS 2013 doesn't support constexpr and it's not needed either. 2016-01-27 10:13:33 +01:00
DjWarmonger
fc62cabb68 Merge pull request #174 from vmarkovtsev/issue/981
Fix CGHeroInstance::isInitialized implementation
2016-01-27 09:43:53 +01:00
Vadim Markovtsev
f6679bba50 Fix CGHeroInstance::isInitialized implementation 2016-01-27 09:44:23 +03:00
Zyx-2000
92dd194c97 logger now supports unicode file paths 2016-01-26 22:42:15 +01:00
DjWarmonger
f626c0f9ed Merge pull request #173 from vmarkovtsev/issue/981
Fix 981 reset hero on hiring after retreat/surrender
2016-01-26 21:24:22 +01:00
Vadim Markovtsev
7772b6de74 Fix 981 reset hero on hiring after retreat/surrender 2016-01-26 22:48:31 +03:00
Zyx-2000
70e3c81b9f Replaced CFileInfo with more correct and efficient alternative 2016-01-26 14:51:38 +01:00
Vadim Markovtsev
40cb48d65e Replace std::remove_if with vstd::erase_if 2016-01-26 10:19:58 +03:00
ArseniyShestakov
6a7b1a1737 Merge pull request #161 from vmarkovtsev/issue/2076
Fix 2076 Grail removal
2016-01-26 09:01:43 +03:00
Arseniy Shestakov
97a8874ed7 CGCreature: fix crash on draw
Also according to H3 behaviour if there artifact monster guarded it's will be lost on draw.
2016-01-26 08:41:09 +03:00
Vadim Markovtsev
22eb71de03 Remove this-> occurrences in new code 2016-01-25 14:14:32 +03:00
Vadim Markovtsev
a74fbff34f Fix 2076 Grail removal 2016-01-25 12:38:11 +03:00
Vadim Markovtsev
afa95312ba Fix 2139 captured spell scroll descriptions 2016-01-25 08:49:26 +03:00
AlexVinS
0ec07b38ac fix build 2016-01-24 16:58:24 +03:00
AlexVinS
89d986fc6a Merge remote-tracking branch 'remotes/origin/develop' into feature/VCMIMapFormat1
Conflicts:
	lib/CArtHandler.h
	lib/mapObjects/MiscObjects.cpp
2016-01-24 15:39:41 +03:00
AlexVinS
408f346541 Drafts for hero serialization 2016-01-24 15:35:08 +03:00
AlexVinS
3eb9de0c0b Grail options serialization 2016-01-24 02:26:32 +03:00
ArseniyShestakov
b19e082f37 Merge pull request #166 from vmarkovtsev/issue/1723
Fix 1723 quest crash on combined arts
2016-01-23 23:23:07 +03:00
AlexVinS
f9d0b20234 CGMine, CGArtifact, CGGarrison serialization 2016-01-23 19:53:02 +03:00
AlexVinS
b0c4ea5947 Fix. 2016-01-23 17:43:20 +03:00
Vadim Markovtsev
a266154b26 Fix 2014 cursor must disappear during movement and Magi's Eye 2016-01-23 00:35:41 +03:00
Vadim Markovtsev
11bce2908d Fix 1723 quest crash on combined arts 2016-01-22 12:56:25 +03:00
Vadim Markovtsev
e8db456beb Reset obelisks upon game end
Otherwise, the static variables are preserved and lead to wrong values in next new game.
2016-01-20 13:02:52 +03:00
Vadim Markovtsev
1a2cd36df8 Initialize obelisks count to 0
Otherwise every time player starts with a random number.
2016-01-20 12:43:07 +03:00
Vadim Markovtsev
bb3a31f3ff Mark obelisk visited for all players in the team 2016-01-20 11:14:03 +03:00
Vadim Markovtsev
10f888a483 Fix obelisks puzzle revealing
Teams and players were messed up in lib; hardcoded constants were refactored.
2016-01-20 10:44:13 +03:00
Zyx-2000
c385c8757b TAB instead of spaces 2016-01-19 20:53:29 +01:00
Zyx-2000
2a55d5f85e added copyright info 2016-01-19 14:26:18 +01:00
Zyx-2000
64365fa294 additional polishing 2016-01-19 11:56:03 +01:00
Zyx-2000
170e4283ae Small improvements to FileStream 2016-01-18 21:30:06 +01:00
Vadim Markovtsev
92e011429f Fix crash on unknown map objects
If getHandlerFor() fails to find the handler, it returns a nullptr
shared pointer, which is later dereferenced unconditionally.

How to reproduce:
Download map "Happy time Dragons!!!" from http://heroesportal.net/maps.php?type=H3AB-XL&sort=r

=>

Failed to find object of type 5:144
SIGSEGV
2016-01-18 21:16:55 +03:00
Zyx-2000
a50a702073 switched to -std=gnu++11 2016-01-18 17:49:07 +01:00
Arseniy Shestakov
575a68d78b CRewardableObject: fix onVisited message duplication for Idol of Fortune 2016-01-17 15:16:35 +03:00
Zyx-2000
cf61837ced replaced std::string with boost::filesystem::path in several places 2016-01-16 16:36:16 +01:00
Arseniy Shestakov
18b2f866c9 CGPickable: add missing break for flotsam. Fix issue 1956 2016-01-16 09:45:30 +03:00
Arseniy Shestakov
725cce368f CGameState::initStartingBonus: fix amounts for wood and ore bonus
In original game when wood and ore bonus is choosen you always get same amount of both resources.
2016-01-15 20:36:16 +03:00
AlexVinS
a638d0cd51 Creature set serialization 2016-01-15 20:24:17 +03:00
Arseniy Shestakov
b84d7bd288 CGCreature: add reward granting. Fix issue 2372 2016-01-15 04:29:46 +03:00
DjWarmonger
ac730a591c Fixed large treasure piles sometimes being uncovered. 2016-01-13 20:03:25 +01:00
DjWarmonger
8c5f93dd8f Little refactoring for object placement. 2016-01-13 19:17:12 +01:00
Zyx-2000
933b7c1f5e some modernization of CFileInputStream implementation code 2016-01-12 23:40:24 +01:00
Zyx-2000
f9b255c896 Cleaner code & MSVC compatibility 2016-01-12 22:40:05 +01:00
Zyx-2000
1f4bc0f2e4 Merge branch 'develop' of https://github.com/vcmi/vcmi into develop 2016-01-11 22:38:47 +01:00
Zyx-2000
99cf8069d7 FileStream files 2016-01-09 21:24:20 +01:00
Zyx-2000
203b2dccc3 hopefully fixed things 2016-01-09 21:23:55 +01:00
DjWarmonger
676f078b2e RMG will now multiply Monolith defs to ensure there are at least 100 pairs avaiable for connections. 2016-01-09 09:03:40 +01:00
DjWarmonger
dd1fc47c93 Workaround for Seer Hut offset. They seem to work fine now. 2016-01-08 21:51:55 +01:00
DjWarmonger
d840fb40eb Fixed crashes with RMG Seer Huts. Now they are functional. 2016-01-08 21:14:57 +01:00
Arseniy Shestakov
383f754ed1 Starting gold bonuses must be always multiples of 100 2016-01-07 20:51:37 +03:00
Arseniy Shestakov
c93f8fea48 moatHexes: implement reading moat hexes from configuration files
This also fix Fortess moat that previously used wrong hexes
2016-01-06 12:53:40 +03:00
DjWarmonger
cdd50b1603 Version bump. 2016-01-01 20:06:38 +01:00
AlexVinS
37d0dad70a Merge branch 'develop' into feature/VCMIMapFormat1
Conflicts:
	lib/CArtHandler.cpp
2016-01-01 20:28:52 +03:00
Arseniy Shestakov
9fd1cff090 Refactoring: always use std prefix for shared_ptr, unique_ptr and make_shared
Long time ago it's was used without prefix to make future switch from boost to std version easier.
I discusses this with Ivan and decide to drop these using from Global.h now.

This change wouldn't break anything because there was already code with prefix for each of three cases.
2015-12-29 05:43:33 +03:00
Arseniy Shestakov
29a7934a99 Refactoring: avoid using namespace when it's not absolutely needed 2015-12-29 02:14:08 +03:00
Arseniy Shestakov
66e6f15e67 NewTurn::applyGs: update bonuses in beginning. Fix issue 2083
Before bonuses was removed after hero get movement points and mana so affected hero one day more than intended.
2015-12-25 01:48:53 +03:00
Arseniy Shestakov
6f5c52a229 Refactoring: use cleaner CCreatureSet::stacksCount everywhere 2015-12-24 21:30:57 +03:00
Arseniy Shestakov
62bab27e7e CGArtifact: show yes/no dialog for guarded artifacts. Fix issue 2095
Also fix hover text for CGMine
2015-12-24 21:05:02 +03:00
Arseniy Shestakov
75ca020890 CCeatureSet: add getArmyDescription for hover and InfoWindow texts 2015-12-24 21:03:51 +03:00
DjWarmonger
be50d699fb Compile fixes for MSVS 2015-12-23 15:23:56 +01:00
ArseniyShestakov
48be566050 Dimension Door: fix movement points cost for expert level 2015-12-21 18:46:52 +03:00
Ivan Savenko
a051a08a46 Merge remote-tracking branch 'origin/issue/2306' into develop 2015-12-18 22:21:11 +02:00
ArseniyShestakov
b6176649ec CGMonolith: avoid crash when all exits are blocked by friendly heroes 2015-12-18 01:08:19 +03:00
ArseniyShestakov
9490a5d66d CPathfinder: deny transit to land blockvis objs from water layer
When hero is in water walking layer he can only exit to accessible or visitable land tiles, but not objects that have blocking visit and leave hero standing on water.
This is different than default flying behaviour because hero in air layer can only transit into accessible land layer without any blocking or visitable objects on them.
2015-12-16 20:14:36 +03:00
ArseniyShestakov
bf9ac7318a CPathfinder: change cost calculation sequence for embark / disembark
With old embark cost calculation pathfinder may end up thinking that hero can embark/disembark while have less movement points than base movement cost is. Now hero would be only able to embark / disembark if we have enough movement points to step on that tile. This rule is also valid for situation when hero have Admiral's Hat as in H3 even if hero don't have embark penalty he still use move points for embark and disembark.

Problem was found as it's was causing infitite loop in AI. Server of course rejected attempt to embark with less than 100 movement points while pathfinder tell AI that it's can still embark with 93 movement points.
2015-12-15 20:08:52 +03:00
ArseniyShestakov
2724a67a27 CPathfinder: add border gate support and use passableFor 2015-12-14 14:33:50 +03:00
ArseniyShestakov
9f565b81e9 CBankInfo: fix huge memory leak that appear in long run 2015-12-14 11:29:24 +03:00
ArseniyShestakov
59199ccdbd Bonus system: add treeHasChanged call where bonus objects changed 2015-12-11 16:13:18 +03:00
ArseniyShestakov
1730a31471 HeroBonus: get rid of code that used getBonusList 2015-12-11 16:01:51 +03:00
ArseniyShestakov
8fb5dacba2 CBonusSystemNode: get rid of non-const getBonusList 2015-12-11 15:02:36 +03:00
ArseniyShestakov
ab92123da3 CPathfinder: improve support for visits and battles in teleports
Related movement code for client and AI is plumbed as well. Though at moment code still not finished because it's not teleport hero to the exit tile if he won battle.
2015-12-11 09:42:30 +03:00
ArseniyShestakov
a430769b44 CPathfinder: fix possible crash when using invisible teleport exit
This one is similar with FoW bug when hero was covered by FoW while one tile around wasn't.
2015-12-11 04:10:30 +03:00
ArseniyShestakov
c3e5231146 CPathfinder: avoid pathing through hero standing on Subterranean Gate
Subterranean Gates unlike Monolith allow to visit hero standing on other exit. So of course pathfinder allowed that, but it's also allowed future movement through that hero which caused infinite loop for AI.
2015-12-10 16:51:19 +03:00
ArseniyShestakov
2be6818e33 FoWChange::applyGs: correct copy-paste error. Fix issue 2345 2015-12-09 10:02:33 +03:00
ArseniyShestakov
1c0d4e3f6f Fix filenames in file headers 2015-12-08 09:53:14 +03:00
ArseniyShestakov
07807fb044 Client: slience visibility error on shipyard in non-coastal town 2015-12-08 07:33:13 +03:00
ArseniyShestakov
03e9dd3bab Add hero gold cost to GameConstants 2015-12-07 00:13:58 +03:00
ArseniyShestakov
e872b400b7 Comments save format backward compatability code as Ivan suggested
Also we should always handle RumorState::TYPE_NONE in getTavernRumor properly anyway.
2015-12-06 02:51:54 +03:00
ArseniyShestakov
05a34fb417 Use "Favorable" instead of "Favourable" everywhere for consistency
Original game of course used american english version so we stick to it.
2015-12-06 02:23:41 +03:00
AlexVinS
f33bcee84c post-merge fixes 2015-12-05 13:56:38 +03:00
AlexVinS
947edc0693 Merge branch 'develop' into feature/VCMIMapFormat1 2015-12-05 13:04:04 +03:00
AlexVinS
0fab319c73 Merge remote-tracking branch 'remotes/origin/develop' into issue/2306
s reverts commit fa8a282696.

Conflicts:
	AI/VCAI/VCAI.cpp

Conflicts:
	AI/VCAI/VCAI.cpp
	client/windows/CAdvmapInterface.cpp
	lib/CPathfinder.cpp
	lib/CPathfinder.h
2015-12-05 12:56:12 +03:00
AlexVinS
3bf9696b13 Tweaks 2015-12-05 12:38:37 +03:00
AlexVinS
3f79d001c1 Fix subObject identification 2015-12-05 12:38:36 +03:00
AlexVinS
b56b7017ba Added stubs for some Map objects serialization 2015-12-05 12:38:35 +03:00
AlexVinS
6977fc3a14 Move test filesystem creation to global fixture 2015-12-05 12:37:37 +03:00
AlexVinS
e7359c9a36 Serialize tempOwner 2015-12-05 12:37:35 +03:00
AlexVinS
8a979d016f ObjectTemplate serialization
(+) generated map displayed correctly in editor
2015-12-05 12:36:44 +03:00
AlexVinS
2d777ea676 Small (temp) fix. Prevent nulls from serialization. 2015-12-05 12:36:43 +03:00
AlexVinS
2d5a366e6c Implemented (basic) object construction and placement
* contain refactoring of RMG and class handling (will be more)
2015-12-05 12:36:42 +03:00
AlexVinS
9cc3dae5fe Started working on objects serialization 2015-12-05 12:36:42 +03:00
AlexVinS
a5b72ce593 Cleanup 2015-12-05 12:36:41 +03:00
AlexVinS
8493d0cded Initial implementation of new team settings format 2015-12-05 12:36:40 +03:00
AlexVinS
6f203fb7e2 Save string identifiers for all game objects 2015-12-05 12:36:39 +03:00
AlexVinS
93c214d7a0 fix CMakeLists 2015-12-05 12:36:38 +03:00
AlexVinS
60825fbbd3 Start implementing PlayerInfo serialisation 2015-12-05 12:36:37 +03:00
AlexVinS
2f67e015e1 Fix build 2015-12-05 12:36:36 +03:00
AlexVinS
7c8d29b871 Start implementing player info serialization 2015-12-05 12:36:36 +03:00
AlexVinS
f5b348a1d1 Formatting 2015-12-05 12:36:35 +03:00
AlexVinS
3af255d1b9 Implemented terrain serialisation
* with test
2015-12-05 12:36:34 +03:00
AlexVinS
6552acdff6 Check coastal tile OTF 2015-12-05 12:36:29 +03:00
AlexVinS
8bc242d002 Cleanup 2015-12-05 12:06:52 +03:00
AlexVinS
27bf2524a3 Advance triggered events serialization
(-) missing indentifier serialization (unimplemented in engine)
(-) missing tests
2015-12-05 12:06:51 +03:00
AlexVinS
11af00bcdf Start working on Triggered Events 2015-12-05 12:06:50 +03:00
AlexVinS
b683c29b6e Added modification time to zip.
* it is required to consider archive valid (by some tools)
2015-12-05 12:06:49 +03:00
AlexVinS
f6e2cd16ed Fix header.mapLevels saving 2015-12-05 12:06:48 +03:00
AlexVinS
0cc7213a27 WiP on zip serialization
(-) still not works correctly
2015-12-05 12:06:47 +03:00
AlexVinS
fc2cbc841a Another fix for JsonWriter::writeString
* RMG description check passed
2015-12-05 12:06:46 +03:00
AlexVinS
ff18944088 Fix writing escaped string json fields 2015-12-05 12:06:45 +03:00
AlexVinS
f2164abf1b Wip on zip serialize fixes 2015-12-05 12:06:45 +03:00
AlexVinS
27a29bd035 Start implementing actulal json serialization 2015-12-05 12:06:44 +03:00
AlexVinS
1a8faeb0b9 Start implementing map saver 2015-12-05 12:06:42 +03:00
AlexVinS
0040b459c3 Add support of CIOApi to CZipStream and CZipLoader (unused, untested) 2015-12-05 12:06:41 +03:00
AlexVinS
b3ac146ba9 Define bridge interface to minizip IOAPI 2015-12-05 12:06:40 +03:00
AlexVinS
3d265f94dc Update projects 2015-12-05 12:06:39 +03:00
AlexVinS
0cc47f00c5 Advance map format simple test 2015-12-05 12:06:35 +03:00
AlexVinS
7d16585f89 Use COutputStream in CMapSaverJson 2015-12-05 12:06:34 +03:00
AlexVinS
c965f9d02d Added draft of IO memeory buffer 2015-12-05 12:06:33 +03:00
AlexVinS
221ec55f51 Define basic design of output streams 2015-12-05 12:06:32 +03:00
AlexVinS
adc271d7b3 Draft on classes hierarchy.
* patcher and loader uses diferent input (JsonNode and binary stream of zipped map archive), dicided to split them
2015-12-05 12:06:32 +03:00
ArseniyShestakov
360ebcce7e Merge pull request #145 from vcmi/feature/tavernRumors
Tavern rumors and Thieves Guild fixes
2015-12-05 03:13:25 +03:00
ArseniyShestakov
0a5e9c0fbe Merge pull request #144 from vcmi/fix/teleportMultiExitPoints
Support for exit selection between multiple teleport exit points
2015-12-05 03:12:17 +03:00
ArseniyShestakov
9e7e5b81e4 Merge pull request #143 from vcmi/feature/patrolSupport
Patrol support for AI heroes
2015-12-05 03:11:07 +03:00
Ivan Savenko
89bf3592e3 Likely fixed duplicated random heroes 2015-12-05 01:40:23 +02:00
Ivan Savenko
8a3feb1e48 Added assert to hopefully catch invalid GiveBonus package at some point 2015-12-05 01:39:14 +02:00
ArseniyShestakov
82ce58eceb CPathfinder::initializePatrol: don't pass valid PlayerColor
It's break getTilesInRange with mode 0 and we don't really need to check visibility anyway.
2015-12-05 01:45:10 +03:00
ArseniyShestakov
01c5bc25e5 Move TTeleportExitsList to CObjectHandler.h
Not a perfect solution, but this is the best location for now.
2015-12-05 01:14:03 +03:00
ArseniyShestakov
c83f15e413 Merge branch 'develop' into feature/tavernRumors
Conflicts:
	lib/CGameState.h
2015-12-05 01:01:26 +03:00
ArseniyShestakov
d856fde73f Rumors: use enum instead of magic numbers and avoid potential crash 2015-12-04 22:58:14 +03:00
ArseniyShestakov
bdc369ffba Patrol: use manhattan distance for getting tiles in radius 2015-12-04 21:08:09 +03:00
ArseniyShestakov
2a63ba148a Thieves Guild: fix tavern map object, lvl 0 when no taverns owned
We also now check not number of towns, but only towns that has tavern built. Also according to original mechanics all taverns always display information based on your number of taverns and not number of taverns of object owner.
2015-12-04 18:38:57 +03:00
ArseniyShestakov
3b3c49420f Thieves Guild: correct number of taverns to access information 2015-12-04 17:52:30 +03:00
ArseniyShestakov
eced16945e getVisibleTeleportObjects: use getObj as not verbose
We checking visibility in this function so there no need to send information about that into errorStream.
2015-12-04 05:43:55 +03:00
Ivan Savenko
faa7cbff18 Fixed gcc/clang warnings 2015-12-04 01:17:43 +02:00
Ivan Savenko
f02e553b70 Fixed another uninitialized field possiblity causing issues with StupidAI 2015-12-04 00:11:44 +02:00
Ivan Savenko
90dfe3e782 reduced visibility for members of Mine and Dwellings 2015-12-02 22:34:13 +02:00
Ivan Savenko
7189a12df2 removed few more includes from headers 2015-12-02 22:10:46 +02:00
Ivan Savenko
7b5a7f43ad Removed includes of CGameState from headers 2015-12-02 21:39:53 +02:00
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
Ivan Savenko
bef7048460 minimized visibility of members of teleportation-related classes 2015-12-02 21:01:43 +02:00
Ivan Savenko
f9d9a38e53 Fixed gcc warnings 2015-12-02 20:59:38 +02:00
ArseniyShestakov
b5100bee94 Teleport: rework code to support exit point selection for whirlpools 2015-12-02 17:56:26 +03:00
ArseniyShestakov
a62ee65d72 Rumors: implement income checking via statsHLP::getIncome
This also fix income ranking in Thieves' Guild
2015-12-01 06:28:08 +03:00
ArseniyShestakov
ffcc5ccdd2 Rumors: implement support for grail terrain rumor 2015-12-01 04:57:52 +03:00
ArseniyShestakov
15273ac0f7 Rumors: avoid repeating of same rumor twice in a row
Multiple rumors of same type can go in a row, but not identical rumors.
2015-12-01 02:14:11 +03:00
ArseniyShestakov
98582d628c Rumors: move code into CGameState and add backward compatability 2015-12-01 00:44:58 +03:00
ArseniyShestakov
879eaa47f8 Rumors: client-side proof of concept implementation
Actually information about this week rumor should be stored in gamestate and updated weekly
2015-11-30 20:52:15 +03:00
ArseniyShestakov
6704ea0cff Rumors: rename getTavernGossip to getTavernRumor for consistency
Original game used "Rumors" and not "Gossips" and we already using rumor in CMap.
2015-11-30 17:51:28 +03:00
ArseniyShestakov
f55bfe41d6 Digging: implement digging status on right click. Fix issue 401
This is also fix possibility to dig on some non-blockable objects like event.
2015-11-29 12:34:23 +03:00
ArseniyShestakov
ce5b7c73be CGEvent: avoid permanent event removal after visit. Fix issue 2339 2015-11-28 23:03:26 +03:00
ArseniyShestakov
6bb205b15b CPathfinder: patrol support using getTilesInRange
For now we use getTilesInRange which isn't really correct for patrol, but good enough for first version.
2015-11-28 20:34:50 +03:00
ArseniyShestakov
56c6785bd0 Add backward compatability for patrol and bump save format version 2015-11-28 17:58:59 +03:00
ArseniyShestakov
f6de3f94ca Teleports: use TTeleportExitsList typedef for exits list
There is several ideas that teleportation code have to be shared between object/spells and this way we can avoid changing showTeleportDialog declaration every time.
2015-11-28 02:41:30 +03:00
ArseniyShestakov
d6a142ca3d CMapLoaderH3M: support for patrol initialPos in readHero 2015-11-27 11:34:03 +03:00
ArseniyShestakov
5d2e47faba CGHeroInstance::Patrol: add initialPos 2015-11-27 11:04:01 +03:00
ArseniyShestakov
c45cd1f4c2 CGHeroInstance::getOutOffsets: temporary fix for boat summoning
Appropriate fix would require to get rid of convertPosition everywhere. Check issue 515 for more details.
2015-11-26 10:55:02 +03:00
ArseniyShestakov
64c6d3c950 CGCreature::takenAction: add neverFlee check. Fix issue 2242 2015-11-25 09:34:49 +03:00
ArseniyShestakov
3d8f67f864 getFreeTiles: filter ROCK tiles. Fix issue 1870 2015-11-25 09:12:09 +03:00
ArseniyShestakov
2276af70dc PreGame: avoid crashing on random map options
Options is still broken, but at least we shouldn't crash there.
2015-11-25 07:25:44 +03:00
DjWarmonger
45d183289d Merge pull request #142 from edeksumo/Fix-Defence-Ani
Fix crash
2015-11-24 21:37:32 +01:00
edeksumo
aab5a05036 Fix crash during auto battle 2015-11-24 20:55:11 +01:00
ArseniyShestakov
a851062891 Merge pull request #133 from vcmi/feature/pathfinderLayers
Pathfinder layers and related changes: fly and water walking implemented
2015-11-24 13:09:06 +03: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
f4c06660e4 CPathfinder::evaluateAccessibility: apply more optimizations 2015-11-22 21:31:47 +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
e1a360408d GameConstants: move operators into header and always inline them 2015-11-22 07:24:12 +03:00
ArseniyShestakov
5a87f58e09 CPathfinder: optimize checks order in calculatePaths 2015-11-22 06:23:54 +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
649ebfad2f TerrainTile::topVisitableObj: avoid costly vector copying 2015-11-22 05:34:37 +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
a375c86ea2 movementPointsAfterEmbark: get max move points from TurnInfo
Missed that when originally implemented TurnInfo.
Not pretties code, but boost performance a lot.
2015-11-21 12:46:59 +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
e91d79414b PathfinderOptions: use settings and move all defaults into schema 2015-11-21 00:32:23 +03:00
ArseniyShestakov
b48d65ad57 addNewBonus: add turnsRemain check for N_TURNS, N_DAYS and ONE_WEEK 2015-11-20 14:37:57 +03:00
ArseniyShestakov
f99ffbd074 Bonus system: use duration helpers in selecters 2015-11-20 13:24:48 +03:00
ArseniyShestakov
cb61572878 TurnInfo: add cache for bonuses selection 2015-11-20 12:28:35 +03:00
ArseniyShestakov
6d395bcba7 Bonus system: add turnsRemain support for ONE_WEEK duration 2015-11-20 12:11:35 +03:00
ArseniyShestakov
d19cb5ce89 EPathfindingLayer: fix obvious layer over-allocation in CPathsInfo 2015-11-19 04:01:56 +03:00
ArseniyShestakov
adeefe903a CGPathNode: apply suggested optimizations
Also make EPathfindingLayers ui8 too
2015-11-19 03:08:57 +03:00
ArseniyShestakov
7101083a24 CPathfinder: restore transit via garrisons 2015-11-18 00:07:25 +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
c2ba3e3faf CPathfinderHelper: very firts pass over getNeighbours 2015-11-17 02:41:31 +03:00
ArseniyShestakov
73d8687785 CPathfinder: add some comments and TODO for future changes 2015-11-17 01:38:13 +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
324cf5490c CPathfinder: fix movement into guardian tile 2015-11-13 23:07:56 +03:00
ArseniyShestakov
0be9d21132 CPathfinder: add rule that hero in boat can't visit empty boats 2015-11-13 10:28:44 +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
4e11d81673 CGWhirlpool: fix random exit chooser 2015-11-12 01:23:27 +03:00
ArseniyShestakov
942c0cd718 CPathfinder: improve support for whirlpools 2015-11-12 01:16:06 +03:00
ArseniyShestakov
d76b2b7ca8 CPathsInfo: rework nodes multi_array allocation 2015-11-12 00:05:20 +03:00
ArseniyShestakov
09473f6648 CPathfinder: move embark special case to isMovementToDestPossible 2015-11-11 22:29: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
DjWarmonger
5fadb239f2 Merge pull request #134 from edeksumo/Fix-Defence-Ani
Let's try this.
2015-11-11 09:43:51 +01: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
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
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
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
160fa38254 Client: change cursor using node action information of pathfinder 2015-11-08 03:10:48 +03:00
edeksumo
ba1062ed3c Formating2
Change ani to anim
2015-11-07 23:30:01 +01: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
AlexVinS
e645b46aed Revert "Merge pull request #124 from vcmi/issue/1372"
This reverts commit da01af319b, reversing
changes made to 8b6b4e2e0b.
2015-11-07 11:35:02 +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
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
edeksumo
dd525da153 Formatting 2015-11-04 23:37:53 +01: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
Alexander Shishkin
da01af319b Merge pull request #124 from vcmi/issue/1372
Issue/1372
2015-11-04 10:39:40 +03:00
edeksumo
75a76c0bf0 FixDefenceAni 2015-11-04 00:19:40 +01: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
AlexVinS
f6b9015324 Use constant for summoned creature slot 2015-11-03 02:18:34 +03:00