summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2010-08-03 12:36:40 +0000
committerrubidium <rubidium@openttd.org>2010-08-03 12:36:40 +0000
commit92ac2e485b4a5837be4627860c0f555212052af9 (patch)
tree9a06eb96b5af88a2bf582e53683c31975bb9bcf4 /src
parent1c86321d3526b70deecb5ea04eb3c878ed37808e (diff)
downloadopenttd-92ac2e485b4a5837be4627860c0f555212052af9.tar.xz
(svn r20341) -Codechange: pass the tile of the HQ instead of the company to UpdateCompanyHQ
Diffstat (limited to 'src')
-rw-r--r--src/economy.cpp2
-rw-r--r--src/unmovable.h5
-rw-r--r--src/unmovable_cmd.cpp8
3 files changed, 6 insertions, 9 deletions
diff --git a/src/economy.cpp b/src/economy.cpp
index 10ec4cdfb..ed9212cd2 100644
--- a/src/economy.cpp
+++ b/src/economy.cpp
@@ -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);
}
diff --git a/src/unmovable.h b/src/unmovable.h
index 366889a7d..eaffe4dab 100644
--- a/src/unmovable.h
+++ b/src/unmovable.h
@@ -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.
diff --git a/src/unmovable_cmd.cpp b/src/unmovable_cmd.cpp
index 652b31422..d83e2c843 100644
--- a/src/unmovable_cmd.cpp
+++ b/src/unmovable_cmd.cpp
@@ -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);
}