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

597 Commits

Author SHA1 Message Date
Andrey Filipenkov
aa217236b3 check amount of artifacts on hero when checking requirements of a quest that requires artifact(s)
fixes case when 2 or more identical artifacts are required
2022-10-01 09:28:32 +03:00
Tomasz Zieliński
20c102e648 Remove T prefix from new typedefs 2022-09-29 11:44:46 +02:00
Tomasz Zieliński
475f835769 More style tweaks 2022-09-28 11:38:08 +02:00
Tomasz Zieliński
f386f42166 Merge remote-tracking branch 'origin/develop' into terrain-rewrite
# Conflicts:
#	lib/Terrain.cpp
#	lib/Terrain.h
#	lib/battle/CBattleInfoEssentials.cpp
#	lib/rmg/ObstaclePlacer.cpp
#	lib/rmg/RiverPlacer.cpp
2022-09-27 07:50:17 +02:00
Tomasz Zieliński
25f66097cc Handle RoadType by value / reference 2022-09-26 10:20:39 +02:00
Tomasz Zieliński
f804f8a326 Store RiverType by value, handle by reference 2022-09-26 09:51:36 +02:00
Tomasz Zieliński
2bd30556a3 Store TerrainType by havlue and handle by reference 2022-09-26 09:17:55 +02:00
Tomasz Zieliński
cd3a1a02c2 More style tweaks 2022-09-25 21:47:44 +02:00
Tomasz Zieliński
4ea57ea7fc A variety of suggested style tweaks 2022-09-25 09:33:56 +02:00
Andrey Filipenkov
ff635edc0b wrap all library code into namespace if VCMI_LIB_NAMESPACE is defined
preparation for having client and server in a single process
2022-09-24 15:55:21 +03:00
Tomasz Zieliński
ebe45d512d Moved roads and rivers to TerrainTypeHandler, by analogy to TerrainType. 2022-09-23 16:24:01 +02:00
Tomasz Zieliński
494b0f0226 First version that compiles 2022-09-21 11:34:23 +02:00
DjWarmonger
7ba271edf1
Rotation rebase2 (#912)
* Instead of [x][y][z] coordinates, map will be stored as [z][x][y].
* Nullkiller AI can get it too.
* Use boost::multi_array instead of nested vectors
* In MapHandler too
* Rotate foreach algorithms, too
* VCAI gets rotated, too
2022-09-18 17:39:10 +03:00
Nordsoft91
e4ac0d4370
Editor prerequisites [part 2] (#889) 2022-09-17 14:04:01 +03:00
DjWarmonger
3d2dc2335b Switch ObjectTemplate to shared_ptr<const> (#870) 2022-09-11 16:13:53 +03:00
Nordsoft91
4bd0ff680a Random map generator refactoring (#762)
random map generator refactoring and improvements
2022-09-11 11:31:27 +03:00
Andrii Danylchenko
4b4cc3cf4b battlefields in VLC and custom bonuses for terrain patches 2022-09-11 11:31:27 +03:00
Nordsoft91
c4035134e5 New battlegrounds (#758) 2022-09-11 11:31:26 +03:00
Nordsoft91
aaa07e4d2e New terrain support - part 1 (#755)
Initial support of new terrains
2022-09-11 11:31:26 +03:00
Dmitry Orlov
9e3c4b69c4 Minor fixes 2021-12-22 21:37:56 +02:00
Dmitry Orlov
a65feb29f5 Fixed: Advanced options window issues 2021-11-13 17:02:11 +02:00
Andrii Danylchenko
9c8d776398 Merge branch 'develop' into handlersAbstraction
# Conflicts:
#	CI/linux/before_install.sh
#	CI/mac/before_install.sh
#	CI/mxe/before_install.sh
#	lib/CModHandler.cpp
#	lib/mapObjects/CObjectClassesHandler.cpp
#	lib/mapObjects/CObjectClassesHandler.h
#	lib/mapObjects/CommonConstructors.cpp
#	server/CGameHandler.cpp
#	test/CMakeLists.txt
#	test/spells/effects/TeleportTest.cpp
2021-07-16 00:32:13 +03:00
Andrii Danylchenko
6d8373a473 Configure github actions 2021-07-13 14:56:35 +01:00
AlexVinS
ecaa9f5d0b Entities redesign and a few ERM features
* Made most Handlers derived from CHandlerBase and moved service API there.
* Declared existing Entity APIs.
* Added basic script context caching
* Started Lua script module
* Started Lua spell effect API
* Started script state persistence
* Started battle info callback binding
* CommitPackage removed
* Extracted spells::Caster to own header; Expanded Spell API.
* implemented !!MC:S, !!FU:E, !!FU:P, !!MA, !!VR:H, !!VR:C
* !!BU:C, !!BU:E, !!BU:G, !!BU:M implemented
* Allow use of "MC:S@varName@" to declare normal variable (technically v-variable with string key)
* Re-enabled VERM macros.
* !?GM0 added
* !?TM implemented
* Added !!MF:N
* Started !?OB, !!BM, !!HE, !!OW, !!UN
* Added basic support of w-variables
* Added support for ERM indirect variables
* Made !?FU regular trigger
* !!re (ERA loop receiver) implemented
* Fixed ERM receivers with zero args.
2021-02-14 19:05:43 +03:00
Dmitry Orlov
39de2f6435 Fix: Morale bonus should be shown correctly 2020-11-11 22:43:40 +03:00
John Bolton
a05ae78e67 Fixed lots of warnings.
Disabled the following (for MSVC only) that couldn't (or shouldn't) be fixed.

4003: not enough actual parameters for macro 'identifier'
4250: 'class1' : inherits 'class2::member' via dominance
4251: 'type' : class 'type1' needs to have dll-interface to be used by clients of class 'type2'
4275: non dll-interface class 'type1' used as base for dll-interface class 'type2'
2020-10-04 02:20:18 -07:00
Dydzio
2f15ca9406 Do not build pseudo-buildings explicitly with events 2019-06-04 22:29:07 +02:00
Michał Kalinowski
ac6b477aa2 Simplify statements
-Simplify return statements across the code
2019-03-31 09:43:14 +03:00
AlexVinS
b3c26615df Fixed map format regression: there is no default difficulty. 2019-01-26 17:05:35 +03:00
Alexander Shishkin
b00e935e4d
Warnings fixes (#538)
Warnings fixes
* Suppress `missing-braces` for Clang
* Fixed many C4275 warnings
* Fixed almost all Clang/GCC warnings
* Silence most frequent MSVC warning.
* Fixed some pessimizing-move warnings
* Fixed some unused capture warnings
2019-01-19 13:52:02 +03:00
Michał Janiszewski
0ff2e1180d Throw std::runtime_exception instead of a pointer to new one
cf. https://isocpp.org/wiki/faq/exceptions#what-to-throw
2018-10-31 07:27:54 +01:00
Arseniy Shestakov
ac66fc7f42 Full rework of pre-game interface and networking
New features for players:
* Loading for multiplayer. Any save could be used for multiplayer.
* Restart for multiplayer. All clients will restart together.
* Loading from single save.
* Hotseat mixed with network game. Multiple players per client.
* Now connection to server could be cancelled.
* Return to menu on disconnections instead of crashes.
* Restoring of last selected map, save or campaign on next run.

TLDR on important changes in engine code:
* UI: work with server separated from UI
* UI: all explitic blitting replaced with IntObject's
* UI: all new code use smart pointers instead of DISPOSE
* Gameplay always start through lobby controlled by server.
* Threads receiving netpacks now shared for lobby and gameplay.
* Campaigns: heroes for crossover now serialized as JsonNode.
2018-04-04 14:24:26 +07:00
Henning Koehler
6ddcb079a4 Enabled new secondary skills to be created (#438)
* Universities, Scholars and Witch Huts may offer new skills
* Moved encode/decodeSkill to CSkillHandler
* Refactored CSkill interface and CSkill::LevelInfo image storage
* Legacy game constants renamed to ORIGINAL_XXX_QUANTITY
2018-03-31 12:56:40 +07:00
AlexVinS
f917ec5254 Revert "Fixed ancient backward compatibility regression"
This reverts commit 3c67e12620.
2018-02-28 15:00:38 +08:00
AlexVinS
3c67e12620 Fixed ancient backward compatibility regression 2018-02-24 19:48:49 +03:00
Nikolay Shalakin
3795985de9 Eliminate warnings / errors. Pull request #388 2018-02-11 15:17:14 +03:00
AlexVinS
0b70baa95e Spells configuration version 2 (effect-based)
* Indirect spell effects loading
* Json serializer improvements
* spell->canBeCastAt do not allow useless cast for any spell
* Added proxy caster class for spell-created obstacles
* Handle damage from spell-created obstacles inside mechanics
* Experimental GameState integration/regression tests
* Ignore mod settings and load only "vcmi" mod when running tests
* fixed https://bugs.vcmi.eu/view.php?id=2765 (with tests)
* Huge improvements of BattleAI regarding spell casts
* AI can cast almost any combat spell except TELEPORT, SACRIFICE and obstacle placement spells.
* Possible fix for https://bugs.vcmi.eu/view.php?id=1811
* CStack factored out to several classes
* [Battle] Allowed RETURN_AFTER_STRIKE effect on server side to be optional
* [Battle] Allowed BattleAction have multiple destinations
* [Spells] Converted limit|immunity to target condition
* [Spells] Use partial configuration reload for backward compatibility handling
* [Tests] Started tests for CUnitState
* Partial fixes of fire shield effect
* [Battle] Do HP calculations in 64 bits
* [BattleAI] Use threading for spell cast evaluation
* [BattleAI] Made AI be able to evaluate modified turn order (on hypothetical battle state)
* Implemented https://bugs.vcmi.eu/view.php?id=2811
* plug rare freeze when hypnotized unit shots vertically
* Correctly apply ONLY_MELEE_FIGHT / ONLY_DISTANCE_FIGHT for unit damage, attack & defense
* [BattleAI] Try to not waste a cast if battle is actually won already
* Extended JsonSerializeFormat API
* fixed https://bugs.vcmi.eu/view.php?id=2847
* Any unit effect can be now chained (not only damage like Chain Lightning)
** only damage effect for now actually uses "chainFactor"
* Possible quick fix for https://bugs.vcmi.eu/view.php?id=2860
2018-02-08 11:37:21 +03:00
Michał Kalinowski
26a222ac62 Change JsonType to enum class (#393)
Change enum JsonType to enum class JsonType
2017-11-27 00:18:18 +03:00
AlexVinS
d7366f04a9 [Map format, PreGame] allow selection of any allowed faction 2017-11-16 02:06:07 +03:00
AlexVinS
b8d0dfac5f [Map format] fixed player options "canPlay" field 2017-11-16 00:03:27 +03:00
AlexVinS
8c0fab1dcf fixes 2017-08-12 14:36:37 +03:00
AlexVinS
15138c23de Finished conversion to new logging API
* removed logger streams
* (float3|int3)::operator() -> (float3|int3)::toString(), it was too ugly and confusing.
2017-08-11 23:06:27 +03:00
AlexVinS
046e1a7c29 Prepared JsonNode for new logging API. 2017-08-11 16:27:42 +03:00
AlexVinS
85e952f25f Logging cleanup 3 2017-08-10 20:17:10 +03:00
AlexVinS
61e241308d Logging cleanup 2017-08-10 19:52:05 +03:00
AlexVinS
12b42f4495 Improved map format tests 2017-08-03 13:50:54 +03:00
ArseniyShestakov
9d9c026c85 Code style: serialize everything on own lines for easier debugging (#357) 2017-07-31 16:35:42 +03:00
ArseniyShestakov
a4c0ad94b1 Code style: remove default value hints in definitions (#342)
Some are outdated and this is something IDE are useful for.
2017-07-15 14:08:20 +03:00
Arseniy Shestakov
f1e5797834 Code style: move or add licensing information on top of every file 2017-07-14 01:26:03 +03:00
Arseniy Shestakov
dbcd79c48a Code cleanup: remove double and unneded semicolons 2017-07-12 22:01:10 +03:00
AlexVinS
a31c28ec33 Unified war machine mechanics.
* it is possible to define new war machines
* added warMachine field to artifact configuration
2017-06-06 19:18:26 +03:00
AlexVinS
c82afe7156 switch CMapService API to ResourceID 2017-06-04 22:42:48 +03:00
Alexander Shishkin
7e1b0d71c5 Added option for saving generated maps on client side (#307)
* new configuration option 'general.saveRandomMaps'
* maps being saved to 'userCachePath/RandomMaps'
* no deletion of old random maps
* map filename generated based on template name and random seed
2017-06-04 20:33:28 +03:00
AlexVinS
c66c66c5ae Fixed https://bugs.vcmi.eu/view.php?id=2686 2017-05-29 12:42:23 +03:00
AlexVinS
70a092f58c [Refactoring] use virtual method for object specific actions when new map object is created
* --TODO
* fixes CID 1366291, CID 1366297
2017-05-28 16:23:42 +03:00
AlexVinS
fc55efb72d Fixed CID 1375681 2017-05-28 15:16:40 +03:00
AlexVinS
7a1dd7bd7d Fixed CID 1375707 2017-05-28 14:40:34 +03:00
AlexVinS
a85b4cf2a5 * WIP on event condition format
* Hero portrait serialization
* Fix town spells serialization

* Added support for float exponential part in Json
* Added support for int64 in Json
* Added basic Hero definitions serialization
* Added rumors serialization
* Advanced player info serialization.
* Added Disposed heroes serialization, (!) not covered with tests yet
* Added Local event serialization
* Added Pandoras box serialization
* Added Seer hut reward serialization
* Added CQuest serialization
* Added API for map object instance names serialization.
* Added random dwelling options serialization
* Advanced town options serialization
* Advanced hero options serialization
* More map format tests
* A lot of fixes, cleanup and refactoring
2017-05-27 00:23:19 +03:00
DjWarmonger
cc452bdfa9 Improved road routing so they can go under any passable object. 2016-12-21 10:10:37 +01:00
AlexVinS
609c6f81bd Fixed a few CWE-457 2016-11-27 22:37:41 +03:00
AlexVinS
384c5827ae Fixed CID 1197490, CID 1197491 2016-11-25 17:21:27 +03:00
AlexVinS
ca13bb8412 Fixed CID 1366375, CID 1197633 2016-11-25 17:04:30 +03:00
AlexVinS
4ba3c6fecc Fixed CID 1288855 2016-11-25 16:40:11 +03:00
Arseniy Shestakov
1e60ba6516 Only delete CQuest in CMap destructor and not with IQuestObject
Quest information must remain accessible even if map object removed. Fix issue 2472
2016-09-13 01:30:47 +03:00
Arseniy Shestakov
02f70464fb Fix mismatched-tags Clang warnings
They're not important at all, but sicne there only few of them left just fix them.
2016-09-08 19:42:59 +03:00
AlexVinS
42e7128acc Fixed possible use-after-free crash with artifacts registration in RMG. 2016-09-08 14:48:48 +03:00
AlexVinS
6dc47a2de0 Fixed use-after-free crash with quests registration in RMG.
* code taken from PR #200
2016-09-08 14:48:46 +03:00
AlexVinS
437eadf1ed do not leak scenarioOpts in CMapInfo 2016-08-31 06:18:01 +03:00
Arseniy Shestakov
452e28d183 Remove some useless includes found by cppclean
This of course was tested and shouldn't break anything
2016-08-26 04:42:16 +03:00
Arseniy Shestakov
ec22da4412 CMap: fix objects memory leak on exit 2016-08-19 16:56:26 +03:00
DjWarmonger
2a9ddadedd Fixes. Everything works now. 2016-08-12 21:40:22 +02:00
DjWarmonger
9b58450cb0 Part 3 - first working draft, cut generation time by half. 2016-08-12 19:16:21 +02:00
DjWarmonger
19ea46a6d2 Part 2. 2016-08-11 09:20:50 +02:00
DjWarmonger
2410f0af61 - WeightedRule optimization - part 1
- comments, style
2016-08-11 07:49:08 +02:00
DjWarmonger
2bffd4e5c1 Moar optimization! 2016-08-09 13:40:46 +02:00
Arseniy Shestakov
10dbbead2d Fix indentation of logging code and around it
That wouldn't be as big issue if problem affected few files, but it everywhere in codebase.
Fixed it everywhere since in most files that is the only code with wrong indentation.
2016-03-12 04:46:21 +03:00
AlexVinS
8e3e574900 Fix map object appearance serialization 2016-02-26 02:03:14 +03:00
AlexVinS
4a37ed99ea Fix duplicated block-visit regression 2016-02-26 00:42:49 +03:00
AlexVinS
8b6cf82a01 Fix 2016-02-24 02:59:34 +03:00
AlexVinS
d2f04332d0 Load object appearance and pos before addNewObject call, it is required for block-visit calculation.
Added a test for tile block-visit.
2016-02-24 00:44:17 +03:00
AlexVinS
c3775486db Serizlize main town info 2016-02-23 23:23:39 +03:00
AlexVinS
17e557be17 Advance Logical identifier condition 2016-02-23 16:36:21 +03:00
AlexVinS
8ed6aa762b fix 2016-02-23 01:14:06 +03:00
AlexVinS
4bcfb8c27d Draft of new Event conditions 2016-02-22 23:43:57 +03:00
AlexVinS
dc5ad7d7b3 Make string instance names persistent 2016-02-22 19:26:42 +03:00
AlexVinS
ac281f3fec Tweaks 2016-02-22 04:53:14 +03:00
AlexVinS
51bee1000b Implemented CGWitchHut::serializeJsonOptions 2016-02-22 03:16:33 +03:00
AlexVinS
dd1aabbe23 Use JsonSerializeFormat for map objects 2016-02-22 02:37:19 +03:00
AlexVinS
a4b6d34ebe Advance map header serialization 2016-02-21 22:13:20 +03:00
AlexVinS
4ebafa17b4 Remove unused placeholdedHeroes field 2016-02-21 22:12:58 +03:00
AlexVinS
53b5587c2e Advance map header serialization 2016-02-21 21:21:22 +03:00
AlexVinS
36121696ca Clenaup 2016-02-18 17:48:04 +03:00
AlexVinS
5a8ee32f89 Tweaks 2016-02-15 18:16:45 +03:00
AlexVinS
ec760632a6 Advance Json serializer
* added bool, numeric and string support
* added some enum support
* PoC implementation of logical id condition
* Refactoring
2016-02-15 12:21:39 +03:00
AlexVinS
e0af4a665a Added hacks fot spell scroll support. 2016-02-13 19:43:05 +03:00
AlexVinS
a59f0c23ce Dedug tweaks 2016-02-13 17:16:00 +03:00
AlexVinS
5a92e0de2b Small redesign 2016-02-13 16:28:07 +03:00
AlexVinS
22b93106c8 Experimental drafts of Json serializer 2016-02-13 15:04:32 +03:00
AlexVinS
a307d3ca40 tweaks 2016-02-10 13:24:03 +03:00
AlexVinS
fb17914ae5 Debug tweaks 2016-02-10 08:59:24 +03:00
AlexVinS
3c78f960cd Complete json map format integration 2016-02-10 07:28:00 +03:00
AlexVinS
0c21efb202 Start integration of map format into engine 2016-02-09 20:20:03 +03:00
AlexVinS
483276b128 Merge fixes 2016-02-04 12:28:12 +03:00
AlexVinS
6e205a58b4 Merge remote-tracking branch 'remotes/origin/develop' into feature/VCMIMapFormat1
Conflicts:
	lib/VCMI_lib.cbp
	lib/filesystem/CZipLoader.cpp
	lib/filesystem/CZipLoader.h
	lib/mapObjects/CGTownInstance.cpp
2016-02-04 10:27:51 +03:00
Vadim Markovtsev
8d7629bdab Fix unused function warning in release mode 2016-02-02 11:12:28 +03:00
Vadim Markovtsev
3926920103 Rename radious -> radius
There is no such English word, "radious"
Some files get new lines in the end - BSD sed bug + best practices
2016-01-31 18:01:58 +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
AlexVinS
a638d0cd51 Creature set serialization 2016-01-15 20:24:17 +03: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
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
3bf9696b13 Tweaks 2015-12-05 12:38:37 +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
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
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
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
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
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
9e7e5b81e4 Merge pull request #143 from vcmi/feature/patrolSupport
Patrol support for AI heroes
2015-12-05 03:11:07 +03:00
Ivan Savenko
faa7cbff18 Fixed gcc/clang warnings 2015-12-04 01:17:43 +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
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
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
d6a142ca3d CMapLoaderH3M: support for patrol initialPos in readHero 2015-11-27 11:34:03 +03:00
ArseniyShestakov
649ebfad2f TerrainTile::topVisitableObj: avoid costly vector copying 2015-11-22 05:34:37 +03:00
ArseniyShestakov
7eebcb9d60 Artifacts: replace few more ints by ArtifactID 2015-11-07 11:46:58 +03:00
Vadim Markovtsev
e4b1ef1405 Add "override" to virtual overriden methods 2015-10-13 21:05:36 +03:00
DjWarmonger
237d3f2624 Refactoring: random spells 2015-08-12 16:40:08 +02:00
DjWarmonger
bfd4ff8954 Refactoring 2015-05-25 17:04:17 +02:00
DjWarmonger
6d502ef1a1 Implemented A* algorithm to draw shortest roads - but not correct roads yet. 2015-05-25 16:37:57 +02:00
DjWarmonger
3e8c395156 - More fixes for wander targets
- SectorMap won't find paths through the rock
2015-04-10 08:50:21 +02:00
DjWarmonger
9577ef4bda Minor tweak. 2015-04-07 13:43:33 +02:00
AlexVinS
896a2b17c0 fix patterns 2015-04-03 05:47:03 +03:00
AlexVinS
4c4ad480c5 added experimental usage of roads 2015-04-03 05:47:01 +03:00
AlexVinS
6520d2a577 fix 2015-04-03 05:46:17 +03:00
AlexVinS
ae2c72ca52 Implemented road transitions.
* untested
* still unused
2015-04-03 05:46:16 +03:00
AlexVinS
b1d4ce0474 Road|river patterns are trivial compared to terrain patterns - no need to use json, just define them as a constatnt 2015-04-03 05:46:15 +03:00
AlexVinS
877634b3a3 Define public interface of CDrawRoadsOperation 2015-04-03 05:46:14 +03:00
DjWarmonger
a0f534146c Fixed underground Lava terrain. 2015-03-28 22:03:38 +01:00
DjWarmonger
a90021364e Disable logs for better performance. 2015-03-28 17:46:39 +01:00
beegee1
e9b7044c9b Fix mantis #1859, unknown pattern in underground 2015-03-28 16:41:26 +01:00
beegee1
dafaf86eef Add some debug logging, Fix one special case when updating terrain type, Improve visual look of updated terrain types 2015-03-28 16:41:26 +01: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
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
ArseniyShestakov
f145c82031 TerrainTile: implement exclusion for topVisitable functions
For pathfinder we usually want to check what object hero staying on.
Hero is always top object so we need option to exclude it.
2015-03-08 15:05:24 +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
ArseniyShestakov
937ef0227b Use ArtifactID instead of int when possible 2014-12-24 18:49:12 +03:00
AlexVinS
66b022f93e initializer lists part1 2014-10-02 19:43:46 +04:00
Ivan Savenko
d1dd7eef48 Proper fix for #1712 - Building requirement tests are now fixed
- added minimize() method in logical expressions that will remove excessive elements
- replaced forEach() with morph() that allows replacing types in variant
2014-08-07 19:53:07 +03:00
DjWarmonger
c119ddf5ee Reduced usage of TerrainViewPattern constructor for faster map generation. 2014-07-24 20:36:52 +02:00
DjWarmonger
156e19cdf6 Various optimizations based on RMG profiling. 2014-07-24 19:16:49 +02:00
Ivan Savenko
955552488e - H3M parser will create objects that don't have data in map file via
object handler.
- Added large number of missing objects to config
2014-06-25 20:26:47 +03:00
Ivan Savenko
a0689fa377 Refactoring of hoverText from objects:
- removed hoverText field
- split getHoverText() method into 3:
- - getObjectName() for generic name
- - getHoverText(Player) for player-specific text
- - getHoverText(Hero) for hero-specific strings
2014-06-24 20:39:47 +03:00
Ivan Savenko
ab475195ac Banks now use new scheme as well
- Implemented Bank Constructor object.
- Merged Pyramid object into common Bank class. Banks can now grant
spells as part of their reward.
- Move bank config code to config/objects/creatureBanks.json. Note: WoG
banks are not updated yet, should be moved to WoG mod.
- Updated AI code so it can correctly evaluate bank danger (should be
generic enough for use with other objects)
- New files JsonRandom.* that contain routines for loading random
objects from Json (still WiP but should be stable)
2014-06-22 13:39:40 +03:00
Ivan Savenko
89b89ff85d Bugfixing. Game seems to be working without major bugs. 2014-06-15 23:25:10 +03:00
Ivan Savenko
b2e8c92383 Cleanup:
- removed commented-out #includ'es
- renamed some files to match name of class
2014-06-05 20:26:50 +03:00
Ivan Savenko
652ceb2bde Finally shattered CObjectHandler.cpp into tiny bits
- This file is now split into multiple smaller files in mapObjects
directory
- CObjectHandler itself now contains only core classes (Handler itself,
CGObject and interfaces)
- Cleaned up excessive #include's through whole project
2014-06-05 19:52:14 +03:00
Ivan Savenko
0afdfa529c Moved all object-related files to lib/mapObjects directory.
Renamed some classes to more readable names
2014-06-05 14:19:47 +03:00
Ivan Savenko
32b6568b65 Merged changes from upstream and fixed compilation caused by API changes 2014-06-03 22:45:18 +03:00
DjWarmonger
aee748d8d6 - Added monoliths between remote zones
- Fixed land connections between zones, now they're generated correctly.
2014-06-01 12:02:43 +02:00
karol57
dd33fd51a8 int3 dist2d microoptimization 2014-05-25 20:42:25 +02:00
DjWarmonger
d2fd71d087 Zone shapes & terrains work nicely. 2014-05-24 14:06:08 +02:00
Ivan Savenko
7f276185bd Moving files:
- new config for objects (config/objects/generic.json)
- renamed lib/CDefObjectHandler to lib/CObjectClassesHandler
2014-05-24 02:07:54 +03:00
DjWarmonger
4ea9810831 First version that works:
- Covered RMG with exceptions
- Fixes for object randomization & placement
2014-05-23 17:12:31 +02:00
DjWarmonger
eb337d7407 Fixed #1638 - spells banned in map settings appeared in town guild 2014-05-16 12:15:35 +02:00
Ivan Savenko
43ba3d30ea Breaking things - first commit towards configurable object(s).
- New files: lib/CObjectWithReward.h/cpp
- Classes that will be replaced by configurable object are now in this
fil

Status: far from functional, currently at "it compiles" point, some
essential pieces are still missing.
2014-04-06 23:14:26 +03:00
DjWarmonger
30b79588db - Moved gameState::guardingCreaturePosition() to CMap so it doesn't need to be recalculated many times for every player.
- Some optimizations with local cb pinter in VCAI.
2014-04-01 11:53:28 +00:00
beegee1
fe1b16a7ec Some preparation towards mantis #1743:
- refactored CRandomGenerator (added util methods, improved method names)
- usages of std::minstd_ran are replaced by CRandomGenerator (not in entire code base, C rand() usages are still not replaced)
- refactored getArtSync method of CArtHandler -> now named pickRandomArtifact
- fixed some compiler warnings
- updated source code URL in VCMI spec
2014-03-17 19:51:07 +00:00
DjWarmonger
1d6e265e34 - Fixed special spells spawning in Pyramid
- Allowed new spells to spawn in Pyramid
2014-03-09 12:33:26 +00:00
DjWarmonger
0347c61dd2 All new spells will be possible to spawn in town magic guilds. 2014-03-09 09:37:20 +00:00
beegee1
d0a5a6eab4 - Implemented hero recreate handling correctly 2014-02-23 13:52:06 +00:00
DjWarmonger
a3cad2883f - Restored correct specialty serialization (#1599 and all its children)
- Fixed rare AI crash
- Fixed AI visiting some objects many times
- Some cleanup and refactoring
2014-02-17 17:28:39 +00:00
Ivan Savenko
48d6e2cd59 - move campaigns description into new config file, campaignSets.json
- campaigns parser uses binary reader, fixes #1711
- fixed description of change resolution button
2014-02-14 22:46:06 +00:00
Ivan Savenko
8d178fbcf5 Minor fixes:
- fog of war will be initialized after bonuses are set (needed if heroes
have scouting or arts with sight bonus)
- victory condition "control all dwellings" also requires golem factory/
- it is possible to dismiss troops during exchange between heroes
2014-02-09 19:47:23 +00:00
Ivan Savenko
7f07a30d7d More fixes for map-specific crashes, fixes #1427 and #733
- if special victory condition is present AND there is only one player
normal victory condition will be disabled
- added new triggered condition, constant value
- if target of CONTROL/DESTROY condition is removed from map, triggered
condition will be replaced with constant
- fixed randomization of armies with random stacks
2014-02-09 12:10:02 +00:00
Ivan Savenko
e6f433795b - fixed some crashes on staring a map/campaign 2014-02-08 21:05:24 +00:00
Michał W. Urbańczyk
6f8974bab3 Fix for #1673 — objects vector may contain nullptr (for objects that have been removed). 2014-02-01 12:54:55 +00:00
beegee1
d4fd361d4b - fixed #1643 -> hero placeholder handling
- fixed bug when loading victory/loss conditions of the 3rd scenario in the first ROE campaign
- fixed bug when loading artifacts to hero of the 3rd scenario in the first ROE campaign (due to corrupt H3M map)
- implemented function object to quickly find a object by it's sub ID in a list
- added netbackbase.h to header list in CMake
- removed false message which said that the server loaded the map successfully
2014-01-30 18:56:31 +00:00
beegee1
22e119770a Fixed mantis #1645 2014-01-03 16:36:22 +00:00
Ivan Savenko
2c4c964a45 Large rewrite of adventure map objects:
- replaced CDefObjInfo with ObjectTemplate class
- ObjectTempate is a direct member of objects instead of pointer with
shared ownership across CMap, handler and game objects
- simplified handling of objects that can change appearance (e.g. towns)
- all object queries regarding object appearance/blockmaps use h3m pos
instead of relative positions
- removed need of modhandler::reload
- cleanup of some old code
2014-01-02 23:48:38 +00:00
Ivan Savenko
2b9e074d54 - implements level limit (Mantis #1620)
- added workaround to weird bug where vcmi fails to find objects for
win/loss conditions
2014-01-01 16:12:53 +00:00
Ivan Savenko
cd8a0c01e4 Data for campaign win/loss conditions. All campaigns should now have
correct conditions.
All custom conditions are now validated using schema.

Note that some of scenarios may not work due to instant win/loss, mostly
because some placeholders fail to import (Mantis #1643)
2014-01-01 13:30:31 +00:00
Ivan Savenko
7e02f6b670 Support for overriding victory/defeat conditions from h3m map or
campaign:
- new file MapFormatJson that implements small subset of Json map
format, as described on wiki
- vcmi will read overrides from file config/mapOverrides.json (currently
empty)
- Json writer for logical expressions

TODO: write data for map overrides
2013-12-30 23:09:58 +00:00
beegee1
a03d01bd3f - Updated TODOs, removed unused method declaration, updated comments
- Fixed hero strength calculation (power, knowledge should be included as well)
2013-12-30 20:04:24 +00:00
Ivan Savenko
a8b9258840 missing dll_linkage 2013-12-29 14:35:38 +00:00
Ivan Savenko
0c5be52a42 Win/loss conditions based on logical expressions, yet another large
changeset:
- victory/defeat will be detected using triggered events
- vcmi will convert h3 conditions into set of triggered events
- it is possible to either change number of days without towns or even
remove this loss condition completely
- possibility of custom win/loss text and icons in pregame (no longer
connected to win/loss conditions)

Still missing:
- No interface to pass custom events/victory conditions into the game 
- AI would benefit from improvemets (handle all victory conditions,
select best one to fulfill)
- You have X days till defeat message still hardcoded to 7 days
2013-12-29 11:27:38 +00:00
beegee1
11ca1ec1f8 - Fixed custom main hero handling (map options)
- Refactoring
2013-12-23 15:59:37 +00:00
DjWarmonger
473250e223 - Removed slow and buggy part of exploration code
- Various tweaks and performance improvements. remove_if on long vector is a bad idea.
2013-12-21 17:34:59 +00:00
beegee1
68bdf71db6 - Fixed GCC compiler warnings
- Implemented move heroes to next scenario partially
2013-12-20 13:07:58 +00:00
beegee1
f0cbbbdb70 - Refactored method CGameState::init 2013-12-18 18:18:12 +00:00
beegee1
b9b25ef552 - Fixed mantis #1422 (starting another scenario crashes VCMI for now)
- Refactoring
2013-12-16 18:39:56 +00:00
Ivan Savenko
6427827b33 Fixed extremely slow parsing of maps directory 2013-12-06 09:13:55 +00:00
Ivan Savenko
3560bbb7f3 two patches/pull requests from janisozaur
- replace our custom bmap with std::map::at()
- compile fixes for editor
2013-11-12 10:45:42 +00:00
Ivan Savenko
ee6cdbeffe went through the rest of cppcheck warnings, mostly harmless 2013-11-07 12:48:41 +00:00
Michał W. Urbańczyk
a2610de87d Fixed #1385 (and possible some related issues) 2013-09-03 13:18:09 +00:00
Ivan Savenko
83440f1149 A bit more text-related work:
- credits screen will use multi-line label instead of hackish usage of text box
- campaign intro movie player now plays voiced intro
- minor fixes to last commit
2013-08-29 16:41:14 +00:00
beegee1
1ac328635a - Added handler classes CRmgTemplateStorage and CTerrainViewPatternConfig to LibClasses
- Re-organized CMapGenerator
- Created CZone and CTemplate objects in the heap and used pointers
- Added stub classes CZoneGraphGenerator and CZonePlacer (include warnings of unused variables, please ignore them)
- Fixed CRandomGenerator bug that always the same number was produced
- Better structure of Visual Studio project files with using filters
- Updated project files (VS, CMake)
- Excluded compiler warning mismatched-tags (false positive)
- Fixed a bug when compiling with unit tests enabled
2013-08-17 12:46:48 +00:00
Ivan Savenko
b87897096c Filesystem handling is now more flexible
- removed CResourceLoader class in favor of one that implements resource loader interface
- removed global pool of files, in favour of more dynamic approach
- renamed some files to match current situation
All these changes are needed mostly for future mod manager + .zip support
2013-07-28 14:49:50 +00:00
Michał W. Urbańczyk
a1f545792b Compile fixes specific for VS 2012"
* Reverted std::bind to boost::bind. std::bind on Visual 2012 doesn't work in some cases (especially with std::ref), not sure why [but it seems to be a bug, since 2013 preview compiles the same code fine]. 
 * Move assignment operator for VS 2012.
2013-07-02 15:23:32 +00:00
Michał W. Urbańczyk
4576719abe Visual Studio 2013 Preview compile fixes:
* 0 is not convertible to std::function, nullptr should be used
* std::ref(rand) is not convertible to function<int()>, used lambdas (why we dont just pass "rand" ? )
* CFunctionList needs to be constructible from nullptr
* move constructor for CMapInfo (Visual cannot generate them :( )
* #ifdefed some stuff that is not needed anymore since cmath is updated with C99 stuff
* using std::make_unique instead of our vstd implementation

CSelector: 
* introduced a class in place of typedef
* Having an overloaded && || operators over sth that is convertible to bool… Wasn't a good idea after all. Purged the operators, replaced  with And/Or methods (chaining-style).
* constructor that is present only when constructing from class or function (SFINAE). std::function has an implicit converting constructor from T causing ambiguities (even if the overload would cause compile error in the body)
2013-07-02 12:08:30 +00:00
Ivan Savenko
f82122d9be second part of c++11 update. gcc 4.5 and VS 2010 are no longer supported
- BOOST_FOREACH -> for
- replaced several boost classes with std (e.g. unordered)
- removed gcc-4.5 workarounds
- ran clang c++11 migration tool to detect some cases:
- - pointer initialized with "0" to nullptr
- - replace for with iterators with range-based for
- - use auto in some situations (type name specified twice, avoid long iterators type names)
2013-06-29 13:05:48 +00:00
Ivan Savenko
2b45e13c5c c++03 -> c++11 switch:
- use std versions of function, bind and ref
- OVERRIDE -> override
- NULL -> nullptr
- use std versions of random distributions

NOTE: this may be last revision that supports gcc-4.5
2013-06-26 11:18:27 +00:00
Ivan Savenko
6737c270c9 gcc 4.5 compatibility fixes. Mostly due to lack of fully finctional nullptr class 2013-06-19 21:26:27 +00:00
beegee1
56534bc3fb - Bug fix to previous commit 2013-05-21 19:26:31 +00:00
beegee1
5328beb8e7 - Fixed some bugs when starting a RMG map - Checks if there is a template for the chosen options(rejects if not) - Added a few templates for development(2 to 4 players, medium maps are supported) - Refactoring 2013-05-21 19:08:06 +00:00
Michał W. Urbańczyk
096e1230ce That needs to be serialized. 2013-05-20 08:37:31 +00:00
Michał W. Urbańczyk
fc6e72dc75 * Fixed enchantments (#1265). Their effects were not properly added when reading config. Battle interface will be little less likely to block itself after corrupted spell cast.
* Fail gracefully when the file from which game is started is in invalid version.
* Bumped versions.
2013-05-19 15:14:23 +00:00
Michał W. Urbańczyk
be7c2bd07f CGHeroInstance* can be serialized over network even when hero has been defeated. Strongly typed hero type ID introduced.
Should fix #1260.
2013-05-18 22:30:48 +00:00
beegee1
42c2c29976 - Added support for RMG templates(subset of OH3) - Added template "Small Ring" for testing 2013-05-11 17:36:11 +00:00
Ivan Savenko
b3bbe27089 - ignore wog maps if wog is not present 2013-05-04 19:20:32 +00:00
beegee1
298f862d86 - Implemented updating additional terrain types fully(including 2 special cases) 2013-05-03 10:15:59 +00:00
beegee1
3358a8efec - Added terrain & object selection classes - Added CComposedOperation - Refactored clear terrain, it is now an operation - Added rough support for updating terrain type if required 2013-04-29 15:51:39 +00:00
Ivan Savenko
b20f8fd3d4 - fixed uninitialized access into modHander
- fixed  #389
2013-04-28 15:06:14 +00:00
beegee1
0f7d175896 - Fixed all unit test failures and a few more bugs - Simplified view generation algorithm 2013-04-26 15:57:47 +00:00
beegee1
23f7be2a54 - Fixed a few bugs related to the terrain view generation - Updated CMakeLists in /test(copy resources if no source files has been changed too) 2013-04-25 16:09:48 +00:00
beegee1
7a3f5dc23b - Replaced exceptions with assert for internal-API code 2013-04-22 16:04:17 +00:00
beegee1
8d82c49a99 - Compile fix - Renamed map operations 2013-04-22 15:08:04 +00:00
beegee1
dd78205ce8 -Added test subfolder and updated CMakeLists for unit testing - Added a test case for the DrawTerrainOperation class(does not pass all tests successfully, 6 failures left to fix) - Fixed a few bugs 2013-04-22 14:49:28 +00:00
Ivan Savenko
c6cc6e6301 Large changeset, first part of editing H3 objects via mods feature. Changes:
- loading of all objects (including H3 objects) will be directed by mod handlers
- common base for all handlers accessible from mod system (IHanderBase)
- json format changes: use struct with string ID's instead of vector

- fixed some gcc/clang errors and warnings
- fixed several cases of memory leaks and invalid memory access (mostly related to usage of bonus system and/or identifiers resolution)

Note that right now loading is much slower than before due to excessive json validation (or not fast enough validator)
2013-04-21 12:49:26 +00:00
Michał W. Urbańczyk
d1d67caa0b Get rid of some old serialization workaround code that is not needed because serializer was improved in the meantime.
Fixing #1254.
Fixed possible race causing corruption of the server savegame.
2013-04-20 18:44:55 +00:00
Michał W. Urbańczyk
e8354908c3 Big change: Introduced new mechanism to handle queries. It should not cause any visible changes ATM apart from fixing several long-standing bugs realted to handling post-visit/battle/levelup callback, including infamous creature bank issues: #955, #1053, #1063, #1191. Needs testing.
Minor changes:
* default log level set to trace
* LOG_TRACE raii guardian lifetime will last till the end of block
* compile fixes
* minor refactorings
2013-04-20 11:34:01 +00:00
beegee1
03c2aa9153 - Refactored CMapEditManager(added structure for undo functionality) - Refactored CMap(terrain pointer is private, safe access via getTile) 2013-04-19 11:43:11 +00:00
beegee1
45fccfb1a6 - Added new trace macro LOG_TRACE which autom. appends leaving func message - Removed old trace macros - Small refactoring in CMapEditManager - Changed documentation comments to /// style for various mapping header files 2013-04-16 13:16:58 +00:00
beegee1
44bde4a1d3 - Fixed indentation for various files, sorry... 2013-04-14 19:24:31 +00:00
beegee1
c10266ed97 - Reduced complexity to use the CMapGenerator(simpler interface) - Removed h3m.txt and tchar_amigaos4.h 2013-04-14 18:52:05 +00:00
beegee1
c7c2686379 - Integrated the logging API into the client and the lib - Remove some more comments and switched to /// style - Fixed recursive locks - Added Global.h to CMakeLists(now visible in qt-creator) - Removed usage of shared_mutex - Added unique_ptr to CLogger targets 2013-04-09 14:31:36 +00:00
beegee1
ee51c5beb5 - Renamed /lib subfolders to lowercase 2013-04-07 10:48:07 +00:00