src/ai/api/ai_company.cpp
branchnoai
changeset 10291 11cb78922367
parent 10196 aecabd927420
child 10339 ce6cd68d9eb8
--- a/src/ai/api/ai_company.cpp	Mon Apr 21 18:09:52 2008 +0000
+++ b/src/ai/api/ai_company.cpp	Mon Apr 21 20:33:03 2008 +0000
@@ -141,3 +141,42 @@
 	TileIndex loc = ::GetPlayer((PlayerID)company)->location_of_house;
 	return (loc == 0) ? INVALID_TILE : loc;
 }
+
+/* static */ bool AICompany::SetAutoRenewStatus(bool autorenew)
+{
+	return AIObject::DoCommand(0, 0, autorenew ? 1 : 0, CMD_SET_AUTOREPLACE);
+}
+
+/* static */ bool AICompany::GetAutoRenewStatus(CompanyIndex company)
+{
+	company = ResolveCompanyIndex(company);
+	if (company == INVALID_COMPANY) return false;
+
+	return ::GetPlayer((PlayerID)company)->engine_renew;
+}
+
+/* static */ bool AICompany::SetAutoRenewMonths(int16 months)
+{
+	return AIObject::DoCommand(0, 1, months, CMD_SET_AUTOREPLACE);
+}
+
+/* static */ int16 AICompany::GetAutoRenewMonths(CompanyIndex company)
+{
+	company = ResolveCompanyIndex(company);
+	if (company == INVALID_COMPANY) return 0;
+
+	return ::GetPlayer((PlayerID)company)->engine_renew_months;
+}
+
+/* static */ bool AICompany::SetAutoRenewMoney(uint32 money)
+{
+	return AIObject::DoCommand(0, 2, money, CMD_SET_AUTOREPLACE);
+}
+
+/* static */ uint32 AICompany::GetAutoRenewMoney(CompanyIndex company)
+{
+	company = ResolveCompanyIndex(company);
+	if (company == INVALID_COMPANY) return 0;
+
+	return ::GetPlayer((PlayerID)company)->engine_renew_money;
+}