Commit Graph

98 Commits

Author SHA1 Message Date
Rubidium 4af089b9be Feature: console command to change authorized keys 2024-03-17 21:21:33 +01:00
Patric Stout a3cfd23cf9
Codechange: rename byte to uint8_t (#12308) 2024-03-16 23:59:32 +01:00
Rubidium 564441e822 Remove: Debug redirect over network
It does not work for dedicated servers because upon starting the process to
resolve the address to redirect to gets killed. Also with all the async going
on in the network code, the debug redirection will start very late in the
process.
2024-01-14 22:14:31 +01:00
frosch 5733145c59 Cleanup: Remove unneeded parameters. 2023-09-19 22:49:59 +02:00
Rubidium eaae0bb5e7 Codechange: automatic adding of _t to (u)int types, and WChar to char32_t
for i in `find src -type f|grep -v 3rdparty/fmt|grep -v 3rdparty/catch2|grep -v 3rdparty/opengl|grep -v stdafx.h`; do sed 's/uint16& /uint16 \&/g;s/int8\([ >*),;[]\)/int8_t\1/g;s/int16\([ >*),;[]\)/int16_t\1/g;s/int32\([ >*),;[]\)/int32_t\1/g;s/int64\([ >*),;[]\)/int64_t\1/g;s/ uint32(/ uint32_t(/g;s/_uint8_t/_uint8/;s/Uint8_t/Uint8/;s/ft_int64_t/ft_int64/g;s/uint64$/uint64_t/;s/WChar/char32_t/g;s/char32_t char32_t/char32_t WChar/' -i $i; done
2023-07-19 19:30:14 +02:00
Patric Stout 3ebc7ad16e Codechange: migrate all game-time-related timers to the new framework 2023-04-15 13:58:55 +02:00
Patric Stout 1ba4dcc924 Codechange: migrate all Window-related timers to the new framework
This means we also say goodbye to GUITimers.
2023-04-15 13:58:55 +02:00
Zachary e17c82e32b Add: maximum number of companies allowed to the client list 2023-02-28 20:52:46 +01:00
Rubidium 4e65ec1dc4 Codechange: do not declare functions in blocks 2023-01-29 20:28:45 +01:00
dP 31cf9e888b
Add: [Network] external chat messages for remote admins (#9563) 2021-09-19 23:09:06 +02:00
Patric Stout 4c1ea4020d
Change: remove the ability to control "max spectators" (#9466)
Soon we will make "join game" join the game as spectator first,
so limiting the amount of spectators makes no sense anymore in
that context. Not sure it ever did make sense.
2021-08-10 20:03:13 +02:00
Patric Stout b6a116a247
Add: allow setting your server visibility to "invite-only" (#9434)
In this mode you do register to the Game Coordinator, but your
server will not show up in the public server listing. You can give
your friends the invite code of the server with which they can
join.
2021-07-11 21:57:05 +02:00
Patric Stout 61fdef8457 Remove: old server announcement to Master Server
As we now use the Game Coordinator for announcements, there is no
longer a need to use the Master Server for this.
2021-07-10 20:17:07 +02:00
rubidium42 cdf9caf8ea Codechange: [Network] Remove overload on NetworkValidateClientName
Rename the zero-parameter NetworkValidateClientName to NetworkValidateOurClientName to make it clearer it is performed on our client name, and to make it a non-overloaded function to aid with the variant being added a few commits later
2021-06-26 20:28:34 +02:00
rubidium42 806f78aa04 Codechange: [Network] Use std::string to send the client name and rcon commands 2021-05-30 00:01:49 +02:00
rubidium42 fd95736bac Codechange: [Network] Use std::string for server side logic of kicking and banning clients 2021-05-30 00:01:49 +02:00
rubidium42 f0e1cd0129 Codechange: [Network] Let server rcon result use std::string 2021-05-30 00:01:49 +02:00
rubidium42 8b9f1147df Codechange: [Network] Let server changing a client name use std::string 2021-05-30 00:01:49 +02:00
rubidium42 4144e949ed Fix: [Network] Prevent an empty server name to be set anywhere 2021-05-29 10:07:30 +02:00
rubidium42 e2f5d9e561 Codechange: use separate pre and post callbacks for string settings 2021-05-29 10:07:30 +02:00
rubidium42 fab120ee83 Codechange: [Network] Let chat communication use std::string 2021-05-15 10:20:50 +02:00
rubidium42 297d6e20bf Codechange: [Network] Pass passwords as std::string to the network code 2021-05-14 23:22:04 +02:00
rubidium42 1de5cdeab8 Codechange: [Network] Use std::string for the internal handling of company passwords 2021-05-14 23:22:04 +02:00
rubidium42 16437b7c0d Codechange: move client name in settings to std::string 2021-05-13 23:13:17 +02:00
rubidium42 e2774354b4
Codechange: [Network] Change ChatMessage's message to std::string and simplify some code 2021-05-08 10:19:42 +02:00
rubidium42 3d91eee919 Codechange: [Network] Move connection string parsing away from C-strings 2021-05-06 20:33:26 +02:00
rubidium42 e7581fd42d Change: [Network] Update server's NetworkServerGameInfo only when needed
Split the updating in a "static" version that only needs to be called when a new map is loaded or some settings are changed, and a "dynamic" version that updates everything that changes regularly such as the current game date or the number of spectators.
2021-05-05 21:01:23 +02:00
rubidium42 05394d5216 Fix #6598: Prevent invalid memory accesses when abandoning a join from within a network game
One could join a network game from within an already running network game. This would call a NetworkDisconnect, but keeps the UI alive. If, during that process the join is aborted, e.g. by cancelling on a password dialog, you would still be in your network game but also get shown the server list.
Solve all the underlying problems by falling back to the main UI when (re)connecting to a(nother) server.
2021-05-01 18:30:08 +02:00
rubidium42 3bd416bfdb Change: [Console] Show help when passing invalid company number 2021-05-01 18:30:08 +02:00
rubidium42 a61696d6c5 Change: [Network] Encapsulate logic about the connection string to the network code (#23) 2021-04-29 20:12:11 +02:00
Patric Stout be37a2cab8 Codechange: use NetworkAddress instead of two host/port variables where possible
This also means we no longer need last_host/last_port, but can
just use a single last_joined setting.
2021-04-29 20:12:11 +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
rubidium42 cbad518bf3 Codechange: [Network] Do not leak os_abstraction.h via network_func 2021-04-27 18:17:34 +01:00
rubidium42 bfb0ab3e2f Feature: [Network] Ensure players fill in a name instead of defaulting to "Player" 2021-04-24 08:02:54 +02:00
rubidium42 b14f412117 Codechange: [Network] Introduce function to validate the client name 2021-04-24 08:02:54 +02:00
Patric Stout 31897eaa7d Codechange: split ParseConnectionString into two functions
One also looks for a company, the other doesn't. There were more
uses of the latter than the first, leaving very weird code all
over the place.
2021-04-20 17:34:04 +02: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
S. D. Cloudt 13cc8a0cee Cleanup: Removed SVN headers 2019-11-10 17:59:20 +00:00
Henry Wilson 7c8e7c6b6e Codechange: Use null pointer literal instead of the NULL macro 2019-04-10 23:22:20 +02: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
rubidium ff5c05c1b4 (svn r27400) -Fix [FS#6368] (r26449): when a dedicated server was paused 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 2015-09-19 16:49:46 +00:00
frosch e2f5081f40 (svn r26788) -Add: Desync replay option to skip/replay failed commands 2014-09-07 14:21:16 +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
frosch c6ce57e8a7 (svn r26370) -Doc: Desync debugging and command replaying. 2014-02-23 19:32:32 +00:00
rubidium 531e501b5a (svn r23751) -Codechange: rename NetworkUDPGameLoop to a more descriptive name, and move the UDP specific bits to network_udp 2012-01-04 22:08:43 +00:00
frosch 6bb33acc0d (svn r22738) -Fix [FS#4722] (r21854): Setting company passwords via the GUI on servers (including starting a company with the default password) failed, so no client could join. 2011-08-13 08:32:55 +00:00
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 2011-04-22 16:02:21 +00:00
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 2011-04-22 15:59:32 +00:00
rubidium bc9a803ea9 (svn r22362) -Codechange: NetworkFindClientInfoFromClientID -> NetworkClientInfo::GetByClientID 2011-04-22 15:54:16 +00:00
rubidium 795a528328 (svn r21854) -Codechange: refactor the password setting methods to make it possible to change the password of other companies (on the server) 2011-01-19 16:47:40 +00:00