1
0
forked from 0ad/0ad
Commit Graph

299 Commits

Author SHA1 Message Date
b4626359f5 Provide ScriptInterface CreateObject and CreateArray functions to replace Eval calls following 7c2e9027c2, 1c0536bf08 and later.
Differential Revision: https://code.wildfiregames.com/D2080
Previous version reviewed By: Krinkle
Comments By: historic_bruno, wraitii
This was SVN commit r22528.
2019-07-22 19:35:14 +00:00
ba736916fc Clean up ThreadUtil, use standard C++11 constructs instead of custom ones.
ThreadUtil shipped a scope lock and a mutex implementation, which can be
removed since we now have these in the standard library.
This lets us clean up this header which get included everywhere (through
profiler includes).

Tested By: Angen and Stan
Differential Revision: https://code.wildfiregames.com/D1915
This was SVN commit r22344.
2019-06-06 19:30:48 +00:00
111f850927 Don't let the duplicateplayernames setting break lobbied games (0fd8aa2a77)
Looked at by: elexis
Differential Revision: https://code.wildfiregames.com/D1748
This was SVN commit r22072.
2019-01-28 12:09:42 +00:00
da62d0b149 [NetServer] Split OnInGame function
Reviewed by: elexis
Differential Revision: https://code.wildfiregames.com/D1516
This was SVN commit r22012.
2019-01-03 00:15:31 +00:00
404f2c48b3 Use a banmask for multiplayer matches that have lobby-authentication enabled.
This prevents a lobby player banned by the host from rejoining after
getting a new IP address and changing the rating part of the nickname,
refs #5320, #3241 / 32da740f14, #3549 / 0fd8aa2a77 / D897.

Differential Revision: https://code.wildfiregames.com/D1655
Reproduced By: Hannibal_Barca
This was SVN commit r21918.
2018-10-25 11:58:26 +00:00
78d7702262 Always require lobby authentication for lobby matches, refs #3549 / 0fd8aa2a77 / D897.
This is due to too many oversteppings of the lobby Terms of Use
following JS mods that implemented an UI for players to join lobby games
with arbitrary nicknames or 'replace' / impersonate other players in
lobby games.

Agreed with: user1, Dunedan
Code proofread by: Vladislav
Minor discussions with: Imarok, Hannibal_Barca, smiley, fpre, bb, nani
refs
https://wildfiregames.com/forum/index.php?/topic/24722-improving-mod-security/

This was SVN commit r21877.
2018-08-25 14:34:30 +00:00
9fa1a230cb Prevent hosts that didn't modify C++ code from starting the game without all assigned online players being ready (launchGame(); cheat), refs #4463.
This works in autostartmode because that sets every client to an
observer and still relies on enabled cheats to have players assign
themselves.

This was SVN commit r21854.
2018-07-21 11:58:35 +00:00
f51f78c999 Don't print lobby buddies to mainlog.html, refs D209 / dcf12abe8c.
Differential Revision: https://code.wildfiregames.com/D1563
Comments By: Vladislav
This was SVN commit r21844.
2018-06-06 22:37:20 +00:00
eda236522c Prevent players from disconnecting during the loading screen by increasing the timeout tolerance to 60 seconds for that period, fixes #5163.
The NetClient runs in the main thread, so any part of the loading screen
consuming several seconds makes that client timeout.
This is a workaround because threading the NetClient would have prevent
these timeouts, refs #3700.
Coutnerintuitively, since enet timeout tolerance is proportional to the
latency, the better the connection of the player, the more likely it was
to drop on gamestart.

This problem became very frequent in Alpha 23, at least due to the Aura
bugfix 583b6ec625, AIInterface being particularly slow and that not
having been disabled yet in the loading screen resulting in additional
10 second freezes during the loading screen, even on empty maps, refs
#5200, 8e168f85e6.

Differential Revision: https://code.wildfiregames.com/D1513
Based on patch by: causative
This was SVN commit r21842.
2018-06-06 22:09:38 +00:00
2588682c09 In preparation of D1513, allow the NetClientSession to find out if it's the "Local Client", refs #5163.
For good practice, mention all members in the affected member
initializer list:
Add booelan m_IsLocalClient and u32 m_HostID to the member initializer
list (to not have them undefined, even though they are not read from
until they are set).
Add the strings m_GUID and m_UserName for completeness (even though the
default constructor is already called for strings).
Use nullptr instead of NULL for pointers.

Comments By: Vladislav
This was SVN commit r21841.
2018-06-06 21:17:01 +00:00
43730f15f3 Fix network FSM errors when a client closes the game during the loading screen or rejoin synchronization stage, fixes #4594, refs 3199.
Fix comments claiming to ensure reliability when in reality there is
only a small likelihood of the message being received.

Broken by fa85527baf / refs #2420 which was a preparation for a3e1c68b9a
/ refs #2373, which hence didn't actually work and was circumvented by
9b136a45fc without clarification.
Might have caused #3643.
Differential Revision: https://code.wildfiregames.com/D1557
Reviewed By: Imarok
This was SVN commit r21837.
2018-06-05 14:52:41 +00:00
ee9cf54149 Fix an OOS on rejoin after doubleclicking on the StartGame button, fixes #5199, refs #5162.
Prevents changes to the gamesettings after the game was started, so as
to use the correct map seed when generating the random map terrain for
rejoiners.
D1558 will prevent the UI bug #5206 and FSM error from doubleclicking on
StartGame.

Differential Revision: https://code.wildfiregames.com/D1562
Tested and accepted by: temple
This was SVN commit r21836.
2018-06-05 12:24:30 +00:00
06e2e77349 Report network timeouts and lag warnings to clients that finished the loading screen but are waiting for other clients to finish it.
This allows the host to distinguish clients that are just slower than
everyone else with the loading screen from clients who have most likely
disconnected or crashed already and may be considered to be kicked.
This is especially important for D1513, because that increases the
timeout tolerance to a minute or longer.

Fixes #5193
Differential Revision: https://code.wildfiregames.com/D1546
Reviewed By: causative
This was SVN commit r21832.
2018-06-01 17:35:00 +00:00
4fbe399e07 Save oos_dump.dat too when saving oos_dump.txt.
Saves time to reproduce the binary simstate or provides data that may be
otherwise irreproducible, refs #5162.

Differential Revision: https://code.wildfiregames.com/D1544
Reviewed By: temple
This was SVN commit r21830.
2018-05-29 02:50:33 +00:00
13e1702777 Add missing ScriptInterface includes to
JSInterface_L10n.cpp from d6db5a466d,
JSInterface_Renderer.cpp and JSInterface_GUITypes.cpp from 4b1297b328,
JSInterface_VisualReplay.cpp from b830233498,
JSInterface_Game.cpp from 5f8be8e0c6,
JSInterface_Simulation.cpp from 921c5515a6,
JSInterface_Debug.cpp from d6cb9c845b,
JSInterface_Main.cpp from 486aec18d4, refs #4772,
JSInterface_Mod.cpp where it was incorrectly removed in af03c72f76.

Refs D1470.
Sort includes alphabetically, add recent Coding Convention macro
comments.

This was SVN commit r21789.
2018-04-27 16:48:44 +00:00
f4749a8e2c Simplify GUI g_IsController variable init, equivalent to 100be98215.
Just test if a NetServer is present rather than passing a state boolean
from GUI page to GUI page.

This was SVN commit r21651.
2018-04-04 12:43:25 +00:00
100be98215 Simplify GUI g_IsNetworked variable init.
Just test if a NetClient is present rather than passing a state boolean
from GUI page to GUI page (since 1c0536bf08 or sooner).

This was SVN commit r21650.
2018-04-04 12:20:34 +00:00
0c522edef3 Fixed swapped names in 0fd8aa2a77
Noticed by elexis

This was SVN commit r21534.
2018-03-13 14:55:55 +00:00
0fd8aa2a77 Secure lobby authentication - prevent joins as a different player
Reviewed by: Dunedan, elexis, Itms
Fixes #3549
Differential Revision: https://code.wildfiregames.com/D897
This was SVN commit r21520.
2018-03-12 00:23:40 +00:00
95179c5e46 Don't trigger a NetServerTurnManager debug breakpoint if a modified or unmodified client sends a non-sequential turnnumber.
Disconnect that client.

Refs #3643
Differential Revision: https://code.wildfiregames.com/D1256
Reviewed By: echotangoecho
This was SVN commit r21023.
2018-01-26 23:02:13 +00:00
89e339dd16 Remove VFS cache, because it is less effective and less efficient than the OS cache (and partially redundant with higher level application caches).
Patch By: Sandarac
Discussed with: Philip, echotangoecho, Bezerra
Fixes #4072.
Differential Revision: https://code.wildfiregames.com/D587
This was SVN commit r20639.
2017-12-10 17:33:03 +00:00
30c3b7c3b8 Fix two clang warnings in 61261d14fc reported by leper.
Differential Revision: https://code.wildfiregames.com/D1064
Reviewed By: fcxSanya
Refs #2305

This was SVN commit r20582.
2017-12-04 14:30:38 +00:00
2da6c0ce2a Use default Unicode encoding in source code on Windows.
This change drops MBCS encoding (which was the default for premake4)
except in the Collada project which is entirely written assuming MBCS.

Tested By: wraitii
Differential Revision: https://code.wildfiregames.com/D1069
This was SVN commit r20561.
2017-11-29 20:14:22 +00:00
f7206dc77d More ScriptInterface const.
Reviewed By: elexis; some comments by bb
Differential Revision: https://code.wildfiregames.com/D863
This was SVN commit r20519.
2017-11-25 06:49:58 +00:00
7b93690c76 Fix few typos found with the Debian lintian tool.
Differential Revision: https://code.wildfiregames.com/D973
Differential Revision: https://code.wildfiregames.com/D974
Differential Revision: https://code.wildfiregames.com/D975
Patch By: LudovicRousseau
Reviewed By: Dunedan, bb
This was SVN commit r20369.
2017-10-28 22:34:57 +00:00
66a357f286 The server should choose the guid
Reviewed by: elexis
Differential Revision: https://code.wildfiregames.com/D943
This was SVN commit r20341.
2017-10-24 22:05:24 +00:00
2534010d0f Fix build without precompiled headers.
Refs 21f69ef574.

This was SVN commit r20177.
2017-09-12 22:18:39 +00:00
21f69ef574 Move networking ScriptFunctions to a new JS Interface, refs #4772.
This was SVN commit r20167.
2017-09-12 00:29:10 +00:00
ab7089ad61 Command line option for pid+timestamp in OOS dump, mainlog and interestinglog
Reviewed by: elexis Fixes #3339
Differential Revision: https://code.wildfiregames.com/D51
This was SVN commit r20141.
2017-09-09 13:16:05 +00:00
9defd11440 Pass ScriptInterface as a const ref where possible.
Reviewed By: elexis
Differential Revision: https://code.wildfiregames.com/D739
This was SVN commit r20028.
2017-08-24 00:32:42 +00:00
e7ab22286e Fix the replay menu for people with non-latin characters in their username.
Use OsPath instead of CStr and CStrW where possible,
wstring_from_utf8(OsPath.string8()) to pass printable strings to the
JSAPI,
OsString when opening a filestream and
off_t instead of int for filesizes.

Fixes #4320
Differential Revision: https://code.wildfiregames.com/D518
Reviewed By: Imarok
Tested By: Imarok on Windows, wraitii on OSX
Special thanks to Philip for advice and the lib/path.h fix in
47cc447322.

This was SVN commit r19824.
2017-06-25 14:54:00 +00:00
b19612c31a Fix whitespace and three refs instead of copies in the glooxwrapper/StunClient code identified by leper in 61261d14fc.
This was SVN commit r19741.
2017-06-05 20:44:00 +00:00
61261d14fc STUN + XMPP ICE implementation.
Allows lobby players to host games without having to configure their
router.

Differential Revision: https://code.wildfiregames.com/D364
Fixes #2305
Patch By: fcxSanya.
StunClient based on code by SuperTuxKart, relicensed with approval of
the according authors hilnius, hiker, Auria, deveee, Flakebi, leper,
konstin and KroArtem.
Added rfc5245 (ejabberd) support, a GUI option, refactoring and segfault
fixes by myself.

Tested By: user1, Sandarac, Sestroretsk1714, Vladislav, Grugnas,
javiergodas
Partially Reviewed By: leper, Philip, echotangoecho
This was SVN commit r19703.
2017-06-01 06:33:52 +00:00
a7c09a500d That what leper said. Refs 9ff7ec3465, 31d1536e52.
This was SVN commit r19688.
2017-05-29 02:56:34 +00:00
31d1536e52 Optionally allow late observers for buddies only.
Differential Revision: https://code.wildfiregames.com/D549
Fixes #4528
Reviewed By: fpre
This was SVN commit r19685.
2017-05-28 18:05:08 +00:00
08b23d0164 Sooner network timeout warnings.
Reviewed By: echotangoecho
This was SVN commit r19574.
2017-05-13 22:52:11 +00:00
00c4adfae8 Add missing Hexify call to the OOS dialog in D105 that became required with the hash comparison in JS. Reported by causative.
Differential Revision: https://code.wildfiregames.com/D476
Reviewed By: leper
This was SVN commit r19562.
2017-05-12 08:50:20 +00:00
09e974e1cb Bump year number of files changed this year in the license headers.
This was SVN commit r19503.
2017-05-01 14:28:22 +00:00
37da3b008a Translate the Out-Of-Sync error message and send it to the JS GUI for convenience and future extension.
Add a hint that multiplayer games with AI are currently not supported.

Differential Revision: https://code.wildfiregames.com/D105
Reviewed By: leper
Refs #3858

This was SVN commit r19491.
2017-05-01 04:55:56 +00:00
65cbf12b7e Don't throw NetServer FSM errors if a client presses not-ready just before the host launches the game.
Differential Revision: https://code.wildfiregames.com/D290
Reviewed By: Imarok
Refs #3199

This was SVN commit r19404.
2017-04-10 16:52:52 +00:00
af4466bc99 Update ready state immediately when receiving the message.
Differential Revision: https://code.wildfiregames.com/D304
Reviewed By: Vladislav
Refs #2447

This was SVN commit r19396.
2017-04-09 22:59:04 +00:00
fdda57565b Display which clients are still in the loading screen
Reviewed by: elexis
Differential Revision: https://code.wildfiregames.com/D120
Fixes #4375

This was SVN commit r19320.
2017-03-21 18:50:29 +00:00
e0f7578fbe Ensure unique client GUIDs. Patch by sbirmi, fixes #3949.
Two clients chosing the same GUID is highly unlikely, yet possible.
A malicious client chosing an existing GUID would have resulted in
unassigning the player with that GUID.

This was SVN commit r19225.
2017-02-14 16:54:34 +00:00
5f8f7bae20 Stay ready button
Reviewed by: elexis
Differential Revision: https://code.wildfiregames.com/D49
Fixes #4369.

This was SVN commit r19216.
2017-02-10 16:09:10 +00:00
fd5bd8e301 Fix 9964bee5bb.
Differential Revision: https://code.wildfiregames.com/D100
Reviewed By: Imarok
This was SVN commit r19182.
2017-01-28 20:47:26 +00:00
9964bee5bb Change the NetServer Broadcast function to send the given message to clients that are in one of the states specified by the caller.
Thus remove the peculiarity to broadcast to clients that are in the
gamesetup, loading screen or ingame, but not rejoining ones.

Fix "unknown player" errors in the GUI by broadcasting player
assignments to rejoining players too. Fixes #4036.

Differential Revision: D17
Reviewed By: Imarok
This was SVN commit r19171.
2017-01-25 19:04:17 +00:00
4f01db4831 Split TurnManager classes into individual files per class. Patch by echotangoecho, fixes #4095.
Remove the "Net" prefix from the non-networked classes.
Use variadic macros and mark the client turnmanager as NONCOPYABLE.

Differential Revision: D16
Reviewed By: leper
This was SVN commit r19165.
2017-01-24 02:04:50 +00:00
b18f74da44 Remove trailing whitespace and whitespace in empty lines of source/ except source/third_party/.
This was SVN commit r18987.
2016-11-23 11:18:37 +00:00
44f0929ea6 Don't throw FSM update errors (type=16 state=6) when kicking clients while others haven't finished the authentication, loading screen or synchronization yet, refs #3241.
This was SVN commit r18859.
2016-10-23 15:44:02 +00:00
20399b72f1 Fix a bug where the networked game would never start if a client would disconnect while synchronizing, fixes #4289.
This was SVN commit r18858.
2016-10-23 15:13:16 +00:00