Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add: UDP query of game script #7771

Closed
wants to merge 1 commit into from
Closed

Conversation

TheDude-gh
Copy link
Contributor

Reopened from old flyspray issue #6211.

Patch adds a possibility to query OpenTTD server for running game scripts and returns its name and version if any present.

Goal of this fork is to also create ingame interface.

Reopened from old flyspray issue OpenTTD#6211.

Patch adds a possibility to query OpenTTD server for running game scripts and returns its name and version if any present.

Goal of this fork is to make also ingame interface.
Copy link
Member

@LordAro LordAro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just codestyle issues, nothing major

src/network/core/udp.cpp Show resolved Hide resolved
@@ -32,6 +32,8 @@ enum PacketUDPType {
PACKET_UDP_CLIENT_GET_NEWGRFS, ///< Requests the name for a list of GRFs (GRF_ID and MD5)
PACKET_UDP_SERVER_NEWGRFS, ///< Sends the list of NewGRF's requested.
PACKET_UDP_MASTER_SESSION_KEY, ///< Sends a fresh session key to the client
PACKET_UDP_CLIENT_GET_GAMESCRIPT,///< Requests the name of a game script
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

needs a space separator, or the whole thing needs realigning

if(info == NULL){
packet.Send_uint8(0);
}
else{
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

various codestyle issues with the if here

/** The return of the client's request of the names of GameScript */
void ClientNetworkUDPSocketHandler::Receive_SERVER_GAMESCRIPT(Packet *p, NetworkAddress *client_addr)
{
uint8 num_gs;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need to predeclare the variable, just on-use will be fine

@@ -299,6 +326,7 @@ class ClientNetworkUDPSocketHandler : public NetworkUDPSocketHandler {
void Receive_SERVER_RESPONSE(Packet *p, NetworkAddress *client_addr) override;
void Receive_MASTER_RESPONSE_LIST(Packet *p, NetworkAddress *client_addr) override;
void Receive_SERVER_NEWGRFS(Packet *p, NetworkAddress *client_addr) override;
void Receive_SERVER_GAMESCRIPT(Packet *p, NetworkAddress *client_addr) override;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not tab indented (this is why the commit checker is failing)

@TrueBrain
Copy link
Member

Three things worth mentioning:

  1. I think if we do this, we should add more metadata about the game, not only the name of the gamescript. Like AIs running, km of road put down, etc.
  2. There is already a packet that sends basic information about the server. I am not sure that adding a new packet with just this content is worth it. If we would be to use it, we would query every server twice: once for the generic info, once for this info (or three times if you run NewGRFs). That sounds like the wrong approach. This needs more consideration from a server perspective.
  3. Given the author has not picked up the requested code-changes, I am going to assume there is no longer any interest in adding this function. If there is, please do open up the Pull Request again, and we can talk further :)

@TrueBrain TrueBrain closed this Dec 14, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants