mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-08-24 06:59:10 +00:00
Codechange: Using alias and std::array for company expense storage. (#11273)
This simplifies passing yearly expenses to functions and use of std algorithms.
This commit is contained in:
@@ -383,10 +383,7 @@ NetworkRecvStatus ServerNetworkAdminSocketHandler::SendCompanyEconomy()
|
||||
{
|
||||
for (const Company *company : Company::Iterate()) {
|
||||
/* Get the income. */
|
||||
Money income = 0;
|
||||
for (uint i = 0; i < lengthof(company->yearly_expenses[0]); i++) {
|
||||
income -= company->yearly_expenses[0][i];
|
||||
}
|
||||
Money income = -std::reduce(std::begin(company->yearly_expenses[0]), std::end(company->yearly_expenses[0]));
|
||||
|
||||
Packet *p = new Packet(ADMIN_PACKET_SERVER_COMPANY_ECONOMY);
|
||||
|
||||
|
Reference in New Issue
Block a user