Commit Graph

352 Commits (37fd69b6047ff7d48fe03d4c829f8a36ee42348d)

Author SHA1 Message Date
Michael Lutz 05f4e73608 Codechange: Replace custom mutex code with C++11 mutex'es.
A conforming compiler with a valid <mutex>-header is expected.
Most parts of the code assume that locking a mutex will never fail unexpectedly,
which is generally true on all common platforms that don't just pretend to
be C++11. The use of condition variables in driver code is checked.
5 years ago
glx22 a1e492d0d8
Fix #7439: don't overwrite CompanyRemoveReason with ClientID (#7465) 5 years ago
Henry Wilson ab711e6942 Codechange: Replaced SmallVector::[Begin|End]() with std alternatives 5 years ago
Henry Wilson a0f36a50e6 Codechange: Replaced SmallVector::Append() with std::vector::[push|emplace]_back() 5 years ago
Henry Wilson af7d9020a1 Codechange: Use override specifer for overriding member declarations
This is a C++11 feature that allows the compiler to check that a virtual
member declaration overrides a base-class member with the same signature.

Also src/blitter/32bpp_anim_sse4.hpp +38 is no longer erroneously marked
as virtual despite being a template.
5 years ago
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.
5 years ago
glx 8e7fe3973f Add: CompanyCtrlAction enum for CMD_COMPANY_CTRL actions 5 years ago
Charles Pigott f5b1115039 Doc: Lots and lots of doxymentation fixes 6 years ago
Matthijs Kooijman fa87212a76 Fix: Some spelling errors in printed messages 6 years ago
frosch b4b98e5165 (svn r27893) -Codechange: Use fallthrough attribute. (LordAro) 7 years ago
rubidium f28ff446e9 (svn r26975) -Fix: reading too many bits when determining the client index for desync debug message 10 years ago
planetmaker 105306609f (svn r26616) -Fix (r26576) [FS#6025]: First send packages about new company, then clients joining it to admin port (Taede) 10 years ago
rubidium 4a52300838 (svn r26576) -Fix [FS#6003]: [Network] AIs would not reset certain network state information upon creation of their company 10 years ago
rubidium 9ed12b0f07 (svn r26509) -Codechange: replace strdup with stredup (the latter ensures the return is not NULL) 10 years ago
rubidium 160ad31028 (svn r26488) -Codechange: perform the appropriate length checks when getting a client name 10 years ago
frosch ef4c2ce031 (svn r26485) -Codechange: Replace ttd_strlcpy and ttd_strlcat with strecpy and strecat. 10 years ago
rubidium 0463dbdc9e (svn r26482) -Codechange: add an include that allows us to undefine/redefine "unsafe" functions to prevent them from being used, and thus having to care about certain aspects of their return values 10 years ago
rubidium 1a043202d1 (svn r26043) -Fix [FS#5811]: occasional hanging when client joins 11 years ago
rubidium 18a3a569fb (svn r26005) -Fix [FS#5478]: crash when transferring savegame from server to client 11 years ago
planetmaker c24374f99c (svn r24900) -Fix [FS#5389]: Comments with typos (most fixes supplied by Eagle_rainbow) 12 years ago
frosch de770d7563 (svn r24580) -Fix [FS#5308]: Do not add duplicates to the ban list. (alechz) 12 years ago
rubidium a961276b6f (svn r24221) -Fix [FS#5166]: Lag counters were not properly reset when switching states making it possible to get disconnected for lagging when you weren't lagging 12 years ago
rubidium ea2f19d4f2 (svn r23958) -Fix: don't allow chat messages from pre-active clients. As they haven't got the savegame yet, they won't have the interface to send them either (dihedral) 13 years ago
rubidium c5f7a0f69d (svn r23957) -Fix [FS#4990]: allow sending chat to pre-active clients as the clients start accepting once they send 'map ok' to the server, which is the same moment we change their status to pre-active 13 years ago
smatz b5525fd33d (svn r23941) -Add: support for clang 13 years ago
rubidium 4f62472fd9 (svn r23817) -Fix [FS#4962]: desync due to different NewGRF version. So reduce the chance that it happens significantly with betas/RCs/nightlies by doing the same as is done for stable releases: check the NewGRF version of server vs client.
Previously this check was not done for nightlies/betas/RCs due to missing versioning information in the source tarballs, but they have that for a while now. So just force the NewGRF version check for all versions, and remove the broken --revision configure option
13 years ago
truebrain 6c7c02eb14 (svn r23780) -Fix [FS#4963] (r23764): also name the two new errors 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() 13 years ago
rubidium 182969f531 (svn r23769) -Codechange: make the lag/join start timeouts configurable as well 13 years ago
rubidium bddfcaef95 (svn r23764) -Fix [FS#4955]: make default timeouts for certain states lower and configurable 13 years ago
rubidium 6d6be50ae0 (svn r23740) -Codechange: remove some 300 unneeded includes from the .cpp files 13 years ago
rubidium 104adbdb3a (svn r23337) -Fix [FS#4826]: don't send chat messages to clients that haven't joined yet 13 years ago
rubidium de27205e6c (svn r23031) -Fix [FS#4804]: for the admin "bots" there was no distinction between bankruptcy and manual removal of companies even though the API suggested that 13 years ago
rubidium f6b0561cd8 (svn r22805) -Codechange: move use of magic number for version checking to more logical location 13 years ago
rubidium c4aa943aaa (svn r22424) -Document: some more bits 13 years ago
rubidium 2e572b98de (svn r22400) -Codechange: replace some defines in the tcp/game code so doxygen can create better documentation 13 years ago
rubidium 1c1e9f6941 (svn r22384) -Fix [FS#4585]: No client error packet was sent to the admin bots 13 years ago
rubidium 380d4b277b (svn r22372) -Fix (r22364) [FS#4598]: segmentation fault when trying to get the server's IP 13 years ago
rubidium ce91f6b45e (svn r22370) -Codechange/fix: keep better accounting of the order in which clients joined:
* Clients can't be starved from joining the game
 * Clients will see the amount of clients actually waiting in front of them, instead of the amount of waiting clients in total
13 years ago
rubidium cdfc0ec4a3 (svn r22369) -Codechange: allocate ClientInfo when needed, i.e. don't allocate it for clients that are there to just get a list of companies. This means that these short lived clients won't be seen by the admin network in their client queries anymore 13 years ago
rubidium 2cae0cd54c (svn r22368) -Codechange: move the IP address field from the ClientInfo to ClientSocket 13 years ago
rubidium 146d532d51 (svn r22367) -Codechange: send ClientSockets instead of ClientInfos to the admin "core" as they send IP addresses to the admin "bots" 13 years ago
rubidium c61abe0019 (svn r22366) -Codechange: make GetClientIP a function of the server's ClientSocket, after all the Socket is the bit that's associated with the network 13 years ago
rubidium caf02450fb (svn r22365) -Codechange: add overload of NetworkServerKickOrBanIP using the ClientID, which later resolves the IP address to ban. This to consolidate the knowledge about resolving IP addresses 13 years ago
rubidium 1c419d99bc (svn r22364) -Codechange: don't show the (unknown) client address in the client list at clients 13 years ago
rubidium f1d0c1a746 (svn r22363) -Codechange: NetworkFindClientStateFromClientID -> NetworkClientSocket::GetByClientID 13 years ago
rubidium bc9a803ea9 (svn r22362) -Codechange: NetworkFindClientInfoFromClientID -> NetworkClientInfo::GetByClientID 13 years ago
rubidium 393fb8e46b (svn r22361) -Codechange: delete the client list popup when the client got removed (instead of previously selecting some other client) 13 years ago
smatz b1286bbcda (svn r22335) -Cleanup (r22308): remove superfluous tabs 13 years ago
rubidium d1a50a01b4 (svn r22308) -Fix [FS#4574]: waiting on a server could kick the client, or rather the client would kick itself due to an unexpected packet 13 years ago
rubidium 848761e3a9 (svn r22092) -Fix-ish (r22068): when you change a boolean to a enum, check specifically for a particular value 14 years ago
smatz a5b9858a36 (svn r22086) -Fix: do not check if we can allocate an item if we won't try to do so anyway 14 years ago
rubidium befa79ba4a (svn r22070) -Fix [FS#4503] (r21399): crashes when disconnecting after requesting the map 14 years ago
rubidium a19bc28aba (svn r22069) -Fix: delete all savegame packets, not just the first one 14 years ago
rubidium adfd648031 (svn r22068) -Codechange/Fix: return "connection lost" instead of "okay" when SendPackets closed the connection 14 years ago
rubidium 92d0d6d10b (svn r22067) -Fix: don't hold a mutex when sending packets and thus possibly closing the connection as that wants to acquire the mutex again 14 years ago
rubidium d8cada7563 (svn r22064) -Fix [FS#4497] (r21399): crash when disconnecting and reconnecting while the server is still saving the savegame 14 years ago
rubidium 05a846a574 (svn r22032) -Codechange: add some asserts to verify we don't allocate too many NetworkClientSockets/Infos 14 years ago
rubidium 7eba2bf4d3 (svn r21890) -Cleanup: remove some unneeded includes 14 years ago
rubidium 795a528328 (svn r21854) -Codechange: refactor the password setting methods to make it possible to change the password of other companies (on the server) 14 years ago
rubidium e54a1f6721 (svn r21853) -Codechange: HashCurrentCompanyPassword is only used by servers, so move it to network_server.* (dihedral) 14 years ago
rubidium 7dafd04f4b (svn r21727) -Fix [FS#4377]: admin bots weren't always notified of password changes (dihedral) 14 years ago
smatz 810873ff33 (svn r21704) -Fix [FS#4374]: no need to perform any more checks after the connection is closed (Rubidium) 14 years ago
rubidium b25cf57542 (svn r21701) -Codechange: ConsoleColour = TextColour, so make it that way and remove some unneeded casts 14 years ago
alberth b633ffaa1d (svn r21571) -Codechange: Having a break after a return is no good. 14 years ago
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 14 years ago
rubidium 5f25cdbbd5 (svn r21401) -Fix: ofcourse MSVC x64 has something to complain about... 14 years ago
rubidium 216e48cd07 (svn r21399) -Change/Feature/Fix [FS#4284]: perform the compression of savegames to send to the client asynchroniously. This will reduce the lag of the other clients to the time it takes to make the memory dump and it will speed up downloading the map as the download starts earlier (possibly with a slightly lower bandwidth due to slow compression). This should also fix the lag message people get when the savegame compression takes more than a few seconds. 14 years ago
rubidium 02b3bc57d5 (svn r21398) -Change/Feature-ish: when making a savegame to send to a client, don't write it to disk but create the packets immediately 14 years ago
rubidium 97434f0e06 (svn r21392) -Change: prepare the network protocol for getting the file size later in the download process 14 years ago
rubidium fd752ca2b0 (svn r21363) -Add: support for limiting the amount of (accepted) incoming data 14 years ago
rubidium 31c8ab0ed8 (svn r21361) -Change: make sure the client is listening, or rather receiving, our frames 14 years ago
rubidium b6c2216749 (svn r21358) -Codechange: make some network function names conform to coding style 14 years ago
rubidium c60a850fed (svn r21350) -Fix: some indentation 14 years ago
rubidium 67f74559fc (svn r21334) -Fix [FS#4271]: make (more) sure that the savegame and transferred file are the same file and not different ones 14 years ago
rubidium 6d09f4a3cb (svn r21254) -Change: show a different "lag" message when a client is lagging because of connection trouble or lagging because the client is just slow 14 years ago
rubidium 673b3711b4 (svn r21182) -Fix: possible just-freed memory reads 14 years ago
rubidium 4ea67eff8b (svn r21032) -Codechange: perform some more strict tests on the server side when receiving some packets and don't send some when the clients aren't ready for them 14 years ago
rubidium f24c91c487 (svn r21030) -Codechange: move ClientStatus into the network server socket class 14 years ago
rubidium 2cd67a51ac (svn r21029) -Codechange: split the map downloading packet + 3-state enum into 3 separate packets 14 years ago
rubidium 073b965829 (svn r21024) -Fix: erroneous tab 14 years ago
rubidium af9a6b6b42 (svn r21001) -Fix [FS#4170] (r20936): clients were not always notified of a player leaving the game 14 years ago
rubidium d71f590ed6 (svn r20993) -Codechange: some shuffling of game protocol packet description so they're documented in the "same" place as UDP, content and admin packets (dihedral) 14 years ago
rubidium d9602f4ef9 (svn r20973) -Add: chat sending and receiving support for remote admins (dihedral) 14 years ago
rubidium ae20cb4f3d (svn r20970) -Add: company change notification to remote admins (dihedral) 14 years ago
rubidium fe44944f32 (svn r20969) -Add: client info change notification to remote admins (dihedral) 14 years ago
rubidium b4ce7fad7f (svn r20967) -Add: infrastructure to send information to remote admins at specific intervals (dihedral) 14 years ago
rubidium 234bee0858 (svn r20938) -Codechange: make the code for listening on a socket (more) reusable 14 years ago
rubidium c9cbab14ea (svn r20937) -Codechange: move some variables from client/server to server only 14 years ago
rubidium f712055002 (svn r20936) -Codechange: make server side packet sending methods class methods 14 years ago
rubidium 9858d699a3 (svn r20935) -Codechange: only let the server side use a pool of connected sockets 14 years ago
rubidium bda26d03b5 (svn r20934) -Codechange: move NetworkGetClientName to the server's socket 14 years ago
rubidium 7ba07d9573 (svn r20929) -Codechange: make NetworkCloseClient a class method 14 years ago
rubidium 0ca7e4e82e (svn r20924) -Codechange: make the game connection packet handling look more like UDP/content packet handling 14 years ago
rubidium 8eb07d097e (svn r20923) -Codechange: prepare creating sub-classes of NetworkClientSocket for server and client side 14 years ago
alberth 9f5a96ead2 (svn r20689) -Codechange: Make some global functions used in 1 .cpp file static in that file. 14 years ago
rubidium a4c6d07edc (svn r20553) -Feature: allow rate limiting of incoming commands 14 years ago
rubidium b594990071 (svn r20549) -Codechange: centralise the handling of the incoming commands (from clients and the server) 14 years ago
rubidium e8e22c99fd (svn r20548) -Codechange: rename some variables giving them slightly more meaningful names 14 years ago
rubidium 69fa0b36d3 (svn r20542) -Codechange: generalise the setting of "p2" to the ClientID. 14 years ago
rubidium 1c3d42598e (svn r20510) -Codechange: unify packet queue handling and make insertion O(1) instead of O(n) 14 years ago
alberth ee01ec9136 (svn r20291) -Codechange: Unify break coding style. 14 years ago
frosch 4bd32799f1 (svn r20286) -Codechange: Unify end of doxygen comments. 14 years ago
frosch ed4f806f1d (svn r20283) -Codechange: Unify start of doygen comments. 14 years ago
terkhen 88ca183191 (svn r20239) -Doc: Give a common name to all fall throughs (FALL THROUGH). 14 years ago
alberth be6c058424 (svn r20211) -Codechange: Indented code should have curly braces around it. 14 years ago
rubidium 99a11badaf (svn r19996) -Codechange: Add NetworkVehicleType enum. 14 years ago
smatz 80fd67a314 (svn r19818) -Fix [FS#3784](r16004): kicking clients by IP didn't work 14 years ago
rubidium 2555522eab (svn r19809) -Codechange: make some unnamed network related enums/defines static const variables 14 years ago
rubidium 6fa962b867 (svn r19808) -Codechange: NetworkCalculateLag returned an uint, so keep it that way 14 years ago
rubidium 26af87bbaa (svn r19695) -Fix: leaking a file descriptor 14 years ago
smatz f48f4c8293 (svn r19693) -Codechange: split STATUS_INACTIVE to two states 14 years ago
rubidium df4d8b3bc9 (svn r19678) -Fix (r19607): client status was shown incorrect in the console 14 years ago
smatz cd20724d20 (svn r19651) -Fix [FS#3745]: when a company is sold, move connected clients to spectators 14 years ago
rubidium 088282bcf8 (svn r19620) -Fix: desync when a command is received and in the queue while a client starts joining, i.e. save the game state. This can happen in two ways: with frame_freq > 1 a command received in a previous frame might not be executed yet or when a command is received in the same frame as the join but before the savegame is made. In both cases the joining client would not get all commands to get in-sync with the server (and the other clients). 14 years ago
smatz 24a60b77ec (svn r19613) -Fix [FS#3755]: possible invalid read when server moves client to spectators before he finishes joining 14 years ago
smatz 7f3844d3aa (svn r19610) -Codechange: rename STATUS_AUTH to STATUS_AUTHORIZED 14 years ago
smatz 13e5058efe (svn r19608) -Fix: do not kick client if he entered password and the password was cleared meanwhile 14 years ago
smatz 11d6e21c3a (svn r19607) -Codechange: use different packet types instead of packet subtypes 14 years ago
rubidium d8baa1342c (svn r19589) -Change: add some more useful information to the desync log and unify the formatting 14 years ago
yexo a9c8dbc0a0 (svn r19255) -Codechange: encapsulate GRFIdentifier in GRFConfig instead of subclassing it 15 years ago
rubidium ab35d95b5a (svn r19072) -Fix [FS#3599]: possible read/write after free when the client triggered the server to close the connection 15 years ago
rubidium f608ad7baf (svn r18875) -Codechange: remove some unneeded bits from the network protocol and improve the naming of some variables 15 years ago
rubidium 82fc28f77f (svn r18809) -Codechange/Cleanup: remove unneeded headers from some files, if a header require a header make it include that header 15 years ago
rubidium 4ecb3eb33c (svn r18804) -Codechange: guard against binaries claiming to be compatible with a future (stable) release of OpenTTD. 15 years ago
rubidium 6a047d2316 (svn r18782) -Codechange: move the content of callback_table.cpp to network_command.cpp; it's only ever used there. 15 years ago
frosch 59f9163e37 (svn r18381) -Codechange: Add RoadVehicle::IsBus() to simplify some stuff. 15 years ago
rubidium b00a5f1069 (svn r18330) -Cleanup: remove some unneeded includes 15 years ago
rubidium b0f18a27fb (svn r18054) -Change/Fix [FS#3310]: make pause on join pause during the whole joining (including download) phase 15 years ago
rubidium 2a1cab4d46 (svn r18052) -Codechange/Fix: make the 'pause' chat message when actually executing the pause command. This to prevent showing paused and especially unpaused to be shown when the state doesn't change. Output now mentions whether pause changes keep the game paused and what reasons for pausing there 'currently' are. 15 years ago
frosch b012a75c47 (svn r17977) -Fix: Busses and trucks are distinguished by cargo class. 15 years ago
smatz eb72a0095f (svn r17746) -Codechange: 'operator new' doesn't return NULL, NetworkSend_Init() is useless 15 years ago
rubidium 59ec3dc267 (svn r17743) -Fix: (post 0.7) memory leak in server in case handling a packet caused the connection to be closed. Also force-close the connection on invalid packets. 15 years ago
rubidium df75db67eb (svn r17742) -Codechange: remove unused variable from Recv_Packet 15 years ago
rubidium d6cded5380 (svn r17693) -Cleanup: remove some unneeded includes 15 years ago
rubidium 7d24e84a81 (svn r17617) -Codechange: make the server side packet handling be more like the client side's handling, i.e. return the connection status
-Fix: do not do invalid reads when a packet handling function closed a connection
15 years ago
frosch ebd916be3d (svn r17532) -Codechange: Rename several Invalidate functions to SetDirty for more consistency and distinguishability. 15 years ago
rubidium bd9670ea47 (svn r17467) -Change: show the client id in join messages at the server (patch by dihedral) 15 years ago
rubidium 7fbc33dae1 (svn r17248) -Fix: add GPL license notice where appropriate 15 years ago
rubidium 1fe3ad3288 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives 15 years ago
smatz 22cf8d8480 (svn r16634) -Codechange: use Company::IsHumanID() instead of IsHumanCompany() 15 years ago
rubidium 9b156c1bd4 (svn r16601) -Fix [FS#2880]: try 2... hopefully better this time 15 years ago
rubidium a497e3ff4a (svn r16592) -Fix [FS#2880]: 'connection lost' was also shown when the client was 'leaving'. 15 years ago
smatz bea3fe2b8b (svn r16559) -Codechange: introduce Company::IsValidAiID() and Company::IsValidHumanID(), don't use IsHumanCompany() where possible 15 years ago
alberth bab70a823d (svn r16491) -Codechange: Added parentheses around bitwise operators for code style. 15 years ago
rubidium bacbafe510 (svn r16437) -Codechange: remove the hack that for CMD_COMPANY_CTRL the company was changed from spectator to company 0 in the network code. 15 years ago
rubidium 168ae6f7e2 (svn r16422) -Codechange: use const_cast for removing const and warn when const is (accidentally?) removed using C-style casts. 15 years ago
smatz 10d1ef5447 (svn r16379) -Codechange: remove GetNumTowns(), GetNumIndustries() and GetActiveCompanyCount(), use PoolItem::GetNumItems() instead 15 years ago
smatz 871107f529 (svn r16327) -Codechange: replace IsValidPoolItemID(index) by PoolItem::IsValidID(index) 15 years ago
smatz 6221d74644 (svn r16325) -Codechange: replace GetPoolItem(index) by PoolItem::Get(index) 15 years ago
rubidium 2664f2a2d9 (svn r16242) -Codechange: rework pausing
-Fix [FS#2864]: autopause and manual pausing conflict with eachother
-Fix: new game + pause on new game + autopause make the game not unpause on the first join
15 years ago