Commit Graph

1205 Commits (cca613e3b885d94b54bf9bcb3f2bd7ee85381fac)

Author SHA1 Message Date
glx22 82573a5e73
Fix #8117: Memory leak in admin port (#8122) 4 years ago
frosch 7fe291667f Fix #8060, 5880f14: Restore admin network API compatibility. 5 years ago
Quipyowert2 d1b7eb2de1 Codechange: Limit field width to avoid sscanf crash 5 years ago
glx 2b1a7ceb4e Fix #7976: Don't kick the client doing the rcon 5 years ago
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.
5 years ago
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
5 years ago
Jonathan G Rennison 150dfba95b Codechange: Remove std::function from Pool iteration wrapper
Add a separate template wrapper for filtered iteration
5 years ago
glx e3c75a30ba Fix: unused variable warnings 5 years ago
glx ee7a8eebca Codechange: Replace FOR_ALL_TOWNS with range-based for loops 5 years ago
glx d8a1be48cd Codechange: Replace vehicle related FOR_ALL with range-based for loops 5 years ago
glx 41232f18c1 Codechange: Replace network related FOR_ALL with range-based for loops 5 years ago
glx ddabfed1cd Codechange: Replace station related FOR_ALL with range-based for loops 5 years ago
glx 3a14cea068 Codechange: Replace FOR_ALL_COMPANIES with range-based for loops 5 years ago
S. D. Cloudt 13cc8a0cee Cleanup: Removed SVN headers 5 years ago
Joe Stringer b4f1056097 Fix: [Cygwin] Fix missing AI_ADDRCONFIG declaration
Fixes the following complaints:

src/network/core/address.cpp: In member function 'const sockaddr_storage* NetworkAddress::GetAddress()':
src/network/core/address.cpp:134:55: error: 'AI_ADDRCONFIG' was not declared in this scope
   this->Resolve(this->address.ss_family, SOCK_STREAM, AI_ADDRCONFIG, nullptr, ResolveLoopProc);

Signed-off-by: Joe Stringer <joe@wand.net.nz>
5 years ago
Charles Pigott fe9731d32c Fix: clang and MSVC warnings (glx) 5 years ago
Charles Pigott 71a3e83468 Fix: GCC9's warnings about deprecated implicit assignment operators 5 years ago
JMcKiern 04f659e768 Fix: Some typos found using codespell 5 years ago
glx 212140b88b Codechange: replace grow() usage in ClientNetworkContentSocketHandler::OnReceiveData() 5 years ago
Charles Pigott 5b34c8019f Codechange: Remove Company/OwnerByte types 5 years ago
PeterN 0ab6244f6b
Fix #7165: Missed another 'Append() --> push_back()' replacement (#7548) 6 years ago
Niels Martin Hansen d5841109f0 Fix dcb2571: Missing override keywords 6 years ago
Niels Martin Hansen a64bd6e22c Fix: Also breaking for warning text in set company password 6 years ago
Niels Martin Hansen dcb2571888 Add: Warn players that company passwords are not truly secure 6 years ago
glx 8899272614 Codechange: use std::vector for _language_dropdown 6 years ago
glx 2db88953e7 Codechange: use std::sort() in GUIList 6 years ago
Henry Wilson 7c8e7c6b6e Codechange: Use null pointer literal instead of the NULL macro 6 years ago
Jonathan G Rennison 01f957c51f Fix: Crash due to use of invalid iterator in ClientNetworkContentSocketHandler
In particular this crash can be observed when using the
bootstrap GUI to download the base graphics.

In ClientNetworkContentSocketHandler::OnReceiveContentInfo
ClientNetworkContentSocketHandler::callbacks is iterated, using an iterator
cb->OnReceiveContentInfo() is called (cb is of type BootstrapAskForDownloadWindow)
This calls new BootstrapContentDownloadStatusWindow()
This inherits from BaseNetworkContentDownloadStatusWindow
The constructor of which calls _network_content_client.AddCallback(this)
This reallocates the std::vector which is being iterated in ClientNetworkContentSocketHandler::OnReceiveContentInfo
This results in iter being invalid, and an assertion failure occurs shortly
afterwards due to its use in the next iteration of cb->OnReceiveContentInfo()

Adjust all locations where ClientNetworkContentSocketHandler::callbacks
is iterated to avoid problematic behaviour
6 years ago
Michael Lutz 8b1880187a Remove: AutoFreeSmallVector.
The last use was for storing a list of memory blocks. As the way these lists are accessed is very
specific, it is easier to just write an explicit destructor instead of trying to exactly match the behaviour.
6 years ago
Michael Lutz e804173595 Codechange: If something is a vector of strings, use a vector of strings instead of an AutoFreeSmallVector. 6 years ago
Michael Lutz ae748166d0 Codechange: Use platform independent C++11 function for sleeping on a thread. 6 years ago
Michael Lutz 94c5269fa7 Codechange: Use atomic variables for thread synchronization where useful. 6 years ago
Michael Lutz 05bc2ed7cb Codechange: Replace custom thread code with C++11 thread objects.
We assume a conforming C++11 compiler environment that has a valid <thread>-header.
Failure to run a real thread is handled gracefully.
6 years ago
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.
6 years ago
glx22 a1e492d0d8
Fix #7439: don't overwrite CompanyRemoveReason with ClientID (#7465) 6 years ago
PeterN 9244dad3f1
Fix #7434: Incorrect use of vector iterator. (#7437) 6 years ago
glx22 66dd7c3879
Fix: MSVC warnings (#7423) 6 years ago
stormcone b913c92aa7 Fix #7165: Missed 'Append() --> push_back()' replacement 6 years ago
Henry Wilson cc62f4163f Cleanup: Remove unused size template parameters from SmallMap and Auto[Free|Delete]SmallVector 6 years ago
Henry Wilson c01a2e2a81 Codechange: Removed SmallVector completely 6 years ago
Henry Wilson ab711e6942 Codechange: Replaced SmallVector::[Begin|End]() with std alternatives 6 years ago
Henry Wilson 297fd3dda3 Codechange: Replaced SmallVector::Include() with include() 6 years ago
Henry Wilson 2bc2de9034 Codechange: Replaced SmallVector::Find() with std::find() 6 years ago
Henry Wilson a0f36a50e6 Codechange: Replaced SmallVector::Append() with std::vector::[push|emplace]_back() 6 years ago
Henry Wilson ca2f33c6d0 Codechange: Replaced SmallVector::Erase() with std::vector::erase() 6 years ago
Henry Wilson 097328c3d7 Codechange: Replaced SmallVector::Get() const with std alternatives 6 years ago
Henry Wilson 5795f66d2e Codechange: Replaced SmallVector::Contains() with std::find() pattern 6 years ago
Henry Wilson 8460952240 Codechange: Replaced SmallVector::Find() const with suitable alternatives
The use of std::none_of in network/core/host.cpp is driven by the non-const
comparison operator use by NetworkAddress. A future commit should address
the const_casts in that class to ensure const-correctness.
6 years ago
Henry Wilson 81315939b9 Codechange: Replaced SmallVector::Find() non-const with std::find() 6 years ago
Henry Wilson f3938fdb83 Codechange: Replaced SmallVector::Reset() with std::vector::clear() + shrink_to_fit() 6 years ago