Hooks
static bool BeforeCvPlayerColorInfo_CacheResults(CvPlayerColorInfo* self, Database::Results& kResults, CvDatabaseUtility& kUtility, bool& result);static void AfterCvPlayerColorInfo_CacheResults(CvPlayerColorInfo* self, Database::Results& kResults, CvDatabaseUtility& kUtility, bool& result);static bool ReplaceCvPlayerColorInfo_CacheResults(bool (*original)(CvPlayerColorInfo*, Database::Results&, CvDatabaseUtility&), CvPlayerColorInfo* self, Database::Results& kResults, CvDatabaseUtility& kUtility);CivRegisterBefore<CivHooks::CvPlayerColorInfo_CacheResults>(host, &BeforeCvPlayerColorInfo_CacheResults);CivRegisterAfter<CivHooks::CvPlayerColorInfo_CacheResults>(host, &AfterCvPlayerColorInfo_CacheResults);CivRegisterReplace<CivHooks::CvPlayerColorInfo_CacheResults>(host, &ReplaceCvPlayerColorInfo_CacheResults);
Code
6999bool CvPlayerColorInfo::CacheResults(Database::Results& kResults, CvDatabaseUtility& kUtility)7000{7001 if(!CvBaseInfo::CacheResults(kResults, kUtility))7002 return false;70037004 //Perform an inner join7005 const char* szSQL = "select PrimaryColor.ID, SecondaryColor.ID, TextColor.ID FROM PlayerColors INNER JOIN "7006 "Colors As PrimaryColor ON PlayerColors.PrimaryColor = PrimaryColor.Type, "7007 "Colors AS SecondaryColor ON PlayerColors.SecondaryColor = SecondaryColor.Type, "7008 "Colors AS TextColor ON PlayerColors.TextColor = TextColor.Type where PlayerColors.ID = ? LIMIT 1; ";70097010 std::string strKey("ColorsLookup");7011 Database::Results* pResults = kUtility.GetResults(strKey);7012 if(pResults == NULL)7013 {7014 pResults = kUtility.PrepareResults(strKey, szSQL);7015 }70167017 pResults->Bind(1, GetID());70187019 while(pResults->Step())7020 {7021 m_iColorTypePrimary = pResults->GetInt(0);7022 m_iColorTypeSecondary = pResults->GetInt(1);7023 m_iColorTypeText = pResults->GetInt(2);7024 }702570267027 return true;7028}