Do this by cheating a little: create a map with count of clients using
given username and increment it each time such a username is
encountered. This yields very similar results to actually counting users
holding given name, but saves all the error-prone string parsing.
This change also fixes passworded servers not working properly, as
strlen() was getting called on something that was not guaranteed to be
null-terminated string when signing the token.
`send()` can only write to connected sockets [1]. In case where client
drops out, a socket may become closed by OS but we can still enqueue
packets for its connection and eventually call `send()`, which will
generate a SIGPIPE and shut the server down, because there was no
`MSG_NOSIGNAL` set.
This commit makes sure `MSG_NOSIGNAL` is used on Linux.
[1] http://linux.die.net/man/2/send
This will let players know which version should they be using to connect
to server. Also prevents users from even trying to join servers running
versions we already know are incompatible.
I extracted all of the hardcoded network-related strings. In addition to that, I also refactored the way last_disconnect_reason was being accessed/modified.
This oneliner causes the game not to crash, when connecting to a network game that utilizes objects, that the connecting client doesn't have installed. Instead, it quits to the main menu with an error message being displayed.
Sometimes the resolver is still in progress while an update checks its
status, which is `INPROGRESS` and makes the game think there was a
connection failure.
This lets resolver continue doing its job if the status is `INPROGRESS`.
This allows to present a different version of network stream than just
OpenRCT2 version, as we can possibly have breaking changes to network in
one release cycle.
This commit also adds easy way of identification which hosts are running
which versions, by showing a tooltip when hovering mouse cursor over the
network compatibility icon. Client's own version is displayed as well.