/* Compute number of AI companies to start. */ uint ais_to_start = 0; CompanyMask company_mask = 0; for (;;) { if (_networking && current_companies + ais_to_start >= _settings_client.network.max_companies) break; if (current_ais + ais_to_start >= (uint)_settings_game.difficulty.max_no_competitors) break; CompanyID company = AI::GetStartNextCompany(ais_to_start); assert(company != INVALID_COMPANY); assert(!HasBit(company_mask, company)); SetBit(company_mask, company); /* Check if the next AI is also scheduled to start immediately */ ais_to_start++; if (AI::GetStartNextTime(ais_to_start) != 0) break; }