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

[Request] Company rating via Server Admin Port #7889

Open
Hezkore opened this issue Jan 1, 2020 · 4 comments
Open

[Request] Company rating via Server Admin Port #7889

Hezkore opened this issue Jan 1, 2020 · 4 comments

Comments

@Hezkore
Copy link

@Hezkore Hezkore commented Jan 1, 2020

I think it would be really useful if the server admin port was able to tell what company is leading according to the Company League Table found in-game.

openttd_2020-01-01_04-44-13

The information could be stored inside the company class itself as the value rating or similar, along with the already existing values like inaugurated and president.

@nielsmh
Copy link
Contributor

@nielsmh nielsmh commented Jan 1, 2020

While theoretically any enhancements to the admin port ought to be made through Game Script custom messages, I agree that having the admin port more useful by default is not bad.

Anyone wanting to look at this can start here:

/**
* Send the admin some information about a company.
* @param c The company to send the information about.
*/
NetworkRecvStatus ServerNetworkAdminSocketHandler::SendCompanyInfo(const Company *c)
{
char company_name[NETWORK_COMPANY_NAME_LENGTH];
char manager_name[NETWORK_COMPANY_NAME_LENGTH];
SetDParam(0, c->index);
GetString(company_name, STR_COMPANY_NAME, lastof(company_name));
SetDParam(0, c->index);
GetString(manager_name, STR_PRESIDENT_NAME, lastof(manager_name));
Packet *p = new Packet(ADMIN_PACKET_SERVER_COMPANY_INFO);
p->Send_uint8 (c->index);
p->Send_string(company_name);
p->Send_string(manager_name);
p->Send_uint8 (c->colour);
p->Send_bool (NetworkCompanyIsPassworded(c->index));
p->Send_uint32(c->inaugurated_year);
p->Send_bool (c->is_ai);
p->Send_uint8 (CeilDiv(c->months_of_bankruptcy, 3)); // send as quarters_of_bankruptcy
for (size_t i = 0; i < lengthof(c->share_owners); i++) {
p->Send_uint8(c->share_owners[i]);
}
this->SendPacket(p);
return NETWORK_RECV_STATUS_OKAY;
}

@marimeireles
Copy link

@marimeireles marimeireles commented Jan 21, 2020

hey! I wanna work on this one :)

@nielsmh
Copy link
Contributor

@nielsmh nielsmh commented Jan 21, 2020

@marimeireles Nice, welcome :)

One thing to keep in mind if you extend the network protocol, there are existing software that works with the existing protocol, so any changes should aim to stay compatible. I think just adding new fields to the end of the existing message should be safe, but I'm not entirely sure. The alternative would be to define a new type of packet with the additional data.

@Hezkore
Copy link
Author

@Hezkore Hezkore commented Feb 1, 2020

hey! I wanna work on this one :)

Any news?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants
You can’t perform that action at this time.