(svn r20341) -Codechange: pass the tile of the HQ instead of the company to UpdateCompanyHQ

This commit is contained in:
rubidium 2010-08-03 12:36:40 +00:00
parent 1c86321d35
commit 92ac2e485b
3 changed files with 6 additions and 9 deletions

View File

@ -292,7 +292,7 @@ int UpdateCompanyRatingAndValue(Company *c, bool update)
if (update) {
c->old_economy[0].performance_history = score;
UpdateCompanyHQ(c, score);
UpdateCompanyHQ(c->location_of_HQ, score);
c->old_economy[0].company_value = CalculateCompanyValue(c);
}

View File

@ -18,11 +18,10 @@
/**
* Update the CompanyHQ to the state associated with the given score
* @param c The company to (possibly) update the HQ of.
* @param tile The (northern) tile of the company HQ, or INVALID_TILE.
* @param score The current (performance) score of the company.
* @pre c != NULL
*/
void UpdateCompanyHQ(Company *c, uint score);
void UpdateCompanyHQ(TileIndex tile, uint score);
/**
* Actually build the unmovable object.

View File

@ -109,13 +109,11 @@ static CommandCost DestroyCompanyHQ(CompanyID cid, DoCommandFlag flags)
return CommandCost(EXPENSES_PROPERTY, CalculateCompanyValue(c) / 100);
}
void UpdateCompanyHQ(Company *c, uint score)
void UpdateCompanyHQ(TileIndex tile, uint score)
{
byte val;
TileIndex tile = c->location_of_HQ;
if (tile == INVALID_TILE) return;
byte val;
(val = 0, score < 170) ||
(val++, score < 350) ||
(val++, score < 520) ||
@ -157,7 +155,7 @@ static CommandCost CmdBuildCompanyHQ(TileIndex tile, DoCommandFlag flags, uint32
BuildUnmovable(UNMOVABLE_HQ, tile, _current_company);
UpdateCompanyHQ(c, score);
UpdateCompanyHQ(tile, score);
SetWindowDirty(WC_COMPANY, c->index);
}