//------------------------------------------------------------------------------ void CvDllNetMessageHandler::ResponseEnhanceReligion(PlayerTypes ePlayer, ReligionTypes eReligion, const char* szCustomName, BeliefTypes eBelief1, BeliefTypes eBelief2, int iCityX, int iCityY) { CvGame& kGame(GC.getGame()); CvGameReligions* pkGameReligions(kGame.GetGameReligions()); CvGameReligions::FOUNDING_RESULT eResult = pkGameReligions->CanEnhanceReligion(ePlayer, eReligion, eBelief1, eBelief2); if(eResult == CvGameReligions::FOUNDING_OK) pkGameReligions->EnhanceReligion(ePlayer, eReligion, eBelief1, eBelief2); else { CvGameReligions::NotifyPlayer(ePlayer, eResult); // We don't want them to lose the opportunity to enhance the religion, and the Great Prophet is already gone so just repost the notification CvCity* pkCity = GC.getMap().plot(iCityX, iCityY)->getPlotCity(); CvPlayerAI& kPlayer = GET_PLAYER(ePlayer); if(kPlayer.isHuman() && eResult != CvGameReligions::FOUNDING_NO_RELIGIONS_AVAILABLE && pkCity) { CvNotifications* pNotifications = kPlayer.GetNotifications(); if(pNotifications) { CvString strBuffer = GetLocalizedText("TXT_KEY_NOTIFICATION_ENHANCE_RELIGION"); CvString strSummary = GetLocalizedText("TXT_KEY_NOTIFICATION_SUMMARY_ENHANCE_RELIGION"); #if defined(MOD_API_EXTENSIONS) pNotifications->Add(NOTIFICATION_ENHANCE_RELIGION, strBuffer, strSummary, iCityX, iCityY, eReligion, pkCity->GetID()); #else pNotifications->Add(NOTIFICATION_ENHANCE_RELIGION, strBuffer, strSummary, iCityX, iCityY, -1, pkCity->GetID()); #endif } kPlayer.GetReligions()->SetFoundingReligion(true); } } }
//------------------------------------------------------------------------------ void CvDllNetMessageHandler::ResponseFoundReligion(PlayerTypes ePlayer, ReligionTypes eReligion, const char* szCustomName, BeliefTypes eBelief1, BeliefTypes eBelief2, BeliefTypes eBelief3, BeliefTypes eBelief4, int iCityX, int iCityY) { CvGame& kGame(GC.getGame()); CvGameReligions* pkGameReligions(kGame.GetGameReligions()); CvCity* pkCity = GC.getMap().plot(iCityX, iCityY)->getPlotCity(); if(pkCity && ePlayer != NO_PLAYER) { CvGameReligions::FOUNDING_RESULT eResult = pkGameReligions->CanFoundReligion(ePlayer, eReligion, szCustomName, eBelief1, eBelief2, eBelief3, eBelief4, pkCity); if(eResult == CvGameReligions::FOUNDING_OK) pkGameReligions->FoundReligion(ePlayer, eReligion, szCustomName, eBelief1, eBelief2, eBelief3, eBelief4, pkCity); else { CvGameReligions::NotifyPlayer(ePlayer, eResult); // We don't want them to lose the opportunity to found the religion, and the Great Prophet is already gone so just repost the notification // If someone beat them to the last religion, well... tough luck. CvPlayerAI& kPlayer = GET_PLAYER(ePlayer); if(kPlayer.isHuman() && eResult != CvGameReligions::FOUNDING_NO_RELIGIONS_AVAILABLE) { CvNotifications* pNotifications = kPlayer.GetNotifications(); if(pNotifications) { CvString strBuffer = GetLocalizedText("TXT_KEY_NOTIFICATION_FOUND_RELIGION"); CvString strSummary = GetLocalizedText("TXT_KEY_NOTIFICATION_SUMMARY_FOUND_RELIGION"); pNotifications->Add(NOTIFICATION_FOUND_RELIGION, strBuffer, strSummary, iCityX, iCityY, -1, pkCity->GetID()); } kPlayer.GetReligions()->SetFoundingReligion(true); } } } }
void CvGameTextMgr::setYearStr(CvString& strString, int iGameTurn, bool bSave, CalendarTypes eCalendar, int iStartYear, GameSpeedTypes eSpeed) { int iTurnYear = getTurnYearForGame(iGameTurn, iStartYear, eCalendar, eSpeed); if (iTurnYear < 0) { if (bSave) { strString = GetLocalizedText("TXT_KEY_TIME_BC_SAVE", CvString::format("%04d", -iTurnYear).GetCString(), CvString::format("%04d", iGameTurn).GetCString()); } else { strString = GetLocalizedText("TXT_KEY_TIME_BC", -(iTurnYear)); } } else if (iTurnYear > 0) { if (bSave) { strString = GetLocalizedText("TXT_KEY_TIME_AD_SAVE", CvString::format("%04d", iTurnYear).GetCString(), CvString::format("%04d", iGameTurn).GetCString()); } else { strString = GetLocalizedText("TXT_KEY_TIME_AD", iTurnYear); } } else { if (bSave) { strString = GetLocalizedText("TXT_KEY_TIME_AD_SAVE", "0001", CvString::format("%04d", iGameTurn).GetCString()); } else { strString = GetLocalizedText("TXT_KEY_TIME_AD", 1); } } }
void CvGameTextMgr::setDateStr(CvString& strString, int iGameTurn, bool bSave, CalendarTypes eCalendar, int iStartYear, GameSpeedTypes eSpeed) { CvString strYearBuffer; CvString strWeekBuffer; setYearStr(strYearBuffer, iGameTurn, bSave, eCalendar, iStartYear, eSpeed); const int iNumMonths = DB.Count("Months"); const int iNumSeasons = DB.Count("Seasons"); switch (eCalendar) { case CALENDAR_DEFAULT: { int iTurnMonth = getTurnMonthForGame(iGameTurn, iStartYear, eCalendar, eSpeed); if (0 == (getTurnMonthForGame(iGameTurn + 1, iStartYear, eCalendar, eSpeed) - iTurnMonth) % iNumMonths) { strString = strYearBuffer; } else { int iMonth = iTurnMonth % iNumMonths; Database::SingleResult kResult; CvBaseInfo kInfo; DB.SelectAt(kResult, "Months", iMonth); kInfo.CacheResult(kResult); Localization::String lstrMonth = Localization::Lookup(kInfo.GetDescription()); CvString strMonth = lstrMonth.toUTF8(); if (bSave) { strString = (strYearBuffer + "-" + strMonth); } else { strString = (strMonth + CvString(", ") + strYearBuffer); } } } break; case CALENDAR_YEARS: case CALENDAR_BI_YEARLY: strString = strYearBuffer; break; case CALENDAR_TURNS: strString = GetLocalizedText("TXT_KEY_TIME_TURN", (iGameTurn + 1)); break; case CALENDAR_SEASONS: { CvBaseInfo kSeasonInfo; Database::SingleResult kResult; DB.SelectAt(kResult, "Seasons", iGameTurn % iNumSeasons); kSeasonInfo.CacheResult(kResult); const char* Desc = kSeasonInfo.GetDescription(); if (bSave) { strString = (strYearBuffer + "-" + CvString(Desc)); } else { strString = (CvString(Desc) + CvString(", ") + strYearBuffer); } } break; case CALENDAR_MONTHS: { CvBaseInfo kMonthInfo; Database::SingleResult kResult; DB.SelectAt(kResult, "Months", iGameTurn % iNumMonths); kMonthInfo.CacheResult(kResult); const char* Descr = kMonthInfo.GetDescription(); if (bSave) { strString = (strYearBuffer + "-" + CvString(Descr)); } else { strString = (CvString(Descr) + CvString(", ") + strYearBuffer); } } break; case CALENDAR_WEEKS: { strWeekBuffer = GetLocalizedText("TXT_KEY_TIME_WEEK", ((iGameTurn % GC.getWEEKS_PER_MONTHS()) + 1)); const int idx = (iGameTurn / GC.getWEEKS_PER_MONTHS()) % iNumMonths; CvBaseInfo kCalendarInfo; Database::SingleResult kResult; DB.SelectAt(kResult, "Months", idx); kCalendarInfo.CacheResult(kResult); const char* Descr = kCalendarInfo.GetDescription(); if (bSave) { strString = (strYearBuffer + "-" + CvString(Descr) + "-" + strWeekBuffer); } else { strString = (strWeekBuffer + ", " + CvString(Descr) + ", " + strYearBuffer); } } break; default: CvAssert(false); } }