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
Added widget showing company slots remaining #10054
Conversation
In the lines you added, the code must be indented with tabs instead of spaces. Also, the commit title must be changed to read as follows: |
Seems reasonable. Just a few things:
|
If it is desired to keep it as one line only at the bottom, it could say something like "3 / 100 clients - 5 / 15 companies" |
Mm, does seem reasonable to keep it consistent. Total possible number of clients seems redundant when you're already connected to the server, but again, consistent. |
Yea I get the need for consistency, I can show a preview of those proposed changes if y'all want once I get off work |
In my opinion and for me the problem is a bit that the bar and the create a new company button disappears. For example, it will disappear if the list is long and you scroll down. The same is true when it is not possible to start a company because all available slots have been taken. Honestly, I still haven't got used to it until today. I like the idea of Bouke and James103. It takes up less space, is equally pithy and consistent with what is in the server list window. I would also have some idea what else can be changed in this or other PR.
By the way, I would like to remind about the problem of the inability to reduce the width of this window, which is almost always much wider than it should (#9697). I mention it, if only so that this PR doesn't somehow reinforce this bug. |
@zachtyson Are you still interested in working on this? Would be nice to have in the upcoming OpenTTD 13 release. 🙂 |
@@ -1785,6 +1786,10 @@ struct NetworkClientListWindow : Window { | |||
break; | |||
} | |||
|
|||
case WID_CL_CLIENT_COMPANY_REMAINING: | |||
SetDParam(0, _settings_client.network.max_companies - Company::GetNumItems()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This setting does not get updated from the server. So, it will not be right when joining the server and whenever the server changes it won't be right. Unless "accidentally" the configuration value at the server happens to be the same as for your client, which is quite likely when testing it locally.
I would suggest you look at NetworkMaxCompaniesReached
and add a similar function at those locations that returns the number of companies that are remaining. I would then also suggest changing NetworkMaxCompaniesReached
so it uses that new function and compares that count with 0. That way the logic that chooses between the variables containing the maximum number of companies does not get duplicated and if the logic requires changes it is less likely that the other function is missed.
Motivation / Problem
I've seen a few new players join and try to create a company, not realizing that the game has reached the maximum amount of companies, e.g #9703 , which is easier to see at a glance.
Description
Adds a single line above company/client count to display the amount of remaining companies that can be created.
Limitations
The addition simply shows the amount of existing companies minus the max amount of companies. Can be changed from '0 company slots' to 'FULL' if desired
Closes #9703 - edit 2TT
Checklist for review
Some things are not automated, and forgotten often. This list is a reminder for the reviewers.