Commit Graph

265 Commits

Author SHA1 Message Date
Charles Pigott 860c270c73 Codechange: Replace assert_compile macro with static_assert 2020-12-27 10:55:42 +00:00
Jonathan G Rennison 053d4f3bff Fix: Thread unsafe use of SendPacket for PACKET_SERVER_MAP_SIZE
NetworkTCPSocketHandler::SendPacket is not thread safe and may not
be used concurrently from multiple threads without suitable locking
2020-07-09 16:08:01 +01:00
glx 2b1a7ceb4e Fix #7976: Don't kick the client doing the rcon 2020-02-08 09:03:14 +01:00
Bjarni Thor 5880f1479f Feature #7756: Allow server to supply a reason to kicked/banned clients
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.
2020-02-04 22:17:39 +00:00
Berbe 2fc2058b3b Feature: Auto-restart loads the original resources again
If the game was started loading a savegame or scenario, auto-restart will load a new random map.
This is inconsistent with the case in which a heightmap was loaded, as in that case the heightmap is kept as a basis for a new game.
This proposal solves this heterogeneity be considering the originally loaded resource shall be kept, hence savegames & scenarios shall be reloaded
2020-01-12 23:47:19 +01:00
glx d8a1be48cd Codechange: Replace vehicle related FOR_ALL with range-based for loops 2019-12-21 20:13:03 +01:00
glx 41232f18c1 Codechange: Replace network related FOR_ALL with range-based for loops 2019-12-21 20:13:03 +01:00
glx ddabfed1cd Codechange: Replace station related FOR_ALL with range-based for loops 2019-12-21 20:13:03 +01:00
glx 3a14cea068 Codechange: Replace FOR_ALL_COMPANIES with range-based for loops 2019-12-21 20:13:03 +01:00
S. D. Cloudt 13cc8a0cee Cleanup: Removed SVN headers 2019-11-10 17:59:20 +00:00
JMcKiern 04f659e768 Fix: Some typos found using codespell 2019-09-29 21:27:32 +01:00
Henry Wilson 7c8e7c6b6e Codechange: Use null pointer literal instead of the NULL macro 2019-04-10 23:22:20 +02:00
Michael Lutz e804173595 Codechange: If something is a vector of strings, use a vector of strings instead of an AutoFreeSmallVector. 2019-04-09 22:45:15 +02:00
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.
2019-04-06 11:27:39 +02:00
glx22 a1e492d0d8
Fix #7439: don't overwrite CompanyRemoveReason with ClientID (#7465) 2019-04-05 15:11:52 +02:00
Henry Wilson ab711e6942 Codechange: Replaced SmallVector::[Begin|End]() with std alternatives 2019-03-26 20:15:57 +00:00
Henry Wilson a0f36a50e6 Codechange: Replaced SmallVector::Append() with std::vector::[push|emplace]_back() 2019-03-26 20:15:57 +00:00
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.
2019-03-24 16:10:04 +01: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
glx 8e7fe3973f Add: CompanyCtrlAction enum for CMD_COMPANY_CTRL actions 2019-02-04 21:08:36 +01:00
Charles Pigott f5b1115039 Doc: Lots and lots of doxymentation fixes 2018-10-31 12:35:54 +01:00
Matthijs Kooijman fa87212a76 Fix: Some spelling errors in printed messages 2018-04-30 13:38:58 +02:00
frosch b4b98e5165 (svn r27893) -Codechange: Use fallthrough attribute. (LordAro) 2017-08-13 18:38:42 +00:00
rubidium f28ff446e9 (svn r26975) -Fix: reading too many bits when determining the client index for desync debug message 2014-10-07 17:32:29 +00:00
planetmaker 105306609f (svn r26616) -Fix (r26576) [FS#6025]: First send packages about new company, then clients joining it to admin port (Taede) 2014-05-25 19:01:30 +00:00
rubidium 4a52300838 (svn r26576) -Fix [FS#6003]: [Network] AIs would not reset certain network state information upon creation of their company 2014-05-11 12:52:21 +00:00
rubidium 9ed12b0f07 (svn r26509) -Codechange: replace strdup with stredup (the latter ensures the return is not NULL) 2014-04-25 15:40:32 +00:00
rubidium 160ad31028 (svn r26488) -Codechange: perform the appropriate length checks when getting a client name 2014-04-23 21:19:54 +00:00
frosch ef4c2ce031 (svn r26485) -Codechange: Replace ttd_strlcpy and ttd_strlcat with strecpy and strecat. 2014-04-23 20:44:42 +00:00
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 2014-04-23 20:13:33 +00:00
rubidium 1a043202d1 (svn r26043) -Fix [FS#5811]: occasional hanging when client joins 2013-11-21 18:35:31 +00:00
rubidium 18a3a569fb (svn r26005) -Fix [FS#5478]: crash when transferring savegame from server to client 2013-11-15 22:22:01 +00: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
frosch de770d7563 (svn r24580) -Fix [FS#5308]: Do not add duplicates to the ban list. (alechz) 2012-10-09 20:36:31 +00:00
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 2012-05-09 19:14:36 +00:00
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) 2012-02-16 20:45:03 +00:00
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 2012-02-16 20:44:03 +00:00
smatz b5525fd33d (svn r23941) -Add: support for clang 2012-02-12 21:17:32 +00:00
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
2012-01-17 17:27:38 +00:00
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() 2012-01-09 21:22:48 +00:00
rubidium 182969f531 (svn r23769) -Codechange: make the lag/join start timeouts configurable as well 2012-01-07 14:43:45 +00:00
rubidium bddfcaef95 (svn r23764) -Fix [FS#4955]: make default timeouts for certain states lower and configurable 2012-01-06 21:49:06 +00:00
rubidium 6d6be50ae0 (svn r23740) -Codechange: remove some 300 unneeded includes from the .cpp files 2012-01-03 21:32:51 +00:00
rubidium 104adbdb3a (svn r23337) -Fix [FS#4826]: don't send chat messages to clients that haven't joined yet 2011-11-26 17:28:18 +00:00
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 2011-10-15 20:42:32 +00:00
rubidium f6b0561cd8 (svn r22805) -Codechange: move use of magic number for version checking to more logical location 2011-08-21 18:57:45 +00:00
rubidium c4aa943aaa (svn r22424) -Document: some more bits 2011-05-05 16:24:48 +00:00
rubidium 2e572b98de (svn r22400) -Codechange: replace some defines in the tcp/game code so doxygen can create better documentation 2011-05-01 11:30:03 +00:00
rubidium 1c1e9f6941 (svn r22384) -Fix [FS#4585]: No client error packet was sent to the admin bots 2011-04-30 12:09:26 +00:00
rubidium 380d4b277b (svn r22372) -Fix (r22364) [FS#4598]: segmentation fault when trying to get the server's IP 2011-04-22 19:53:28 +00:00