Loading

Paste #prhtd41fx

  1. /* static */ int AI::GetStartNextTime(uint count)
  2. {
  3.     /* Find the first company which doesn't exist yet */
  4.     for (CompanyID c = COMPANY_FIRST; c < MAX_COMPANIES; c++) {
  5.         if (!Company::IsValidID(c)) {
  6.             if (count == 0) return AIConfig::GetConfig(c, AIConfig::SSS_FORCE_GAME)->GetSetting("start_date");
  7.             count--;
  8.         }
  9.     }
  10.  
  11.     /* Currently no AI can be started, check again in a year. */
  12.     return DAYS_IN_YEAR;
  13. }
  14.  
  15. /* static */ CompanyID AI::GetStartNextCompany(uint count)
  16. {
  17.     /* Find the first company which doesn't exist yet */
  18.     for (CompanyID c = COMPANY_FIRST; c < MAX_COMPANIES; c++) {
  19.         if (!Company::IsValidID(c)) {
  20.             if (count == 0) return c;
  21.             count--;
  22.         }
  23.     }
  24.  
  25.     /* Currently no AI can be started, check again in a year. */
  26.     return INVALID_COMPANY;
  27. }

Comments