summaryrefslogtreecommitdiff
path: root/src/company_cmd.cpp
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2011-01-04 22:50:09 +0000
committerrubidium <rubidium@openttd.org>2011-01-04 22:50:09 +0000
commiteab47d2227bad950dd04ab8498588d40f1f4f725 (patch)
tree190356576f6e488e9be4f5810654c8c8ed329a12 /src/company_cmd.cpp
parent7dafd04f4b867243e2b0a67f8e41d2c9c7047a5b (diff)
downloadopenttd-eab47d2227bad950dd04ab8498588d40f1f4f725.tar.xz
(svn r21728) -Fix/Feature [FS#4331]: (configurably) limit amount of tiles that can be cleared/terraformed by a company
Diffstat (limited to 'src/company_cmd.cpp')
-rw-r--r--src/company_cmd.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/company_cmd.cpp b/src/company_cmd.cpp
index 45d708c92..7b3ad8e03 100644
--- a/src/company_cmd.cpp
+++ b/src/company_cmd.cpp
@@ -58,6 +58,9 @@ Company::Company(uint16 name_1, bool is_ai)
this->name_1 = name_1;
this->location_of_HQ = INVALID_TILE;
this->is_ai = is_ai;
+ this->terraform_limit = _settings_game.construction.terraform_frame_burst << 16;
+ this->clear_limit = _settings_game.construction.clear_frame_burst << 16;
+
for (uint j = 0; j < 4; j++) this->share_owners[j] = COMPANY_SPECTATOR;
InvalidateWindowData(WC_PERFORMANCE_DETAIL, 0, INVALID_COMPANY);
}
@@ -252,6 +255,16 @@ void SubtractMoneyFromCompanyFract(CompanyID company, CommandCost cst)
if (cost != 0) SubtractMoneyFromAnyCompany(c, CommandCost(cst.GetExpensesType(), cost));
}
+/** Update the landscaping limits per company. */
+void UpdateLandscapingLimits()
+{
+ Company *c;
+ FOR_ALL_COMPANIES(c) {
+ c->terraform_limit = min(c->terraform_limit + _settings_game.construction.terraform_per_64k_frames, _settings_game.construction.terraform_frame_burst << 16);
+ c->clear_limit = min(c->clear_limit + _settings_game.construction.clear_per_64k_frames, _settings_game.construction.clear_frame_burst << 16);
+ }
+}
+
/**
* Set the right DParams to get the name of an owner.
* @param owner the owner to get the name of.