Commit Graph

25849 Commits

Author SHA1 Message Date
Patric Stout
8a36134003 Fix: [Network] rework when to close connections and inform Game Coordinator if needed 2021-07-20 19:57:23 +02:00
Charles Pigott
f1dfc2f482 Codechange: Make OverflowSafeInt constexpr 2021-07-20 10:42:03 +01:00
Charles Pigott
549a58731f Codechange: Remove (unused) ability to specify min/max of OverflowSafeInt 2021-07-20 10:42:03 +01:00
Charles Pigott
e6e2a67aa1 Codechange: Use GCC/clang builtins for overflow safety when supported 2021-07-20 10:42:03 +01:00
Charles Pigott
3d0d9edafd Fix: OverflowSafeInt could underflow
Notably, a company with an extremely negative amount of money would
suddenly become very rich
2021-07-20 10:42:03 +01:00
Charles Pigott
1e439979f7 Fix: OverflowSafeInt negation not handling INT64_MIN
INT64_MIN negated is above INT64_MAX, and would overflow.
Instead, when negating INT64_MIN make it INT64_MAX.
This does mean that -(-(INT64_MIN)) != INT64_MIN.
2021-07-20 10:42:03 +01:00
Loïc Guilloux
9b0bb21f3b
Fix 57734fd: Don't enable rename button for network clients in build vehicle window (#9452) 2021-07-19 22:38:36 +02:00
translators
d1cf56609d Update: Translations from eints
german: 1 change by danidoedel
2021-07-19 18:53:13 +00:00
Charles Pigott
1e529e1632
Fix: [Fluidsynth] Crash when debug output enabled (#9446) 2021-07-19 10:36:35 +01:00
translators
9421cb1e2c Update: Translations from eints
estonian: 1 change by siimsoni
russian: 20 changes by Ln-Wolf
2021-07-18 18:50:19 +00:00
Rubidium
386ef4dac3 Feature: [Game Coordinator] Send NewGRF names to the client 2021-07-18 19:36:38 +02:00
rubidium42
3eaa470632 Feature: [Network] Optionally send NewGRF names with NewGRFs in GameInfo
Before 8a2da49 the NewGRF names were synchronized using UDP packets, however
those have been removed. With this a new version of the GameInfo packet is
introduced that allows to specify the type of serialisation happens for
NewGRFs. Either only the GRF ID and checksum, or those two plus the name of
the NewGRF.
On this request for local servers will send the NewGRFs names.
The Game Coordinator will get the names on the first registration, and after
that only the GRF ID and checksum.
2021-07-18 19:36:38 +02:00
rubidium42
5dd524139f Fix c921f6d: [Network] Documentation of Game Info packet was not updated 2021-07-18 11:42:25 +02:00
rubidium42
09a7825d1e Remove: the concept of UnknownGRFs
These were filled with "<Unknown>" (before 8a2da49) and later their name would get filled via UDP requests to the server. These UDP packets do not exist anymore, so they will always remain "<Unknown>".
Remove that logic and just use the generic translated error GRF UNKNOWN string instead.
2021-07-18 11:42:25 +02:00
translators
3479e59eea Update: Translations from eints
korean: 2 changes by telk5093
catalan: 3 changes by J0anJosep
french: 17 changes by glx22
portuguese: 1 change by azulcosta
portuguese (brazilian): 15 changes by Vimerum
2021-07-17 18:50:07 +00:00
Patric Stout
ab601115a9
Fix 75b6051b: removing items from the ini could leave the group in a bad state (#9445) 2021-07-17 17:26:50 +02:00
Loïc Guilloux
460991ecf4
Feature: Persistant rotation of numbered auto/netsave after restart (#9397)
It was always starting from 0 on openttd restart.
Now the most recent auto/netsave number will be used as a base to generate the next filename.
2021-07-17 12:48:35 +02:00
glx22
16abdd5254 Change: [Win32] Set the console codepage to UTF-8 2021-07-16 23:01:08 +02:00
glx22
afea5e85ae Fix 433f74e: GetString() requires a language pack 2021-07-16 23:01:08 +02:00
translators
96add9c36d Update: Translations from eints
spanish (mexican): 1 change by absay
dutch: 15 changes by Afoklala
portuguese: 1 change by azulcosta
2021-07-16 18:51:17 +00:00
Patric Stout
29cceb59a5 Doc: explain in a bit more detail how we implemented STUN 2021-07-16 19:50:29 +02:00
Patric Stout
8adade26ed Feature: allow the use of STUN to connect client and server together
This method doesn't require port-forwarding to be used, and works for
most common NAT routers in home setups. But, for sure it doesn't work
for all setups, and not everyone will be able to use this.
2021-07-16 19:50:29 +02:00
Patric Stout
55eed246b8 Codechange: allow Connect() to bind to a local address 2021-07-16 19:50:29 +02:00
translators
695e1493c9 Update: Translations from eints
swedish: 14 changes by joeax910
2021-07-15 18:49:29 +00:00
Patric Stout
c921f6d817
Add: inform clients what game-script a server is running (#9441)
Co-authored-by: The Dude <thedude@novapolis.net>
2021-07-14 21:23:44 +02:00
translators
333cba6a61 Update: Translations from eints
spanish (mexican): 1 change by absay
finnish: 14 changes by hpiirai
2021-07-14 18:53:00 +00:00
translators
e9b157f1f5 Update: Translations from eints
korean: 1 change by telk5093
portuguese: 1 change by azulcosta
2021-07-13 18:52:35 +00:00
translators
80f4e42627 Update: Translations from eints
spanish (mexican): 4 changes by absay
english (us): 13 changes by 2TallTyler
korean: 5 changes by telk5093
german: 13 changes by Wuzzy2
portuguese: 4 changes by azulcosta
hindi: 6 changes by ritwikraghav14
2021-07-12 18:51:48 +00:00
Rubidium
c71f06e59b Feature: parse the console settings the same way as config settings
Now you can use things like `set server_game_type public` instead of having to
guess the number, which would not be written into the configuration file nor
would it be shown when doing `set server_game_type`.
2021-07-11 23:11:05 +02:00
Patric Stout
dd7f69be6e
Fix: "Search LAN games" used the socket after it was closed (#9437)
Every outgoing connection, either TCP or UDP, triggered
NetworkInitialize(), which triggered NetworkUDPInitialize() which
first closes all connections.

Now the problem was that "Search LAN games" found a server, added
it to the list, after which (over TCP) it queries the server. This
closes all UDP sockets (as that makes sense, I guess?), while the
UDP was still reading from it.

Solve this by simply stop initializing UDP every time we make an
outgoing TCP connection; instead only do it on start-up.
2021-07-11 22:37:14 +02:00
Rubidium
178ea3196b Remove: includes to network/core/config.h from headers when only three cpp files need it 2021-07-11 22:13:59 +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
translators
8bb9c3f646 Update: Translations from eints
spanish (mexican): 29 changes by absay
czech: 11 changes by JustImagine436
korean: 9 changes by telk5093
portuguese: 9 changes by azulcosta
hindi: 28 changes by ritwikraghav14
2021-07-11 18:50:16 +00:00
Patric Stout
e4d216e44b Feature: join servers based on their invite code
This removes the need to know a server IP to join it. Invite codes
are small (~7 characters) indentifiers for servers, which can be
exchanged with other players to join the servers.
2021-07-11 20:38:42 +02:00
Patric Stout
1baec41542 Change: groundwork to allow ServerAddress to use invite codes
Normally TCPConnecter will do a DNS resolving of the connection_string
and connect to it. But for SERVER_ADDRESS_INVITE_CODE this is different:
the Game Coordinator does the "resolving".

This means we need to allow TCPConnecter to not setup a connection
and allow it to be told when a connection has been setup by an external
(to TCPConnecter) part of the code. We do this by telling the (active)
socket for the connection.

This means the rest of the code doesn't need to know the TCPConnecter
is not doing a simple resolve+connect. The rest of the code only
cares the connection is established; not how it was established.
2021-07-11 20:38:42 +02:00
Patric Stout
cee8174d02 Codechange: track servers with a ServerAddress instead of a NetworkAddress
This allows future extensions to have different ways of referencing
a server, instead of forcing to use IP:port.
2021-07-11 20:38:42 +02:00
Patric Stout
f4dd2d88c7 Feature: raise the maximum NewGRF limit to 255 2021-07-11 12:16:07 +02:00
Patric Stout
6f0c6fb2ae Fix a4987233: NewGRFs could no longer be loaded from the NewGRF folder.
This statement was removed by accident, as it felt it could be removed.
But it is used to know if the NewGRF is from the baseset folder or
from the NewGRF folder.
2021-07-11 12:16:07 +02:00
rubidium42
a498723345
Remove: arbitrary limit on number of statically loaded NewGRFs (#9431) 2021-07-11 11:23:47 +02:00
Rubidium
f6955a304c Fix: ensure no more than the allowed number of NewGRFs are loaded from the configuration 2021-07-11 11:20:07 +02:00
Rubidium
e99134654b Feature: allow setting (game) coordinator and content server connection strings using environment variables
OTTD_COORDINATOR_CS for the game coordinator defaults to coordinator.openttd.org:3976
OTTD_CONTENT_SERVER_CS for the content server defaults to content.openttd.org:3978
OTTD_CONTENT_MIRROR_CS for the content mirror server defaults to binaries.openttd.org:80
2021-07-10 23:09:45 +02:00
Rubidium
3e4d327451 Codechange: use the C++ std::getenv over the POSIX/C getenv
The C++ std::getenv is guaranteed thread-safe by the C++11 specification,
whereas the POSIX/C getenv might not be thread-safe by the C11 specification.
2021-07-10 22:55:46 +02:00
translators
d158eba72c Update: Translations from eints
spanish (mexican): 74 changes by absay
vietnamese: 62 changes by KhoiCanDev
2021-07-10 18:49:56 +00:00
Patric Stout
de7ab2eb1c Cleanup: remove unused optional ctor parameter for NetworkGameList 2021-07-10 20:17:07 +02:00
Patric Stout
6212d0a8da Remove: unused UDP protocol parts 2021-07-10 20:17:07 +02:00
Patric Stout
8a2da49413 Remove: old server listing via Master Server
This removes all UDP from the game except for a local broadcast
to find LAN games.

So long Master Server, and tnx for all the fish!
2021-07-10 20:17:07 +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
Patric Stout
aa93d76223 Add: use Game Coordinator to get latest public server listing 2021-07-10 20:17:07 +02:00
Patric Stout
b1280fd17e Add: use Game Coordinator to annouce public servers 2021-07-10 20:17:07 +02:00
Patric Stout
e1e2212e0e Codechange: track version of network servers to prune once out-of-date 2021-07-10 20:17:07 +02:00