{"id":"6VsdHj2Wcq","url":"https://pastebin.ca/6VsdHj2Wcq","raw_url":"https://raw.anybin.ca/6VsdHj2Wcq","visibility":"public","access":"public","created_at":1793952071846,"expires_at":1794556871846,"fetch_limit":null,"fetches_used":0,"reads_remaining":null,"size_bytes":2033,"syntax_hint":"c","title":null,"filename":null,"change_note":null,"cipher":null,"cipher_meta":null,"parent_id":null,"root_id":"6VsdHj2Wcq","version":1,"owner_id":null,"recipient_id":null,"body":"bool __thiscall\nGameCore::AI::CongressSupport::ReligiousTarget\n          (CongressSupport *this,Instance *owner,int outcomeType,GameModifierAnalysis *output)\n\n{\n  PlayerTypes iOwnerPlayerId;\n  int iNumFollowingCities;\n  Religion *pkReligion;\n  ReligionList *pReligionList;\n  const_iterator religions_start;\n  const_iterator religions_end;\n  Instance *pFounderPlayer;\n  Stats *pFounderStats;\n  PlayerTypes iFounderPlayerId;\n  int iMaxNumFollowingCities;\n                    /* default choice (no religion) */\n  output->Religion = NO_RELIGION;\n  pkReligion = GameCore::Game::Religion::Get();\n  pReligionList = GameCore::Game::Religion::GetReligions(pkReligion);\n  religions_start = eastl::vector<>::begin(pReligionList);\n  religions_end = eastl::vector<>::end(pReligionList);\n                    /* this whole block is basically a foreach loop */\n  if (religions_start != religions_end) {\n    iMaxNumFollowingCities = 0;\n    do {\n      iFounderPlayerId = religions_start->m_eFounder;\n      iOwnerPlayerId = GameCore::Player::Instance::GetID(owner);\n      if ((outcomeType == 1) && (iFounderPlayerId == iOwnerPlayerId)) {\n        output->Religion = religions_start->m_eReligion;\n      }\n      else if ((outcomeType == 2) &&\n              (iFounderPlayerId = religions_start->m_eFounder,\n              iOwnerPlayerId = GameCore::Player::Instance::GetID(owner),\n              iFounderPlayerId != iOwnerPlayerId)) {\n        pFounderPlayer = GameCore::Context::Globals::GetPlayer(religions_start->m_eFounder);\n        pFounderStats = GameCore::Player::Instance::GetStats(pFounderPlayer);\n        iNumFollowingCities =\n             GameCore::Player::Stats::GetNumCitiesFollowingReligion(pFounderStats,true);\n        if (iMaxNumFollowingCities < iNumFollowingCities) {\n          output->Religion = religions_start->m_eReligion;\n          iMaxNumFollowingCities = iNumFollowingCities;\n        }\n      }\n      religions_start = religions_start + 1;\n    } while (religions_end != religions_start);\n  }\n  return output->Religion != NO_RELIGION;\n}"}