script_company.hpp

Go to the documentation of this file.
00001 /* $Id: script_company.hpp 23636 2011-12-19 21:06:06Z truebrain $ */
00002 
00003 /*
00004  * This file is part of OpenTTD.
00005  * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
00006  * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
00007  * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
00008  */
00009 
00012 #ifndef SCRIPT_COMPANY_HPP
00013 #define SCRIPT_COMPANY_HPP
00014 
00015 #include "script_object.hpp"
00016 #include "script_text.hpp"
00017 
00022 class ScriptCompany : public ScriptObject {
00023 public:
00025   enum Quarter {
00026     CURRENT_QUARTER  = 0,                      
00027     EARLIEST_QUARTER = ::MAX_HISTORY_QUARTERS, 
00028   };
00029 
00031   enum CompanyID {
00032     /* Note: these values represent part of the in-game Owner enum */
00033     COMPANY_FIRST   = ::COMPANY_FIRST,   
00034     COMPANY_LAST    = ::MAX_COMPANIES,   
00035 
00036     /* Custom added value, only valid for this API */
00037     COMPANY_INVALID = -1,                
00038     COMPANY_SELF    = 254,               
00039   };
00040 
00042   enum Gender {
00043     GENDER_MALE,         
00044     GENDER_FEMALE,       
00045     GENDER_INVALID = -1, 
00046   };
00047 
00056   static CompanyID ResolveCompanyID(CompanyID company);
00057 
00064   static bool IsMine(CompanyID company);
00065 
00073   static bool SetName(Text *name);
00074 
00081   static char *GetName(CompanyID company);
00082 
00090   static bool SetPresidentName(Text *name);
00091 
00098   static char *GetPresidentName(CompanyID company);
00099 
00108   static bool SetPresidentGender(Gender gender);
00109 
00115   static Gender GetPresidentGender(CompanyID company);
00116 
00127   static bool SetLoanAmount(int32 loan);
00128 
00137   static bool SetMinimumLoanAmount(int32 loan);
00138 
00144   static Money GetLoanAmount();
00145 
00151   static Money GetMaxLoanAmount();
00152 
00158   static Money GetLoanInterval();
00159 
00166   static Money GetBankBalance(CompanyID company);
00167 
00176   static Money GetQuarterlyIncome(CompanyID company, uint32 quarter);
00177 
00186   static Money GetQuarterlyExpenses(CompanyID company, uint32 quarter);
00187 
00196   static int32 GetQuarterlyCargoDelivered(CompanyID company, uint32 quarter);
00197 
00208   static int32 GetQuarterlyPerformanceRating(CompanyID company, uint32 quarter);
00209 
00218   static Money GetQuarterlyCompanyValue(CompanyID company, uint32 quarter);
00219 
00231   static bool BuildCompanyHQ(TileIndex tile);
00232 
00240   static TileIndex GetCompanyHQ(CompanyID company);
00241 
00248   static bool SetAutoRenewStatus(bool autorenew);
00249 
00256   static bool GetAutoRenewStatus(CompanyID company);
00257 
00264   static bool SetAutoRenewMonths(int16 months);
00265 
00272   static int16 GetAutoRenewMonths(CompanyID company);
00273 
00280   static bool SetAutoRenewMoney(uint32 money);
00281 
00288   static uint32 GetAutoRenewMoney(CompanyID company);
00289 };
00290 
00291 DECLARE_POSTFIX_INCREMENT(ScriptCompany::CompanyID)
00292 
00293 #endif /* SCRIPT_COMPANY_HPP */