src/ai/api/ai_company.cpp
branchnoai
changeset 10291 11cb78922367
parent 10196 aecabd927420
child 10339 ce6cd68d9eb8
equal deleted inserted replaced
10290:74e044af664d 10291:11cb78922367
   139 	if (company == INVALID_COMPANY) return INVALID_TILE;
   139 	if (company == INVALID_COMPANY) return INVALID_TILE;
   140 
   140 
   141 	TileIndex loc = ::GetPlayer((PlayerID)company)->location_of_house;
   141 	TileIndex loc = ::GetPlayer((PlayerID)company)->location_of_house;
   142 	return (loc == 0) ? INVALID_TILE : loc;
   142 	return (loc == 0) ? INVALID_TILE : loc;
   143 }
   143 }
       
   144 
       
   145 /* static */ bool AICompany::SetAutoRenewStatus(bool autorenew)
       
   146 {
       
   147 	return AIObject::DoCommand(0, 0, autorenew ? 1 : 0, CMD_SET_AUTOREPLACE);
       
   148 }
       
   149 
       
   150 /* static */ bool AICompany::GetAutoRenewStatus(CompanyIndex company)
       
   151 {
       
   152 	company = ResolveCompanyIndex(company);
       
   153 	if (company == INVALID_COMPANY) return false;
       
   154 
       
   155 	return ::GetPlayer((PlayerID)company)->engine_renew;
       
   156 }
       
   157 
       
   158 /* static */ bool AICompany::SetAutoRenewMonths(int16 months)
       
   159 {
       
   160 	return AIObject::DoCommand(0, 1, months, CMD_SET_AUTOREPLACE);
       
   161 }
       
   162 
       
   163 /* static */ int16 AICompany::GetAutoRenewMonths(CompanyIndex company)
       
   164 {
       
   165 	company = ResolveCompanyIndex(company);
       
   166 	if (company == INVALID_COMPANY) return 0;
       
   167 
       
   168 	return ::GetPlayer((PlayerID)company)->engine_renew_months;
       
   169 }
       
   170 
       
   171 /* static */ bool AICompany::SetAutoRenewMoney(uint32 money)
       
   172 {
       
   173 	return AIObject::DoCommand(0, 2, money, CMD_SET_AUTOREPLACE);
       
   174 }
       
   175 
       
   176 /* static */ uint32 AICompany::GetAutoRenewMoney(CompanyIndex company)
       
   177 {
       
   178 	company = ResolveCompanyIndex(company);
       
   179 	if (company == INVALID_COMPANY) return 0;
       
   180 
       
   181 	return ::GetPlayer((PlayerID)company)->engine_renew_money;
       
   182 }