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

1174 Commits

Author SHA1 Message Date
Arseniy Shestakov
7ae4e70134 CGameHandler: fix player id logging 2016-09-17 00:05:10 +03:00
Arseniy Shestakov
ea65fb15c2 CVCMIServer: do not crash if port not specified 2016-09-16 20:01:07 +03:00
Arseniy Shestakov
fe6c0cf89b Use RandomGeneratorUtil::randomShuffle for reproducible gameplay 2016-09-11 00:10:52 +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
70abae9b51 CGameState::battleGetBattlefieldType: use RNG by ref
For now I not sure about proper place for battleGetBattlefieldType so I left it in GS
2016-09-09 23:16:43 +03:00
Arseniy Shestakov
ea63497b19 Move CGameState::setupBattle code to CGameHandler::setupBattle
No reason to keep this code in GS.
2016-09-09 23:16:43 +03:00
Arseniy Shestakov
53502e84e3 Add PrepareHeroLevelUp netpack to keep secondary skills RNG in sync 2016-09-09 23:16:43 +03:00
Arseniy Shestakov
ca819b3cda CGHeroInstance::nextPrimarySkill: don't use GS RNG directly
Code used from both GS and CGameHandler.
2016-09-09 23:16:42 +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
85f49bc968 CGHeroInstance::initArmy: don't use GS RNG. Get RNG through a ref
This function used by both server-side and gamestate so it's must use appropriate random source.
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
Arseniy Shestakov
6747555339 CGameHandler: use ObjProperty enum instead of magic numbers 2016-09-09 17:42:16 +03:00
Arseniy Shestakov
d06d07a39b Add ChangeFormation netpack to avoid MP desyncs
Previous code was working fine for single client, but would cause desync in multiplayer. Fix issue 2460.
2016-09-08 19:29:15 +03:00
AlexVinS
85f94676a5 Server: convert logging 2016-08-30 01:13:07 +03:00
Alexander Shishkin
5e5ce0bb09 Merge pull request #203 from vcmi/logFormat
boost::format support for CLogger
2016-08-29 17:32:44 +04:00
Arseniy Shestakov
abad3cfb17 PlayerState::daysWithoutCastle: change in netpacks only. Fix issue 2462
Moving code from CGameHandler to NetPacksLib without changes.
2016-08-23 08:02:04 +03:00
AlexVinS
439aeecc8b [c::b] re-enabled PCH, tested with GCC 5.3. (Older versions may not work) 2016-08-18 13:40:35 +03:00
Arseniy Shestakov
948cca02cc Fixes to some crashes on exit and to have cleaner valgrind output 2016-08-18 06:52:10 +03:00
Arseniy Shestakov
39fe9472b6 CGameHandler::moveArtifact: check lock status by slot instead of id
This one fix issue 2455. We still need to do something with ArtifactID::ART_LOCK or ids for artifact from mods since they might conflict with each other.
2016-08-18 06:35:29 +03:00
AlexVinS
e7f2858d33 Use make_unique for TurnInfo in CGameHandler.
* Fixes use after free @CGameHandler.cpp:2093
2016-08-17 08:53:36 +03:00
Arseniy Shestakov
b0045fa357 Fix TurnInfo memory leaks 2016-08-16 15:47:21 +03:00
AlexVinS
36c44c2ce7 projects update 2016-08-13 16:57:11 +03:00
AlexVinS
72f79a3ad7 Draft boost::format based log proxy. 2016-08-13 16:57:09 +03:00
Arseniy Shestakov
2e70d29479 CGameHandler::applyBattleEffects: improve Fire Shield support
Now damage is limited to total health of defending stack and clone have no file shield damage. In same time damage calculation is likely remain incorrect.
2016-03-14 15:28:17 +03:00
Arseniy Shestakov
605962019b CGameHandler::giveSpells: improve Conflux grail building support
Aurora Borealis give hero spells of all levels even if only first level of mages guild is built. Widsom requirement is still remain in place of course.
2016-03-13 13:26:00 +03:00
Arseniy Shestakov
bee0c6d705 CGameHandler::buildStructure: give spells after gs apply. Fix issue 2425
Hero will also immidiately get new spells when Library built in Tower or Grail in Conflux.
2016-03-13 11:31:09 +03: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
e3e27b9bfe Move ghost creation to inner battle loop 2016-03-01 11:07:45 +03:00
AlexVinS
4bf9036c7b Ensure that ghost stacks are created only by BattleStacksRemoved packet.
This will allow client to receive notification.
2016-03-01 05:24:35 +03:00
AlexVinS
2c48c95c8d Fix casualties calculation for commander 2016-03-01 04:06:32 +03:00
AlexVinS
f890037008 Fixes 2016-02-29 04:42:15 +03:00
AlexVinS
5df8d1cbd0 Update low level battle stacks accessor for ghost selection support. 2016-02-28 05:10:20 +03:00
AlexVinS
9036d39241 Do not remove battle stacks, make them ghosts instead.
* exclude ghost stacks from (hopefully all) get* results for now
2016-02-28 01:08:56 +03:00
AlexVinS
5d5ad99436 Rename DEAD_CLONE -> GHOST, as this will be possible for any stack 2016-02-28 00:13:34 +03:00
Arseniy Shestakov
f8c6751707 CGameHandler::endBattle: change town ownership when hero lost siege 2016-02-22 03:35:38 +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
11dc428b1e Battles: move hexes enum to GameConstants and fix wall position
Before we had hex 62 marked as destructible wall while actually it's must be 78.
2016-02-09 17:38:59 +03:00
Arseniy Shestakov
01b4d0ae01 Battles: better handling for walking double-wide creatures
Request opening of gate even if only second half of double-wide stack going to stop on it.
2016-02-09 15:41:37 +03:00
Arseniy Shestakov
a07761b608 Battles: readable identifiers enum for drawbridge and gate hexes
Dont like to locate them in BattleHex, but it's best place I can see so far.
2016-02-09 12:25:13 +03:00
Arseniy Shestakov
731de439eb Battles: drawbridge support for double-hex flying creatures 2016-02-09 11:59:20 +03:00
Arseniy Shestakov
28aff78f2c Battles: implement drawbridge support for flying creatures 2016-02-09 11:30:09 +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
47433919ab Battles: handle drawbridge lowering from stack start position 2016-02-09 10:45:59 +03:00
Arseniy Shestakov
015a57f81c Battles: more advanced drawbridge mechanics on server-side
Everything work as intended except starting point not included in path.
So we send BattleDrawbridgeStateChanged package when already standing on bridge hex.
2016-02-08 12:16:47 +03:00
ArseniyShestakov
890ae43f55 Merge pull request #180 from Zyx-2000/FileInfo
Refactored CFileInfo & ResourceID
2016-02-08 04:55:39 +03:00
ArseniyShestakov
7f68124b97 Merge pull request #136 from vcmi/issue/1372-2
issue/1372
2016-01-31 20:28:54 +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
Vadim Markovtsev
918fbd8530 Refactor hero's mana regain 2016-01-30 13:51:07 +03:00
Vadim Markovtsev
22fc4fd3e9 Fix 2406 reset potentially available heroes 2016-01-30 10:02:33 +03:00