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

243 Commits

Author SHA1 Message Date
Arseniy Shestakov
74e5c5bf05 CGameHandler: rename CPackForClient argument and add network logging 2018-04-04 14:24:32 +07: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
Alexander Shishkin
8b002ad774
Issue2888 (#421)
Fixed issue 2888
* Merged AFTER_ATTACK & BEFORE_ATTACK cast modes.
* Introduced new caster class for creature ability usage
* Added few tests
2018-03-02 13:22:51 +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
Arseniy Shestakov
7c77249d37 Refactoring: get rid of macro in server-side request validation code 2018-01-28 08:03:48 +03:00
Arseniy Shestakov
da117e9255 Code style: remove void from constructors without arguments 2018-01-13 11:51:47 +03:00
Piotr Wójcik
7171fa7ad4 Formatting 2017-10-28 11:04:55 +02:00
Piotr Wójcik
58b427345f Constify 2017-10-18 21:39:04 +02:00
Piotr Wójcik
f145b4be91 Correctly sacrifice many stacks or many atrifacts, fixes #2607 2017-10-14 21:30:56 +02:00
ArseniyShestakov
9d9c026c85 Code style: serialize everything on own lines for easier debugging (#357) 2017-07-31 16:35:42 +03:00
ArseniyShestakov
006fa6c6df Merge pull request #332 from FeniksFire/SmallBugFix
Fix handling damage from obstacles
2017-07-15 00:09:37 +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
FeniksFire
43d324b561 Fix handling damage when stack wait in moat.
Currently stack don't take any damage from moat when he stay in same
place.
2017-07-09 15:07:20 +02:00
AlexVinS
3d1a84875e Queries refactoring
* Moved SUMMON_BOAT special case to mechanics
* Partially moved Town portal logic to mechanics class
* Added generic query reply to CCallback
* Redesigned Queries so that base API do not depends on CGameHandler
* Got rid of CGameHandler::castSpellRequest
* Removed CGameHandler::castSpell
* Added new Query type for town portal dialog (not used yet)
2017-07-03 21:43:04 +03:00
ArseniyShestakov
2f305cc68d Remove code related to duel mode (#312)
Remove code related to duel mode
2017-07-01 16:30:13 +03:00
FeniksFire
4113bdab01 Moving some files from lib to the battle subdirectory. 2017-06-26 15:26:08 +02:00
AlexVinS
0f5202689e Cumulative spell effects
* Added experimental support for cumulative effects for ENCHANTED bonus
* Updated and fixed SPECIAL_PECULIAR_ENCHANT processing
* Initial implementation of cumulative spell effects.
* Scheme for new spell feature - cumulative bonus.
2017-06-13 21:50:50 +03:00
AlexVinS
0190c9804e formatting 2017-06-06 19:45:34 +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
Arseniy Shestakov
4b0f702e7e Add LeaveGame netpack and avoid replying on it and CloseServer 2017-06-02 02:51:44 +03:00
AlexVinS
609c6f81bd Fixed a few CWE-457 2016-11-27 22:37:41 +03:00
AlexVinS
86e33a4c45 [Refactoring] Unified SetResources NetPack API. 2016-11-26 15:14:43 +03:00
AlexVinS
dc39fb2d14 Removed useless CPack::type field.
* it was an ancient network protocol artifact
2016-11-18 17:45:59 +03:00
DjWarmonger
9db3bfcbf2 Merge pull request #212 from vcmi/refactoring/serialization2
Apparently it works - both new and old saves load at least.
2016-11-01 17:25:39 +01:00
Vadim Markovtsev
dccc25268c Fix the initial creature spells at battle start
Before: built-in spells appear on first move of the creature
After: all built-in spells appear before the first move but after tactics

Example: Air Shield for experienced skeletons
2016-10-28 23:37:45 +02:00
Ivan Savenko
5b76c3f4eb Rebase of codebase changes for refactored serializer
Some of newer fixes not yet merged there and save compatibility a bit off.
2016-10-27 18:12:20 +03:00
Vadim Markovtsev
6fe5f2a7f6 Fix segfault / assertion failure during battle
The cause of the assertion failure at BattleStackAttacked::applyGs "at"
was shooting and casting some spell in handleAttackBeforeCasting() and
eventually killing the whole stack. Fix: filter dead stacks in the end of
handleAttackBeforeCasting().
2016-10-12 19:11:12 +02:00
Arseniy Shestakov
7b7958c548 Cheat codes: add option to apply cheats on different players
All suitable codes can now be used with "ai", "all" color or with object ID:
vcminahar all - will apply cheat to all heroes of all players
vcminahar ai - will apply cheat  to all heroes of AI players
vcminahar blue - will apply it to all heroes of blue player
vcminahar 553 - will apply cheat to hero with instance id of 553 if it's exist
Cheats without options work as before.
2016-10-02 16:21:46 +03:00
AlexVinS
23b7a803b6 cleanup 2016-10-01 20:07:36 +03:00
Arseniy Shestakov
c8faca8f39 Refactoring: only use RNGs explicitly to avoid bug prone code in future
Now server-side code should always use CRandomGenerator::getDefault which is serialized in GH.
CGameState::getRandomGenerator should be only used from GS code and CPackForClient-based applyGs.
2016-09-11 00:10:46 +03:00
Arseniy Shestakov
c8bcb14d34 CCallbackBase: add CRandomGenerator to all callbacks
This is easiest way to make server RNG available to CBattleInfoCallback.

Now server, client and gamestate have own RNG instance.
Only server and gamestate RNGs are serialized.
2016-09-09 23:16:42 +03:00
Arseniy Shestakov
2ba3b20928 Multiple changes to RNG usage to both client and server
Server should never use RNG from CGameState directly.
Instead server get's own RNG that's state is secret for client.
2016-09-09 23:16:42 +03:00
ArseniyShestakov
c550484613 Merge pull request #181 from vcmi/feature/drawbridgeMechanics
Feature/drawbridge mechanics
2016-02-14 16:32:24 +03:00
Arseniy Shestakov
c5cfc8467f Battles: change naming from drawbridge to gate for everything
This way code is shorter and cleaner while in future we may support towns with gate only.
2016-02-13 17:40:31 +03:00
Arseniy Shestakov
fbb34b8d04 Battles: always update drawbridge state after battle state changed
Now gate tower destruction will immidiately affect drawbridge state.
2016-02-09 10:59:33 +03:00
Arseniy Shestakov
57328bdc83 Battles: implement basic drawbridge mechanics
Movement to blocking hex 94 not yet properly handled as stack movement code need to be rewritten first.
Also gate destruction not immidiately affect drawbridge state.
2016-01-29 22:43:35 +03:00
AlexVinS
ba017c443d Start from diff of pull request #124 from vcmi/issue/1372 2016-01-29 21:05:17 +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
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
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
AlexVinS
c94bea51e3 Update army in case of summoned creatures 2015-11-03 02:18:33 +03:00
Vadim Markovtsev
e4b1ef1405 Add "override" to virtual overriden methods 2015-10-13 21:05:36 +03:00
AlexVinS
e82dfb5a85 fixed mantiss 0002254 2015-09-04 18:08:25 +03:00
ArseniyShestakov
21aaad6972 MoveHero: add transit movement option
Transit is new option for hero movement. If it passed for movement then hero can get get on tile without visiting of object on it.
Currently it's will be only allowed is object under destination is teleport.
2015-03-08 17:04:09 +03:00
ArseniyShestakov
25656aa586 Add showTeleportDialog everywhere except actual code for AI and player
Just like TeleportDialog it's based off showBlockingDialog, but as number of package is higher when possible showTeleportDialog will be after other dialogs handling code.
2015-03-08 16:52:50 +03:00
AlexVinS
ca5391cde6 Get rid of handleSpellCasting 2014-11-25 22:00:04 +03:00
AlexVinS
c67887ae58 Use spell mechanics clases in GameHandler 2014-11-25 18:16:14 +03:00
Ivan Savenko
aa0433228a Fixed cheats - sendMesssage will also pass current object.
Workaround-ish but should work. Branch should be fixed now.
2014-09-21 20:35:53 +03:00
Ivan Savenko
78709e223b Breaking things - trying to remove server-side knowledge of selected objects 2014-09-19 00:18:49 +03:00