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

Closed
Hezkore opened this issue Jan 1, 2020 · 8 comments
Closed

[Request] Company rating via Server Admin Port #7889

Hezkore opened this issue Jan 1, 2020 · 8 comments
Labels
enhancement Issue would be a good enhancement; we accept Pull Requests! good first issue Good for newcomers

Comments

@Hezkore
Copy link

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 nielsmh added enhancement Issue would be a good enhancement; we accept Pull Requests! good first issue Good for newcomers labels Jan 1, 2020
@nielsmh
Copy link
Contributor

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

hey! I wanna work on this one :)

@nielsmh
Copy link
Contributor

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 commented Feb 1, 2020

hey! I wanna work on this one :)

Any news?

@pon-droid
Copy link

If @marimeireles isn't working on it already, would it be alright if I could have a try?

@Hezkore
Copy link
Author

Hezkore commented Aug 18, 2022

If @marimeireles isn't working on it already, would it be alright if I could have a try?

I think it's fair to say that @marimeireles isn't working on it, as it's been two years heh.

@marimeireles
Copy link

Oops, sorry folks. Go for it!

@TrueBrain
Copy link
Member

This information is already available in COMPANY_ECONOMY, as performance rating. You can just sort this list, and the one with the highest score is #1 in rating!

If you have any questions about this, do let us know!

@TrueBrain TrueBrain closed this as not planned Won't fix, can't repro, duplicate, stale Sep 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Issue would be a good enhancement; we accept Pull Requests! good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

5 participants