MCPcopy Create free account
hub / github.com/OpenTTD/OpenTTD / UpdateCompanyHQ

Function UpdateCompanyHQ

src/object_cmd.cpp:165–178  ·  view source on GitHub ↗

* Update the CompanyHQ to the state associated with the given score * @param tile The (northern) tile of the company HQ, or INVALID_TILE. * @param score The current (performance) score of the company. */

Source from the content-addressed store, hash-verified

163 * @param score The current (performance) score of the company.
164 */
165void UpdateCompanyHQ(TileIndex tile, uint score)
166{
167 if (tile == INVALID_TILE) return;
168
169 uint8_t val = 0;
170 if (score >= 170) val++;
171 if (score >= 350) val++;
172 if (score >= 520) val++;
173 if (score >= 720) val++;
174
175 while (GetCompanyHQSize(tile) < val) {
176 IncreaseCompanyHQSize(tile);
177 }
178}
179
180/**
181 * Updates the colour of the object whenever a company changes.

Callers 2

CmdBuildObjectFunction · 0.85

Calls 2

GetCompanyHQSizeFunction · 0.85
IncreaseCompanyHQSizeFunction · 0.85

Tested by

no test coverage detected