Commit Graph

31 Commits

Author SHA1 Message Date
Patric Stout 1ef4d3cf19
Remove: COMPANY_INFO packets and related code (#9475) 2021-08-14 23:24:02 +02:00
Patric Stout a403653805
Codechange: [Network] split CloseSocket and CloseConnection more clearly (#9261)
* Codechange: [Network] split CloseSocket and CloseConnection more clearly

- CloseSocket now closes the actual OS socket.
- CloseConnection frees up the resources to just before CloseSocket.
- dtors call CloseSocket / CloseConnection where needed.
2021-05-13 11:46:51 +02:00
Rubidium 187a3f20bf Codechange: remove pointless close call due to resolving virtual functions statically in destructors
In the destructors of many of the network related classes Close() is called, just like the
top class in that hierarchy. However, due to virtual functions getting resolved statically
in the destructor it would always call the empty Close() of the top class.
Document the other cases where a virtual call is resolved statically.
2021-05-13 10:03:26 +02:00
Patric Stout 36e22f3a7b
Fix: [Network] clients leaving because of broken connections was not broadcasted (#9238)
The code mixed up "client has quit but we already told everyone"
with "client lost connection, handle this".

Split up those two signals:
- CLIENT_QUIT means we told everyone and the connection is now dead
- CONNECTION_LIST means we should tell everyone we lost a client
2021-05-11 12:26:16 +02:00
Patric Stout cb2ef1ea4b Codechange: move all NetworkGameInfo related functions to a single file
It currently was a bit scattered over the place. Part of
NetworkGameInfo is also the GRF Identifiers that goes with it.
2021-04-27 20:18:53 +02:00
S. D. Cloudt 13cc8a0cee Cleanup: Removed SVN headers 2019-11-10 17:59:20 +00:00
Patric Stout e3c639a09f Remove: ENABLE_NETWORK switch
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-03-20 19:24:55 +01:00
planetmaker c24374f99c (svn r24900) -Fix [FS#5389]: Comments with typos (most fixes supplied by Eagle_rainbow) 2013-01-08 22:46:42 +00:00
alberth 7303f7d199 (svn r21595) -Codechange: Some header files had their name changed, update the ifndef/define/endif lines. 2010-12-22 11:46:41 +00:00
rubidium 54f3e04590 (svn r21418) -Fix: core.h needs config.h 2010-12-06 11:53:05 +00:00
rubidium 9139a6c858 (svn r21405) -Codechange: prepare sending of company information in the UDP packet for longer company names (in bytes), by truncating the names if needed 2010-12-05 22:21:13 +00:00
rubidium b6c2216749 (svn r21358) -Codechange: make some network function names conform to coding style 2010-11-30 13:38:46 +00:00
rubidium 82fc28f77f (svn r18809) -Codechange/Cleanup: remove unneeded headers from some files, if a header require a header make it include that header 2010-01-15 16:41:15 +00:00
rubidium 5ff6053326 (svn r17699) -Codechange: move #ifdef ENABLE_NETWORK till after the 'generic' includes so compilation without network support doesn't get broken as easily by changes in header files 2009-10-04 20:00:56 +00:00
rubidium 7fbc33dae1 (svn r17248) -Fix: add GPL license notice where appropriate 2009-08-21 20:21:05 +00:00
rubidium 9b156c1bd4 (svn r16601) -Fix [FS#2880]: try 2... hopefully better this time 2009-06-19 20:26:18 +00:00
rubidium 2a6e9288fd (svn r15971) -Codechange: make it possible for UDP socket handlers to bind to multiple sockets. 2009-04-07 20:27:13 +00:00
rubidium 22d9306889 (svn r15967) -Codechange: do not access NetworkSocketHandler::has_quit directly 2009-04-07 18:23:14 +00:00
rubidium e18c24cdb5 (svn r15079) -Codechange: split tcp 'backend' and in-game handling like it is for UDP. 2009-01-14 12:50:13 +00:00
rubidium abc903d625 (svn r14712) -Codechange: split server and client side w.r.t. the storage of network related company information. 2008-12-22 18:40:57 +00:00
rubidium 2f3b88ef9a (svn r13343) -Codechange: reorder/move variable/functions in the network headers so that nothing from the network directory needs to include basically all network headers. 2008-05-30 18:20:26 +00:00
rubidium 24c4d5b06d (svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {}; 2007-03-07 12:11:48 +00:00
rubidium 36bb92ae24 (svn r9050) -Codechange: Foo(void) -> Foo() 2007-03-07 11:47:46 +00:00
celestar 0ed4b64e64 (svn r8857) -Documentation: Added some doxygen @file tags, repaired others (the @file tag MUST be found before any line of code, that includes preprocessor directives). 2007-02-23 08:37:33 +00:00
KUDr f9462a50e9 (svn r8479) -Fix (r8459): Silenced VC warning C4099: 'Packet' : type name first seen using 'class' now seen using 'struct'
-Codechange: 'typedef struct Packet' changed to 'struct Packet'
2007-01-31 09:51:22 +00:00
rubidium 86b046864a (svn r8461) -Feature: check for NewGRF compatability before actually downloading the map from a game server when connecting from the command prompt and internal console. 2007-01-30 17:22:56 +00:00
rubidium 291b7925ee (svn r8459) -Codechange: move (Send|Recv)GRFIdentifier to NetworkSocketHandler, so it can also be used the TCP socket handler. 2007-01-30 17:12:46 +00:00
rubidium f72dde5236 (svn r8445) -Cleanup: remove some @params from comments as the parameters did not exist anymore and add comments to several variables/functions. 2007-01-28 20:47:25 +00:00
rubidium f66b373b52 (svn r8083) -Codechange: make a NetworkSocketHandler as base for all sockets and move a little of NetworkClientState functionality to the NetworkSocketHandler. Move the rest of the NetworkClientState to the new NetworkTCPSocketHandler class/struct, which is not yet implemented in an object oriented manner. The UDP socket handler now extends the NetworkSocketHandler instead of having a reference to a NetworkClientState. 2007-01-12 20:19:49 +00:00
rubidium 85d1768b34 (svn r7830) -Codechange: let NetworkCoreInitialize return a bool, so we have to set _network_available only once. 2007-01-04 19:12:45 +00:00
rubidium 627ebe8430 (svn r7829) -Codechange: move the network (core) initialization/shutdown functions into network/core, so the can be reused in the masterserver_updater. 2007-01-04 18:50:40 +00:00