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

425 Commits

Author SHA1 Message Date
Ivan Savenko
383387ef29 Integrated defaultMods into mod system 2023-03-16 17:55:09 +02:00
Konstantin
4c4498b22a vcmi: modernize rest of lib 2023-03-16 17:55:20 +03:00
Adriankhl
18be7d5261 Remove redundant client access to server save game files and redundant includes 2023-03-13 12:27:13 +01:00
Adriankhl
113527c80c Fix paths deserialization 2023-03-13 11:04:06 +01:00
Adriankhl
eba4e4dd2c No longer save/load common game state to/from client file 2023-03-13 10:10:44 +01:00
Adriankhl
f054064322 Load client data (e.g. sleepingHeroes) from local file if possible 2023-03-12 21:54:51 +01:00
Ivan Savenko
cdcd5a29dd Updated path to renamed directory 2023-03-05 18:02:59 +02:00
Ivan Savenko
ec6f19ea18 Code reorganization, no changes to functionality 2023-03-05 17:48:02 +02:00
Ivan Savenko
4501036a04 Basic version of hero movement on map. Removed old code. 2023-03-05 17:48:02 +02:00
Andrey Filipenkov
c4e7e91850 fix single process build for Android 2023-03-02 12:09:48 +03:00
Andrey Filipenkov
5b1f3bf0db use JNIEnv object from SDL instead of forwarding from Java for Client 2023-03-02 12:09:47 +03:00
Andrii Danylchenko
9f55666931 rework netpacks to avoid double typeinfo 2023-02-13 20:26:39 +02:00
Ivan Savenko
108a42e4ba Reorganized includes for new layout. New class - IImageLoader 2023-02-01 20:42:06 +02:00
Ivan Savenko
57ee9a9bf3 Merge vcmi/beta into vcmi/develop 2023-01-29 18:21:55 +02:00
Andrii Danylchenko
4cfc93d2da Somehow it works but JNI signatures were incorrect 2023-01-25 08:59:59 +02:00
Ivan Savenko
fc0f5a9fb3 Reduced SDL includes 2023-01-20 16:11:43 +02:00
Dydzio
e593b61201 Merge branch 'develop' into client-commands-improvements 2023-01-16 01:13:06 +01:00
Ivan Savenko
246281e62a Merged vcmi/beta with vcmi/develop 2023-01-15 17:46:42 +02:00
Dydzio
b5a1b178d9 Explicitly call reset on shared_ptr for potential readability boost 2023-01-15 01:18:35 +01:00
Dydzio
cb3fd24ec0 Fixes after merge, move removeGUI to Client class 2023-01-11 17:11:44 +01:00
Andrii Danylchenko
9f9798d3a4 Update android JNI bindings 2023-01-07 09:26:01 +02:00
Ivan Savenko
5d80457eda Merge with vcmi/develop branch 2022-12-30 00:52:23 +02:00
Ivan Savenko
eb20a4b208 Merge remote-tracking branch 'vcmi/develop' into warnings_fix 2022-12-23 14:40:45 +02:00
Ivan Savenko
c835a84051 Moved all GUI handling from BattleInterface to BattleControlPanel 2022-12-21 17:02:53 +02:00
Ivan Savenko
4d628a8ba1 Fixed several assertion failures on shutting down game 2022-12-16 16:19:57 +02:00
Ivan Savenko
c855823528 Renamed files in client/battle to match new names of classes 2022-12-09 13:38:46 +02:00
Ivan Savenko
3f9a0a855e Renamed most of classes in client/battle directory to match current code
style
2022-12-09 13:26:17 +02:00
Ivan Savenko
facf77b3ae vstd::unique -> std::unique 2022-12-07 23:36:20 +02:00
Ivan Savenko
2855606a88 Enabled & fixed -Woverloaded-virtual warning from gcc/cland
- fixed almost all instances of overloaded-virtual warning
- cleared up inheritance & method overrides in code affected by warning
2022-12-07 21:50:45 +02:00
nordsoft
628abd1428 Fix campaign serialization 2022-10-03 01:48:03 +04:00
nordsoft
3621b05682 Rename variable 2022-09-30 18:28:17 +04:00
nordsoft
8a8716ce8a Pass loaded game over network too 2022-09-29 21:33:44 +04:00
nordsoft
7ee4fca120 Pass whole gamestate over network 2022-09-28 23:15:05 +04:00
Andrey Filipenkov
7e6ed0583c disable all scripting code when configuring without scripting modules 2022-09-21 19:31:42 +03:00
Nordsoft91
aaa07e4d2e New terrain support - part 1 (#755)
Initial support of new terrains
2022-09-11 11:31:26 +03:00
Andrii Danylchenko
4defbc314a Fix saves when some humans become AI. (PlayerInterface destructor clears LOCPLINT) 2022-03-21 09:38:14 +02:00
Dmitry Orlov
30b879ae5d Fixed: duplicated bonusing building. Improved: opposite bonus propagation 2021-09-12 14:30:54 +03:00
Dmitry Orlov
25d9ea1ddf Feature: Opposite Side Limiter 2021-09-04 14:15:38 +03: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
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
Zsolt Sz. Sztupák
3c5194a232 Add support for the Android App to notify if the server has been closed
When winning the campaign there is a lock that waits for the old server to stop before allowing to continue with restarting the server. While the lock was released on PC builds as the server runs differently on Android this was missed making campaigns always hang the app when you win.

This change adds a new native method that can be called from the Android app to signal that the server has stopped, so the client can continue with requesting a new server and showing the new campaign scenatio screen.

Note: this change alone doesn't fix the bug but it's required for a fix on vcmi-android's side. It doesn't break anything and can be merged before the vcmi-android changes
2020-01-06 16:43:02 +00:00
AlexVinS
4b5910c2f4 VCAI performance improvements
* Node graph initialization optimized.
* Fixed "Unathorized obstacle access".
* Pathfinding tracing disabled with ifdef.
* Misc bonus calculation optimizations.
* Removed timestamp from log lines. Date formatting eats too much CPU.
* Paths for all heroes in Client are now cached
2019-01-17 10:50:56 +03:00
godric3
7ded9dbda8 Fix crash when generating random map with random number of players 2018-10-27 18:18:08 +02:00
Alexander Shishkin
75f8c8b29a Gui cleanup4 (#446)
* use smart pointers for almost all widget fields
* use SDL2 texture for cursor
* a lot af small tweaks and formatting
* removed CompImage class, it is actually useless as long as regular SDLImage support margins
* CGuiHandler: use smart pointers for [push|pop]Int
2018-07-25 01:36:48 +03: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
Arseniy Shestakov
324717acbe Spelling fixes: privilaged -> privileged, retreive -> retrieve 2018-02-10 21:52:23 +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
fc3b8b2c87 Refactoring: replace macro with variadic templates on client-side
Big thanks to @mwu-tow for helping me with this.
2018-02-05 08:14:01 +03:00
Arseniy Shestakov
da117e9255 Code style: remove void from constructors without arguments 2018-01-13 11:51:47 +03:00
AlexVinS
805b5215de Client threading tweak 2017-11-16 14:15:43 +03:00
Arseniy Shestakov
ec2bef40fb CServerHandler: avoid crash without interprocess memory
Even if shared memory wasn't disabled we shouldn't crash without it.
It's important because Snap packages don't have access to /dev/shm.
2017-09-18 10:46:58 +03:00
Arseniy Shestakov
c3e6195cc9 CServerHandler: one more small fix when server is crashed 2017-08-13 23:17:56 +03:00
Arseniy Shestakov
9c7c47c754 CServerHandler: for now don't stop client if server crashed
Currently server stable enough and only crash on shutdown.
It's certainly more annoying to crash on end of game than get freeze.
Unfortunately it's crash on shutdown almost every time on macOS.
2017-08-13 23:09:23 +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
64d9dadd64 Logging cleanup. 2017-08-11 15:47:50 +03:00
AlexVinS
143ff682bc Logging cleanup 2017-08-10 21:59:55 +03:00
AlexVinS
61e241308d Logging cleanup 2017-08-10 19:52:05 +03:00
ArseniyShestakov
9d9c026c85 Code style: serialize everything on own lines for easier debugging (#357) 2017-07-31 16:35:42 +03:00
ArseniyShestakov
b52cfe5283 Code style: use parentheses for creating heap-based objects (#344) 2017-07-16 12:58:05 +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
AlexVinS
09df2dcfbb fixed possible race condition 2017-07-12 19:40:14 +03:00
AlexVinS
2c525fc76e Attempt to fix headless tests crash. 2017-07-12 17:02:25 +03:00
ArseniyShestakov
5dfb7a5771 Merge pull request #317 from vcmi/attackerOwned
Refactored CStack::attackerOwned to CStack::side
2017-07-03 16:19:54 +03:00
Arseniy Shestakov
c059f95e2e CClient::loadGame: pass correct save version for BinaryDeserializer
Fix loading crashes that appear after duel mode removal.
2017-07-03 05:11:58 +03:00
AlexVinS
4f8c7bd4bb CStack refactoring
* removed all occurrences of attackerOwned
* Use BattleSide enum
* more tweaks
2017-07-01 19:17:08 +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
ArseniyShestakov
bd27636cd9 Merge pull request #316 from FeniksFire/improvingTheBattle
Refactoring.
2017-06-28 19:55:03 +03:00
FeniksFire
4113bdab01 Moving some files from lib to the battle subdirectory. 2017-06-26 15:26:08 +02:00
Arseniy Shestakov
eeff7ee315 Few minor code improvements
* All command line options now case insensetive.
* SDL_VIDEO_X11_DGAMOUS unused in SDL2 so it's removed.
* Added current year into the --help output for client and server.
* Moved DO_NOT_START_SERVER into session settings.
2017-06-26 04:56:28 +03:00
Arseniy Shestakov
1a60c1a94b Shared memory refactoring and command line control options
Now client accept following options:
 --disable-shm - disable shared memory usage
 --enable-shm-uuid - use UUID for shared memory identifier
UUID is useful when a lot of clients starting simultaneously.
Needed for testing and was easier to implement than alternatives.
2017-06-06 07:30:16 +03:00
Arseniy Shestakov
a2284c3209 Automated testing: graceful shutdown for when game is ended
Before when CloseServer / LeaveGame applied there was no thread sync on server.
Now server use std::atomic bool for synchronization and graceful shutdown.
2017-06-06 07:30:16 +03:00
Arseniy Shestakov
18161d3688 Client: implement spectator mode via command-line options
If running with --spectate/-s CPlayerInterface will appear even without human players.
Following command-line options also available:
 --spectate-ignore-hero
 --spectate-hero-speed=N
 --spectate-battle-speed=N
 --spectate-skip-battle
 --spectate-skip-battle-result
Boolean options can also be changed in runtime via client console:
 set spectate-ignore-hero on / off
Spectator mode also:
 - Work with --onlyAI option when starting game or loading saves.
 - Allow to use any cheat codes.
 - Give recon on towns and heroes.
2017-06-06 07:30:16 +03:00
Arseniy Shestakov
d95c74941b Client: add onlyAI option support for saved games
When --onlyAI option used all human players will be replaced with AIs during loading.
2017-06-06 07:30:16 +03:00
Arseniy Shestakov
f7f7fe1d32 Client: fix headless mode and add automated testing mode
Command-line option --noGUI replaced with --headless.
Added option --testmap that will run specified map with AI players
2017-06-06 07:30:16 +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
Arseniy Shestakov
6642816b1e Client: server port and testing options cleanup
Now we only pass port as ui16 instead of std::string
2017-06-04 08:49:23 +03:00
Arseniy Shestakov
4b0f702e7e Add LeaveGame netpack and avoid replying on it and CloseServer 2017-06-02 02:51:44 +03:00
Arseniy Shestakov
c7e7a4d7be Make usage of boost::interprocess optional
If shared memory allocation failed on client server will be started without shared memory option.
Only downside of this is that server wouldn't be able to fallback to random port if default is busy.
2017-06-02 02:44:41 +03:00
Arseniy Shestakov
cc163c4e05 Refactoring of networking code on server and client
* Avoid server crash on dummy connect / disconnect.
* Avoid server crash when host left from PreGame.
* Server print it's state with name when it's waiting for connection or in pregame.
* Server will use random port if specified port is busy.
2017-06-02 02:44:39 +03:00
Arseniy Shestakov
db5a52a0f8 Multiplayer: gracefully handle player loss unless it's a host
We don't want server to shutdown after just one of players lost the game.
2017-05-31 08:04:26 +03:00
Fay
b5daa24982 Android support (#299)
* AI libs registering shenanigans on android;
* Fixed resolution aspect + mouse event scaling;
* Proper server init/deinit (through android IPC);
Enabled threaded init in CMT;
* Prevented a deadlock in logger on some devices;
* Fixed frozen intro frame after interrupting the video;
Added android progressbar displaying during initial data loading;
* Hacky fix for choppy animations during heroes movement (should look better now, but it's definitely not a good solution);
* Changes/fixes for new android launcher building process;
* Fixed app hang after getting SDL_QUIT when activity was destroyed;
* Functioanal, configurable advmap swiping support;
* VCMI changes cleanup;
Added few missing VCMI_ANDROID guards on swipe mechanics;
* Removed unneeded sleep in server startup code for android;
* Removed android ioapi hack (fixed in newest ndk);
* Removed unused android's library loading logic;
* Added android's swipe option to settings schema;
* Moved NO_STD_TOSTRING to be defined in global.h instead of build files;
2017-05-25 20:57:20 +03:00
Dydzio
88952aefff Restart button fix (#288) 2017-03-19 16:58:46 +03:00
FeniksFire
3de891b4b4 Moving/dividing classes from BattleState to separate files. 2017-03-17 16:48:44 +01:00
AlexVinS
d003abea6f Fixed CID 1197624 2016-12-05 02:52:34 +03:00
AlexVinS
80666fb134 Tweaks 2016-11-25 22:12:22 +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
Ivan Savenko
256f43f467 Fixes zero-initialized fileVersion member in deserializer 2016-10-29 19:52:19 +03:00
Vadim Markovtsev
ab7a0d64eb Fix formatting 2016-10-28 23:37:20 +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
4bcc43d3d0 Fix Mantis #2234
CPlayerInterface instances were removed from CClient::playerint with
clear() and finish() was not called on each. Added multiple insurance.
2016-10-22 16:22:00 +02:00
Vadim Markovtsev
34cf92cb9b Change logging style 2016-10-03 20:32:01 +02:00
Vadim Markovtsev
eac5aab396 Survive client<->server ABI mismatch 2016-10-02 22:45:00 +02:00
Arseniy Shestakov
f721d22dfb CClient::loadGame: throw proper error if server save is missing 2016-09-19 04:56:20 +03:00
Arseniy Shestakov
1cbe9e1b8b Client: add donotstartserver option. Alternative way to start a game
Option is useful for server profiling also let me test MP over network and much more.
Also there is issues with boost::interprocess on some systems under Windows and this is the way to bypass them.
2016-09-16 20:01:44 +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
a90b657b86 Add reset to some static variables on client 2016-08-25 15:52:20 +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