Code
3688/// Checks to see if we have the Resource demanded and if so starts WLTKD in this City3689void CvCity::DoTestResourceDemanded()3690{3691 VALIDATE_OBJECT3692 ResourceTypes eResource = GetResourceDemanded();36933694 if(GetWeLoveTheKingDayCounter() > 0)3695 {3696 ChangeWeLoveTheKingDayCounter(-1);36973698 // WLTKD over!3699 if(GetWeLoveTheKingDayCounter() == 0)3700 {3701 DoPickResourceDemanded();37023703 if(getOwner() == GC.getGame().getActivePlayer())3704 {3705 Localization::String localizedText;3706 // Know what the next Demanded Resource is3707 if(GetResourceDemanded() != NO_RESOURCE)3708 {3709 localizedText = Localization::Lookup("TXT_KEY_MISC_CITY_WLTKD_ENDED_KNOWN_RESOURCE");3710 localizedText << getNameKey() << GC.getResourceInfo(GetResourceDemanded())->GetTextKey();3711 }3712 // Don't know what the next Demanded Resource is3713 else3714 {3715 localizedText = Localization::Lookup("TXT_KEY_MISC_CITY_WLTKD_ENDED_UNKNOWN_RESOURCE");3716 localizedText << getNameKey();3717 }37183719 DLLUI->AddCityMessage(0, GetIDInfo(), getOwner(), false, GC.getEVENT_MESSAGE_TIME(), localizedText.toUTF8());3720 }3721 }3722 }3723 else3724 {3725 if(eResource != NO_RESOURCE)3726 {3727 // Do we have the right Resource?3728 if(GET_PLAYER(getOwner()).getNumResourceTotal(eResource) > 0)3729 {3730 SetWeLoveTheKingDayCounter(/*20*/ GC.getCITY_RESOURCE_WLTKD_TURNS());37313732 CvNotifications* pNotifications = GET_PLAYER(getOwner()).GetNotifications();3733 if(pNotifications)3734 {3735 Localization::String strText = Localization::Lookup("TXT_KEY_NOTIFICATION_CITY_WLTKD");3736 strText << GC.getResourceInfo(eResource)->GetTextKey() << getNameKey();3737 Localization::String strSummary = Localization::Lookup("TXT_KEY_NOTIFICATION_SUMMARY_CITY_WLTKD");3738 strSummary << getNameKey();3739 pNotifications->Add(NOTIFICATION_REQUEST_RESOURCE, strText.toUTF8(), strSummary.toUTF8(), getX(), getY(), eResource);3740 }3741 }3742 }3743 }3744}