summaryrefslogtreecommitdiff
path: root/src/network/network.cpp
AgeCommit message (Collapse)Author
2021-01-05Change: move "give money" from client-list to company windowPatric Stout
This is a much better location for this button, as you send money from one company to another company, not from player to player. This is based on work done by JGRPP in: https://github.com/JGRennison/OpenTTD-patches/commit/f82054339124cc6b89c5f4f9dac2d9da62f0108b and surrounding commits, which took the work from estys: https://www.tt-forums.net/viewtopic.php?p=1183311#p1183311 We did modify it to fix several bugs and clean up the code while here anyway. The callback was removed, as it meant a modified client could prevent anyone from seeing money was transfered. The message is now generated in the command itself, making that impossible.
2020-12-27Codechange: Replace assert_compile macro with static_assertCharles Pigott
2020-12-22Change: [Linkgraph] Pause the game when linkgraph jobs lag (#6470)Jonathan G Rennison
Check if the job is still running two date fract ticks before it is due to join, and if so pause the game until its done. When loading a game, check if the game would block immediately due to a job which is scheduled to be joined within two date fract ticks, and if so pause the game until its done. This avoids the main thread being blocked on a thread join, which appears to the user as if the game is unresponsive, as the UI does not repaint and cannot be interacted with. Show if pause is due to link graph job in status bar, update network messages. This does not apply for network clients.
2020-12-15Add: support for emscripten (play-OpenTTD-in-the-browser)Patric Stout
Emscripten compiles to WASM, which can be loaded via HTML / JavaScript. This allows you to play OpenTTD inside a browser. Co-authored-by: milek7 <me@milek7.pl>
2020-02-23Codechange: Limit field width to avoid sscanf crashQuipyowert2
2020-02-04Feature #7756: Allow server to supply a reason to kicked/banned clientsBjarni Thor
This commit adds the missing feature of allowing the server owner to provide a reason for kicking/banning a client, which the client sees in a pop-up window after being kicked. The implementation extends the network protocol by adding a new network action called NETWORK_ACTION_KICKED that is capable of having an error string, unlike the other network error packages. Additionally, the kick function broadcasts a message to all clients about the kicked client and the reason for the kick.
2019-12-21Fix: unused variable warningsglx
2019-12-21Codechange: Replace network related FOR_ALL with range-based for loopsglx
2019-11-10Cleanup: Removed SVN headersS. D. Cloudt
2019-04-10Codechange: Use null pointer literal instead of the NULL macroHenry Wilson
2019-04-09Codechange: If something is a vector of strings, use a vector of strings ↵Michael Lutz
instead of an AutoFreeSmallVector.
2019-03-26Codechange: Replaced SmallVector::[Begin|End]() with std alternativesHenry Wilson
2019-03-26Codechange: Replaced SmallVector::Append() with ↵Henry Wilson
std::vector::[push|emplace]_back()
2019-03-26Codechange: Replace SmallVector::Length() with std::vector::size()Henry Wilson
2019-03-24Codechange: Use override keyword in networking classes.peter1138
2019-03-20Remove: ENABLE_NETWORK switchPatric Stout
This switch has been a pain for years. Often disabling broke compilation, as no developer compiles OpenTTD without, neither do any of our official binaries. Additionaly, it has grown so hugely in our codebase, that it clearly shows that the current solution was a poor one. 350+ instances of "#ifdef ENABLE_NETWORK" were in the code, of which only ~30 in the networking code itself. The rest were all around the code to do the right thing, from GUI to NewGRF. A more proper solution would be to stub all the functions, and make sure the rest of the code can simply assume network is available. This was also partially done, and most variables were correct if networking was disabled. Despite that, often the #ifdefs were still used. With the recent removal of DOS, there is also no platform anymore which we support where networking isn't working out-of-the-box. All in all, it is time to remove the ENABLE_NETWORK switch. No replacement is planned, but if you feel we really need this option, we welcome any Pull Request which implements this in a way that doesn't crawl through the code like this diff shows we used to.
2019-02-12Fix: Do not mangle tagged revision strings for network revision stringsNiels Martin Hansen
2019-02-03Change: Make a shortened network revision string for use in server queriesNiels Martin Hansen
2015-09-19(svn r27400) -Fix [FS#6368] (r26449): when a dedicated server was paused ↵rubidium
with no clients the tick length was increased significantly, making any assumptions about the tick length used further down in the code are not true anymore. One of such assumptions was that one should readvertise every 15 minutes worth of original ticks, but due to the lengthening this timeframe would be more like 45-60 minutes. Now we'll take the operating system's millisecond counter instead
2014-09-07(svn r26788) -Add: Desync replay option to skip/replay failed commandsfrosch
2014-09-07(svn r26786) -Fix: Also replay failed commands.frosch
2014-05-11(svn r26577) -Fix [FS#6001]: [Network] Client of non-dedicated server was ↵rubidium
not correctly put into the first company for all state variables
2014-04-25(svn r26509) -Codechange: replace strdup with stredup (the latter ensures ↵rubidium
the return is not NULL)
2014-04-23(svn r26486) -Codechange: replace a number of snprintfs with seprintfrubidium
2014-04-23(svn r26482) -Codechange: add an include that allows us to undefine/redefine ↵rubidium
"unsafe" functions to prevent them from being used, and thus having to care about certain aspects of their return values
2014-04-08(svn r26449) -Add: Allow more sound sleep for dedicated servers when there's ↵planetmaker
nothing to do and nobody paying attention
2013-11-14(svn r25997) -Codechange: make it slightly more clear what ports are coming ↵rubidium
from where in the debug output when listening
2013-01-08(svn r24900) -Fix [FS#5389]: Comments with typos (most fixes supplied by ↵planetmaker
Eagle_rainbow)
2012-01-09(svn r23780) -Fix [FS#4963] (r23764): also name the two new errors ↵truebrain
server-side. As extra, split up one of the errors in 3 errors, to be more specific what goes wrong. As cherry on top, make sure on all sides we can never again forget to add such entries on both sides, by introducing an assert_compile()
2012-01-04(svn r23751) -Codechange: rename NetworkUDPGameLoop to a more descriptive ↵rubidium
name, and move the UDP specific bits to network_udp
2012-01-03(svn r23740) -Codechange: remove some 300 unneeded includes from the .cpp filesrubidium
2011-12-19(svn r23618) -Add: ScriptGame::Pause, ScriptGame::Unpause, and ↵truebrain
ScriptGame::GetLandscape (GameScript only)
2011-12-19(svn r23601) -Fix: fix the conflict in window numbertruebrain
2011-12-10(svn r23476) -Codechange: use the error queue to replace switch mode error ↵rubidium
strings, again making it possible to return multiple errors
2011-09-15(svn r22934) -Fix [FS#4771]: prevent authentication bypass for the admin ↵rubidium
port when a new game is started
2011-08-13(svn r22738) -Fix [FS#4722] (r21854): Setting company passwords via the GUI ↵frosch
on servers (including starting a company with the default password) failed, so no client could join.
2011-07-30(svn r22696) -Fix: don't requery the servers when the server list window ↵rubidium
isn't opened
2011-05-05(svn r22424) -Document: some more bitsrubidium
2011-05-04(svn r22423) -Document: some network stuffrubidium
2011-04-22(svn r22368) -Codechange: move the IP address field from the ClientInfo to ↵rubidium
ClientSocket
2011-04-22(svn r22363) -Codechange: NetworkFindClientStateFromClientID -> ↵rubidium
NetworkClientSocket::GetByClientID
2011-04-22(svn r22362) -Codechange: NetworkFindClientInfoFromClientID -> ↵rubidium
NetworkClientInfo::GetByClientID
2011-02-19(svn r22116) -Codechange: use PoolBase::Clean() at more placessmatz
2011-02-08(svn r22032) -Codechange: add some asserts to verify we don't allocate too ↵rubidium
many NetworkClientSockets/Infos
2011-01-19(svn r21854) -Codechange: refactor the password setting methods to make it ↵rubidium
possible to change the password of other companies (on the server)
2011-01-19(svn r21853) -Codechange: HashCurrentCompanyPassword is only used by ↵rubidium
servers, so move it to network_server.* (dihedral)
2011-01-19(svn r21852) -Codechange: generalise GenerateCompanyPasswordHash (dihedral)rubidium
2011-01-19(svn r21851) -Codechange: rename NetworkClientSetPassword to ↵rubidium
NetworkClientSetCompanyPassword (dihedral)
2011-01-19(svn r21850) -Codechange: move password hashing to a more general location ↵rubidium
(dihedral)
2011-01-03(svn r21701) -Codechange: ConsoleColour = TextColour, so make it that way ↵rubidium
and remove some unneeded casts