Hooks
static bool BeforeCvPlayerEspionage_AddIntrigueMessage(CvPlayerEspionage* self, PlayerTypes eDiscoveringPlayer, PlayerTypes eSourcePlayer, PlayerTypes eTargetPlayer, BuildingTypes eBuilding, ProjectTypes eProject, CvIntrigueType eIntrigueType, uint uiSpyIndex, CvCity* pCity, bool bShowNotification);static void AfterCvPlayerEspionage_AddIntrigueMessage(CvPlayerEspionage* self, PlayerTypes eDiscoveringPlayer, PlayerTypes eSourcePlayer, PlayerTypes eTargetPlayer, BuildingTypes eBuilding, ProjectTypes eProject, CvIntrigueType eIntrigueType, uint uiSpyIndex, CvCity* pCity, bool bShowNotification);static void ReplaceCvPlayerEspionage_AddIntrigueMessage(void (*original)(CvPlayerEspionage*, PlayerTypes, PlayerTypes, PlayerTypes, BuildingTypes, ProjectTypes, CvIntrigueType, uint, CvCity*, bool), CvPlayerEspionage* self, PlayerTypes eDiscoveringPlayer, PlayerTypes eSourcePlayer, PlayerTypes eTargetPlayer, BuildingTypes eBuilding, ProjectTypes eProject, CvIntrigueType eIntrigueType, uint uiSpyIndex, CvCity* pCity, bool bShowNotification);CivRegisterBefore<CivHooks::CvPlayerEspionage_AddIntrigueMessage>(host, &BeforeCvPlayerEspionage_AddIntrigueMessage);CivRegisterAfter<CivHooks::CvPlayerEspionage_AddIntrigueMessage>(host, &AfterCvPlayerEspionage_AddIntrigueMessage);CivRegisterReplace<CivHooks::CvPlayerEspionage_AddIntrigueMessage>(host, &ReplaceCvPlayerEspionage_AddIntrigueMessage);
Code
2963/// AddIntrigueMessage - This is called when a piece of intrigue is found out by a spy. The reason it is kept in a list is to prevent repeat messages warning about the2964/// same event by the same spy2965void CvPlayerEspionage::AddIntrigueMessage(PlayerTypes eDiscoveringPlayer, PlayerTypes eSourcePlayer, PlayerTypes eTargetPlayer, BuildingTypes eBuilding, ProjectTypes eProject, CvIntrigueType eIntrigueType, uint uiSpyIndex, CvCity* pCity, bool bShowNotification)2966{2967 CvAssertMsg(GetNumSpies() > 0, "How can you add an intrigue message when there are no spies?");29682969 int iCityX = -1;2970 int iCityY = -1;2971 if(pCity)2972 {2973 iCityX = pCity->getX();2974 iCityY = pCity->getY();2975 }29762977 // go through all the intrigue messages to see if there is a duplicate2978 for(uint ui = 0; ui < m_aIntrigueNotificationMessages.size(); ui++)2979 {2980 if (m_aIntrigueNotificationMessages[ui].m_eSourcePlayer == eSourcePlayer &&2981 m_aIntrigueNotificationMessages[ui].m_eTargetPlayer == eTargetPlayer &&2982 m_aIntrigueNotificationMessages[ui].m_iIntrigueType == eIntrigueType)2983 {2984 bool bDuplicateTimer = GC.getGame().getGameTurn() - m_aIntrigueNotificationMessages[ui].m_iTurnNum < 30;29852986 if (eIntrigueType == INTRIGUE_TYPE_DECEPTION || eIntrigueType == INTRIGUE_TYPE_BUILDING_ARMY || eIntrigueType == INTRIGUE_TYPE_BUILDING_AMPHIBIOUS_ARMY)2987 {2988 if(bDuplicateTimer)2989 {2990 // if duplicate is found, exit the function2991 return;2992 }2993 }2994 else if (m_aIntrigueNotificationMessages[ui].m_eBuilding == eBuilding &&2995 m_aIntrigueNotificationMessages[ui].m_eProject == eProject &&2996 m_aIntrigueNotificationMessages[ui].m_iCityX == iCityX &&2997 m_aIntrigueNotificationMessages[ui].m_iCityY == iCityY)2998 {2999 if(bDuplicateTimer)3000 {3001 // if duplicate is found, exit the function3002 return;3003 }3004 }3005 }3006 }30073008 // no matching message found so adding it to the list3009 IntrigueNotificationMessage kMessage;3010 kMessage.m_eDiscoveringPlayer = eDiscoveringPlayer;3011 kMessage.m_eSourcePlayer = eSourcePlayer;3012 kMessage.m_eTargetPlayer = eTargetPlayer;3013 kMessage.m_eBuilding = eBuilding;3014 kMessage.m_eProject = eProject;3015 kMessage.m_iIntrigueType = eIntrigueType;3016 kMessage.m_iCityX = iCityX;3017 kMessage.m_iCityY = iCityY;3018 kMessage.m_iTurnNum = GC.getGame().getGameTurn();3019 kMessage.m_strSpyName = "";3020 if (eDiscoveringPlayer == m_pPlayer->GetID())3021 {3022 Localization::String str = Localization::Lookup("TXT_KEY_SPY_FULL_NAME");3023 str << GetSpyRankName(m_aSpyList[uiSpyIndex].m_eRank);3024#if defined(MOD_BUGFIX_SPY_NAMES)3025 str << m_aSpyList[uiSpyIndex].GetSpyName(m_pPlayer);3026#else3027 str << m_pPlayer->getCivilizationInfo().getSpyNames(m_aSpyList[uiSpyIndex].m_iName);3028#endif3029 kMessage.m_strSpyName = str.toUTF8();3030 }3031 kMessage.m_bShared = false;3032 m_aIntrigueNotificationMessages.push_back(kMessage);30333034 if (bShowNotification)3035 {3036 CvNotifications* pNotifications = m_pPlayer->GetNotifications();3037 CvAssertMsg(pNotifications, "No notifications found. This is wrong!");3038 if(!pNotifications)3039 {3040 return;3041 }30423043 switch(kMessage.m_iIntrigueType)3044 {3045 case INTRIGUE_TYPE_DECEPTION:3046 {3047 Localization::String strSummary;3048 Localization::String strNotification;3049 if(kMessage.m_eTargetPlayer == m_pPlayer->GetID()) // if we found intrigue related to us3050 {3051 strSummary = Localization::Lookup("TXT_KEY_NOTIFICATION_INTRIGUE_PLOTTING_AGAINST_YOU_S");3052 if(GC.getGame().isGameMultiPlayer() && GET_PLAYER(kMessage.m_eSourcePlayer).isHuman())3053 {3054 strSummary << GET_PLAYER(kMessage.m_eSourcePlayer).getNickName();3055 }3056 else3057 {3058 strSummary << GET_PLAYER(kMessage.m_eSourcePlayer).getNameKey();3059 }30603061 strNotification = Localization::Lookup("TXT_KEY_NOTIFICATION_INTRIGUE_PLOTTING_AGAINST_YOU");3062 strNotification << GetSpyRankName(m_aSpyList[uiSpyIndex].m_eRank);3063#if defined(MOD_BUGFIX_SPY_NAMES)3064 strNotification << m_aSpyList[uiSpyIndex].GetSpyName(m_pPlayer);3065#else3066 strNotification << m_pPlayer->getCivilizationInfo().getSpyNames(m_aSpyList[uiSpyIndex].m_iName);3067#endif3068 CvAssertMsg(pCity, "City should be defined but is null");3069 if(pCity)3070 {3071 strNotification << pCity->getNameKey();3072 }3073 if(GC.getGame().isGameMultiPlayer() && GET_PLAYER(kMessage.m_eSourcePlayer).isHuman())3074 {3075 strNotification << GET_PLAYER(kMessage.m_eSourcePlayer).getNickName();3076 }3077 else3078 {3079 strNotification << GET_PLAYER(kMessage.m_eSourcePlayer).getNameKey();3080 }3081 }3082 else if(kMessage.m_eTargetPlayer == NO_PLAYER) // if we don't know who the intrigue information is about3083 {3084 strSummary = Localization::Lookup("TXT_KEY_NOTIFICATION_INTRIGUE_PLOTTING_AGAINST_UNKNOWN_S");3085 if(GC.getGame().isGameMultiPlayer() && GET_PLAYER(kMessage.m_eSourcePlayer).isHuman())3086 {3087 strSummary << GET_PLAYER(kMessage.m_eSourcePlayer).getNickName();3088 }3089 else3090 {3091 strSummary << GET_PLAYER(kMessage.m_eSourcePlayer).getNameKey();3092 }30933094 strNotification = Localization::Lookup("TXT_KEY_NOTIFICATION_INTRIGUE_PLOTTING_AGAINST_UNKNOWN");3095 strNotification << GetSpyRankName(m_aSpyList[uiSpyIndex].m_eRank);3096#if defined(MOD_BUGFIX_SPY_NAMES)3097 strNotification << m_aSpyList[uiSpyIndex].GetSpyName(m_pPlayer);3098#else3099 strNotification << m_pPlayer->getCivilizationInfo().getSpyNames(m_aSpyList[uiSpyIndex].m_iName);3100#endif3101 CvAssertMsg(pCity, "City should be defined but is null");3102 if(pCity)3103 {3104 strNotification << pCity->getNameKey();3105 }3106 if(GC.getGame().isGameMultiPlayer() && GET_PLAYER(kMessage.m_eSourcePlayer).isHuman())3107 {3108 strNotification << GET_PLAYER(kMessage.m_eSourcePlayer).getNickName();3109 }3110 else3111 {3112 strNotification << GET_PLAYER(kMessage.m_eSourcePlayer).getNameKey();3113 }3114 }3115 else // if we found intrigue related to another player3116 {3117 strSummary = Localization::Lookup("TXT_KEY_NOTIFICATION_INTRIGUE_PLOTTING_AGAINST_KNOWN_S");3118 if(GC.getGame().isGameMultiPlayer() && GET_PLAYER(kMessage.m_eSourcePlayer).isHuman())3119 {3120 strSummary << GET_PLAYER(kMessage.m_eSourcePlayer).getNickName();3121 }3122 else3123 {3124 strSummary << GET_PLAYER(kMessage.m_eSourcePlayer).getNameKey();3125 }31263127 if(GC.getGame().isGameMultiPlayer() && GET_PLAYER(kMessage.m_eTargetPlayer).isHuman())3128 {3129 strSummary << GET_PLAYER(kMessage.m_eTargetPlayer).getNickName();3130 }3131 else3132 {3133 strSummary << GET_PLAYER(kMessage.m_eTargetPlayer).getNameKey();3134 }31353136 strNotification = Localization::Lookup("TXT_KEY_NOTIFICATION_INTRIGUE_PLOTTING_AGAINST_KNOWN");3137 strNotification << GetSpyRankName(m_aSpyList[uiSpyIndex].m_eRank);3138#if defined(MOD_BUGFIX_SPY_NAMES)3139 strNotification << m_aSpyList[uiSpyIndex].GetSpyName(m_pPlayer);3140#else3141 strNotification << m_pPlayer->getCivilizationInfo().getSpyNames(m_aSpyList[uiSpyIndex].m_iName);3142#endif3143 CvAssertMsg(pCity, "City should be defined but is null");3144 if(pCity)3145 {3146 strNotification << pCity->getNameKey();3147 }3148 if(GC.getGame().isGameMultiPlayer() && GET_PLAYER(kMessage.m_eSourcePlayer).isHuman())3149 {3150 strNotification << GET_PLAYER(kMessage.m_eSourcePlayer).getNickName();3151 }3152 else3153 {3154 strNotification << GET_PLAYER(kMessage.m_eSourcePlayer).getNameKey();3155 }31563157 if(GC.getGame().isGameMultiPlayer() && GET_PLAYER(kMessage.m_eTargetPlayer).isHuman())3158 {3159 strNotification << GET_PLAYER(kMessage.m_eTargetPlayer).getNickName();3160 }3161 else3162 {3163 strNotification << GET_PLAYER(kMessage.m_eTargetPlayer).getNameKey();3164 }3165 }3166 pNotifications->Add(NOTIFICATION_INTRIGUE_DECEPTION, strNotification.toUTF8(), strSummary.toUTF8(), -1, -1, kMessage.m_eTargetPlayer);3167 }3168 break;3169 case INTRIGUE_TYPE_BUILDING_ARMY:3170 {3171 Localization::String strSummary;3172 Localization::String strNotification;31733174 strSummary = Localization::Lookup("TXT_KEY_NOTIFICATION_INTRIGUE_BUILDING_ARMY_S");3175 if(GC.getGame().isGameMultiPlayer() && GET_PLAYER(kMessage.m_eSourcePlayer).isHuman())3176 {3177 strSummary << GET_PLAYER(kMessage.m_eSourcePlayer).getNickName();3178 }3179 else3180 {3181 strSummary << GET_PLAYER(kMessage.m_eSourcePlayer).getNameKey();3182 }31833184 strNotification = Localization::Lookup("TXT_KEY_NOTIFICATION_INTRIGUE_BUILDING_ARMY");3185 strNotification << GetSpyRankName(m_aSpyList[uiSpyIndex].m_eRank);3186#if defined(MOD_BUGFIX_SPY_NAMES)3187 strNotification << m_aSpyList[uiSpyIndex].GetSpyName(m_pPlayer);3188#else3189 strNotification << m_pPlayer->getCivilizationInfo().getSpyNames(m_aSpyList[uiSpyIndex].m_iName);3190#endif3191 if(GC.getGame().isGameMultiPlayer() && GET_PLAYER(kMessage.m_eSourcePlayer).isHuman())3192 {3193 strNotification << GET_PLAYER(kMessage.m_eSourcePlayer).getNickName();3194 }3195 else3196 {3197 strNotification << GET_PLAYER(kMessage.m_eSourcePlayer).getNameKey();3198 }31993200 pNotifications->Add(NOTIFICATION_INTRIGUE_BUILDING_SNEAK_ATTACK_ARMY, strNotification.toUTF8(), strSummary.toUTF8(), -1, -1, -1);3201 }3202 break;3203 case INTRIGUE_TYPE_BUILDING_AMPHIBIOUS_ARMY:3204 {3205 Localization::String strSummary;3206 Localization::String strNotification;32073208 strSummary = Localization::Lookup("TXT_KEY_NOTIFICATION_INTRIGUE_BUILDING_AMPHIBIOUS_ARMY_S");3209 if(GC.getGame().isGameMultiPlayer() && GET_PLAYER(kMessage.m_eSourcePlayer).isHuman())3210 {3211 strSummary << GET_PLAYER(kMessage.m_eSourcePlayer).getNickName();3212 }3213 else3214 {3215 strSummary << GET_PLAYER(kMessage.m_eSourcePlayer).getNameKey();3216 }32173218 strNotification = Localization::Lookup("TXT_KEY_NOTIFICATION_INTRIGUE_BUILDING_AMPHIBIOUS_ARMY");3219 strNotification << GetSpyRankName(m_aSpyList[uiSpyIndex].m_eRank);3220#if defined(MOD_BUGFIX_SPY_NAMES)3221 strNotification << m_aSpyList[uiSpyIndex].GetSpyName(m_pPlayer);3222#else3223 strNotification << m_pPlayer->getCivilizationInfo().getSpyNames(m_aSpyList[uiSpyIndex].m_iName);3224#endif3225 if(GC.getGame().isGameMultiPlayer() && GET_PLAYER(kMessage.m_eSourcePlayer).isHuman())3226 {3227 strNotification << GET_PLAYER(kMessage.m_eSourcePlayer).getNickName();3228 }3229 else3230 {3231 strNotification << GET_PLAYER(kMessage.m_eSourcePlayer).getNameKey();3232 }32333234 pNotifications->Add(NOTIFICATION_INTRIGUE_BUILDING_SNEAK_ATTACK_AMPHIBIOUS, strNotification.toUTF8(), strSummary.toUTF8(), -1, -1, -1);3235 }3236 break;32373238 case INTRIGUE_TYPE_ARMY_SNEAK_ATTACK:3239 {3240 Localization::String strSummary;3241 Localization::String strNotification;3242 NotificationTypes eNotification;32433244 // targeting me3245 if(kMessage.m_eTargetPlayer == m_pPlayer->GetID())3246 {3247 if(pCity)3248 {3249 eNotification = NOTIFICATION_INTRIGUE_SNEAK_ATTACK_ARMY_AGAINST_YOU_CITY_KNOWN;3250 strSummary = Localization::Lookup("TXT_KEY_NOTIFICATION_INTRIGUE_SNEAK_ATTACK_ARMY_AGAINST_YOU_CITY_KNOWN_S");3251 if(GC.getGame().isGameMultiPlayer() && GET_PLAYER(kMessage.m_eSourcePlayer).isHuman())3252 {3253 strSummary << GET_PLAYER(kMessage.m_eSourcePlayer).getNickName();3254 }3255 else3256 {3257 strSummary << GET_PLAYER(kMessage.m_eSourcePlayer).getNameKey();3258 }3259 strSummary << pCity->getNameKey();32603261 strNotification = Localization::Lookup("TXT_KEY_NOTIFICATION_INTRIGUE_SNEAK_ATTACK_ARMY_AGAINST_YOU_CITY_KNOWN");3262 strNotification << GetSpyRankName(m_aSpyList[uiSpyIndex].m_eRank);3263#if defined(MOD_BUGFIX_SPY_NAMES)3264 strNotification << m_aSpyList[uiSpyIndex].GetSpyName(m_pPlayer);3265#else3266 strNotification << m_pPlayer->getCivilizationInfo().getSpyNames(m_aSpyList[uiSpyIndex].m_iName);3267#endif3268 strNotification << GET_PLAYER(kMessage.m_eSourcePlayer).getCivilizationAdjectiveKey();3269 strNotification << pCity->getNameKey();3270 }3271 else3272 {3273 eNotification = NOTIFICATION_INTRIGUE_SNEAK_ATTACK_ARMY_AGAINST_YOU_CITY_UNKNOWN;3274 strSummary = Localization::Lookup("TXT_KEY_NOTIFICATION_INTRIGUE_SNEAK_ATTACK_ARMY_AGAINST_YOU_CITY_UNKNOWN_S");3275 if(GC.getGame().isGameMultiPlayer() && GET_PLAYER(kMessage.m_eSourcePlayer).isHuman())3276 {3277 strSummary << GET_PLAYER(kMessage.m_eSourcePlayer).getNickName();3278 }3279 else3280 {3281 strSummary << GET_PLAYER(kMessage.m_eSourcePlayer).getNameKey();3282 }32833284 strNotification = Localization::Lookup("TXT_KEY_NOTIFICATION_INTRIGUE_SNEAK_ATTACK_ARMY_AGAINST_YOU_CITY_UNKNOWN");3285 strNotification << GetSpyRankName(m_aSpyList[uiSpyIndex].m_eRank);3286#if defined(MOD_BUGFIX_SPY_NAMES)3287 strNotification << m_aSpyList[uiSpyIndex].GetSpyName(m_pPlayer);3288#else3289 strNotification << m_pPlayer->getCivilizationInfo().getSpyNames(m_aSpyList[uiSpyIndex].m_iName);3290#endif3291 strNotification << GET_PLAYER(kMessage.m_eSourcePlayer).getCivilizationAdjectiveKey();3292 }3293 }3294 // targeting somebody else I know3295 else if(kMessage.m_eTargetPlayer != NO_PLAYER && kMessage.m_eTargetPlayer != MAX_MAJOR_CIVS)3296 {3297 if(pCity)3298 {3299 eNotification = NOTIFICATION_INTRIGUE_SNEAK_ATTACK_ARMY_AGAINST_KNOWN_CITY_KNOWN;3300 strSummary = Localization::Lookup("TXT_KEY_NOTIFICATION_INTRIGUE_SNEAK_ATTACK_ARMY_AGAINST_KNOWN_CITY_KNOWN_S");3301 if(GC.getGame().isGameMultiPlayer() && GET_PLAYER(kMessage.m_eSourcePlayer).isHuman())3302 {3303 strSummary << GET_PLAYER(kMessage.m_eSourcePlayer).getNickName();3304 }3305 else3306 {3307 strSummary << GET_PLAYER(kMessage.m_eSourcePlayer).getNameKey();3308 }3309 strSummary << pCity->getNameKey();33103311 strNotification = Localization::Lookup("TXT_KEY_NOTIFICATION_INTRIGUE_SNEAK_ATTACK_ARMY_AGAINST_KNOWN_CITY_KNOWN");3312 strNotification << GetSpyRankName(m_aSpyList[uiSpyIndex].m_eRank);3313#if defined(MOD_BUGFIX_SPY_NAMES)3314 strNotification << m_aSpyList[uiSpyIndex].GetSpyName(m_pPlayer);3315#else3316 strNotification << m_pPlayer->getCivilizationInfo().getSpyNames(m_aSpyList[uiSpyIndex].m_iName);3317#endif3318 strNotification << GET_PLAYER(kMessage.m_eSourcePlayer).getCivilizationAdjectiveKey();3319 strNotification << GET_PLAYER(kMessage.m_eTargetPlayer).getCivilizationAdjectiveKey();3320 strNotification << pCity->getNameKey();3321 }3322 else3323 {3324 eNotification = NOTIFICATION_INTRIGUE_SNEAK_ATTACK_ARMY_AGAINST_KNOWN_CITY_UNKNOWN;3325 strSummary = Localization::Lookup("TXT_KEY_NOTIFICATION_INTRIGUE_SNEAK_ATTACK_ARMY_AGAINST_KNOWN_CITY_UNKNOWN_S");3326 if(GC.getGame().isGameMultiPlayer() && GET_PLAYER(kMessage.m_eSourcePlayer).isHuman())3327 {3328 strSummary << GET_PLAYER(kMessage.m_eSourcePlayer).getNickName();3329 }3330 else3331 {3332 strSummary << GET_PLAYER(kMessage.m_eSourcePlayer).getNameKey();3333 }33343335 if(GC.getGame().isGameMultiPlayer() && GET_PLAYER(kMessage.m_eTargetPlayer).isHuman())3336 {3337 strSummary << GET_PLAYER(kMessage.m_eTargetPlayer).getNickName();3338 }3339 else3340 {3341 strSummary << GET_PLAYER(kMessage.m_eTargetPlayer).getNameKey();3342 }33433344 strNotification = Localization::Lookup("TXT_KEY_NOTIFICATION_INTRIGUE_SNEAK_ATTACK_ARMY_AGAINST_KNOWN_CITY_UNKNOWN");3345 strNotification << GetSpyRankName(m_aSpyList[uiSpyIndex].m_eRank);3346#if defined(MOD_BUGFIX_SPY_NAMES)3347 strNotification << m_aSpyList[uiSpyIndex].GetSpyName(m_pPlayer);3348#else3349 strNotification << m_pPlayer->getCivilizationInfo().getSpyNames(m_aSpyList[uiSpyIndex].m_iName);3350#endif3351 strNotification << GET_PLAYER(kMessage.m_eSourcePlayer).getCivilizationAdjectiveKey();3352 strNotification << GET_PLAYER(kMessage.m_eTargetPlayer).getCivilizationDescriptionKey();3353 }3354 }3355 // targeting an unknown player3356 else3357 {3358 eNotification = NOTIFICATION_INTRIGUE_SNEAK_ATTACK_ARMY_AGAINST_UNKNOWN;3359 // if the spy wasn't high enough rank to know who was being attacked3360 if (kMessage.m_eTargetPlayer == MAX_MAJOR_CIVS)3361 {3362 strSummary = Localization::Lookup("TXT_KEY_NOTIFICATION_INTRIGUE_SNEAK_ATTACK_ARMY_AGAINST_SOMEONE_S");3363 strNotification = Localization::Lookup("TXT_KEY_NOTIFICATION_INTRIGUE_SNEAK_ATTACK_ARMY_AGAINST_SOMEONE");3364 }3365 else3366 {3367 strSummary = Localization::Lookup("TXT_KEY_NOTIFICATION_INTRIGUE_SNEAK_ATTACK_ARMY_AGAINST_UNKNOWN_S");3368 strNotification = Localization::Lookup("TXT_KEY_NOTIFICATION_INTRIGUE_SNEAK_ATTACK_ARMY_AGAINST_UNKNOWN");3369 }33703371 if(GC.getGame().isGameMultiPlayer() && GET_PLAYER(kMessage.m_eSourcePlayer).isHuman())3372 {3373 strSummary << GET_PLAYER(kMessage.m_eSourcePlayer).getNickName();3374 }3375 else3376 {3377 strSummary << GET_PLAYER(kMessage.m_eSourcePlayer).getNameKey();3378 }33793380 strNotification << GetSpyRankName(m_aSpyList[uiSpyIndex].m_eRank);3381#if defined(MOD_BUGFIX_SPY_NAMES)3382 strNotification << m_aSpyList[uiSpyIndex].GetSpyName(m_pPlayer);3383#else3384 strNotification << m_pPlayer->getCivilizationInfo().getSpyNames(m_aSpyList[uiSpyIndex].m_iName);3385#endif3386 strNotification << GET_PLAYER(kMessage.m_eSourcePlayer).getCivilizationAdjectiveKey();3387 }33883389 pNotifications->Add(eNotification, strNotification.toUTF8(), strSummary.toUTF8(), -1, -1, kMessage.m_eTargetPlayer);3390 }3391 break;3392 case INTRIGUE_TYPE_AMPHIBIOUS_SNEAK_ATTACK:3393 {3394 Localization::String strSummary;3395 Localization::String strNotification;3396 NotificationTypes eNotification;33973398 // targeting me3399 if(kMessage.m_eTargetPlayer == m_pPlayer->GetID())3400 {3401 if(pCity)3402 {3403 eNotification = NOTIFICATION_INTRIGUE_SNEAK_ATTACK_AMPHIB_AGAINST_YOU_CITY_KNOWN;3404 strSummary = Localization::Lookup("TXT_KEY_NOTIFICATION_INTRIGUE_SNEAK_ATTACK_AMPHIB_AGAINST_YOU_CITY_KNOWN_S");3405 if(GC.getGame().isGameMultiPlayer() && GET_PLAYER(kMessage.m_eSourcePlayer).isHuman())3406 {3407 strSummary << GET_PLAYER(kMessage.m_eSourcePlayer).getNickName();3408 }3409 else3410 {3411 strSummary << GET_PLAYER(kMessage.m_eSourcePlayer).getNameKey();3412 }3413 strSummary << pCity->getNameKey();34143415 strNotification = Localization::Lookup("TXT_KEY_NOTIFICATION_INTRIGUE_SNEAK_ATTACK_AMPHIB_AGAINST_YOU_CITY_KNOWN");3416 strNotification << GetSpyRankName(m_aSpyList[uiSpyIndex].m_eRank);3417#if defined(MOD_BUGFIX_SPY_NAMES)3418 strNotification << m_aSpyList[uiSpyIndex].GetSpyName(m_pPlayer);3419#else3420 strNotification << m_pPlayer->getCivilizationInfo().getSpyNames(m_aSpyList[uiSpyIndex].m_iName);3421#endif3422 strNotification << GET_PLAYER(kMessage.m_eSourcePlayer).getCivilizationAdjectiveKey();3423 strNotification << pCity->getNameKey();3424 }3425 else3426 {3427 eNotification = NOTIFICATION_INTRIGUE_SNEAK_ATTACK_AMPHIB_AGAINST_YOU_CITY_UNKNOWN;3428 strSummary = Localization::Lookup("TXT_KEY_NOTIFICATION_INTRIGUE_SNEAK_ATTACK_AMPHIB_AGAINST_YOU_CITY_UNKNOWN_S");3429 if(GC.getGame().isGameMultiPlayer() && GET_PLAYER(kMessage.m_eSourcePlayer).isHuman())3430 {3431 strSummary << GET_PLAYER(kMessage.m_eSourcePlayer).getNickName();3432 }3433 else3434 {3435 strSummary << GET_PLAYER(kMessage.m_eSourcePlayer).getNameKey();3436 }34373438 strNotification = Localization::Lookup("TXT_KEY_NOTIFICATION_INTRIGUE_SNEAK_ATTACK_AMPHIB_AGAINST_YOU_CITY_UNKNOWN");3439 strNotification << GetSpyRankName(m_aSpyList[uiSpyIndex].m_eRank);3440#if defined(MOD_BUGFIX_SPY_NAMES)3441 strNotification << m_aSpyList[uiSpyIndex].GetSpyName(m_pPlayer);3442#else3443 strNotification << m_pPlayer->getCivilizationInfo().getSpyNames(m_aSpyList[uiSpyIndex].m_iName);3444#endif3445 strNotification << GET_PLAYER(kMessage.m_eSourcePlayer).getCivilizationAdjectiveKey();3446 }3447 }3448 // targeting somebody else I know3449 else if(kMessage.m_eTargetPlayer != NO_PLAYER && kMessage.m_eTargetPlayer != MAX_MAJOR_CIVS)3450 {3451 if(pCity)3452 {3453 eNotification = NOTIFICATION_INTRIGUE_SNEAK_ATTACK_AMPHIB_AGAINST_KNOWN_CITY_KNOWN;3454 strSummary = Localization::Lookup("TXT_KEY_NOTIFICATION_INTRIGUE_SNEAK_ATTACK_AMPHIB_AGAINST_KNOWN_CITY_KNOWN_S");3455 if(GC.getGame().isGameMultiPlayer() && GET_PLAYER(kMessage.m_eSourcePlayer).isHuman())3456 {3457 strSummary << GET_PLAYER(kMessage.m_eSourcePlayer).getNickName();3458 }3459 else3460 {3461 strSummary << GET_PLAYER(kMessage.m_eSourcePlayer).getNameKey();3462 }3463 strSummary << pCity->getNameKey();34643465 strNotification = Localization::Lookup("TXT_KEY_NOTIFICATION_INTRIGUE_SNEAK_ATTACK_AMPHIB_AGAINST_KNOWN_CITY_KNOWN");3466 strNotification << GetSpyRankName(m_aSpyList[uiSpyIndex].m_eRank);3467#if defined(MOD_BUGFIX_SPY_NAMES)3468 strNotification << m_aSpyList[uiSpyIndex].GetSpyName(m_pPlayer);3469#else3470 strNotification << m_pPlayer->getCivilizationInfo().getSpyNames(m_aSpyList[uiSpyIndex].m_iName);3471#endif3472 strNotification << GET_PLAYER(kMessage.m_eSourcePlayer).getCivilizationAdjectiveKey();3473 strNotification << GET_PLAYER(kMessage.m_eTargetPlayer).getCivilizationAdjectiveKey();3474 strNotification << pCity->getNameKey();3475 }3476 else3477 {3478 eNotification = NOTIFICATION_INTRIGUE_SNEAK_ATTACK_AMPHIB_AGAINST_KNOWN_CITY_UNKNOWN;3479 strSummary = Localization::Lookup("TXT_KEY_NOTIFICATION_INTRIGUE_SNEAK_ATTACK_AMPHIB_AGAINST_KNOWN_CITY_UNKNOWN_S");3480 if(GC.getGame().isGameMultiPlayer() && GET_PLAYER(kMessage.m_eSourcePlayer).isHuman())3481 {3482 strSummary << GET_PLAYER(kMessage.m_eSourcePlayer).getNickName();3483 }3484 else3485 {3486 strSummary << GET_PLAYER(kMessage.m_eSourcePlayer).getNameKey();3487 }34883489 if(GC.getGame().isGameMultiPlayer() && GET_PLAYER(kMessage.m_eTargetPlayer).isHuman())3490 {3491 strSummary << GET_PLAYER(kMessage.m_eTargetPlayer).getNickName();3492 }3493 else3494 {3495 strSummary << GET_PLAYER(kMessage.m_eTargetPlayer).getNameKey();3496 }34973498 strNotification = Localization::Lookup("TXT_KEY_NOTIFICATION_INTRIGUE_SNEAK_ATTACK_AMPHIB_AGAINST_KNOWN_CITY_UNKNOWN");3499 strNotification << GetSpyRankName(m_aSpyList[uiSpyIndex].m_eRank);3500#if defined(MOD_BUGFIX_SPY_NAMES)3501 strNotification << m_aSpyList[uiSpyIndex].GetSpyName(m_pPlayer);3502#else3503 strNotification << m_pPlayer->getCivilizationInfo().getSpyNames(m_aSpyList[uiSpyIndex].m_iName);3504#endif3505 strNotification << GET_PLAYER(kMessage.m_eSourcePlayer).getCivilizationAdjectiveKey();3506 strNotification << GET_PLAYER(kMessage.m_eTargetPlayer).getCivilizationDescriptionKey();3507 }3508 }3509 // targeting an unknown player3510 else3511 {3512 eNotification = NOTIFICATION_INTRIGUE_SNEAK_ATTACK_AMPHIB_AGAINST_UNKNOWN;35133514 // if the spy wasn't high enough rank to know who was being attacked3515 if (kMessage.m_eTargetPlayer == MAX_MAJOR_CIVS)3516 {3517 strSummary = Localization::Lookup("TXT_KEY_NOTIFICATION_INTRIGUE_SNEAK_ATTACK_AMPHIB_AGAINST_SOMEONE_S");3518 strNotification = Localization::Lookup("TXT_KEY_NOTIFICATION_INTRIGUE_SNEAK_ATTACK_AMPHIB_AGAINST_SOMEONE");3519 }3520 else3521 {3522 strSummary = Localization::Lookup("TXT_KEY_NOTIFICATION_INTRIGUE_SNEAK_ATTACK_AMPHIB_AGAINST_UNKNOWN_S");3523 strNotification = Localization::Lookup("TXT_KEY_NOTIFICATION_INTRIGUE_SNEAK_ATTACK_AMPHIB_AGAINST_UNKNOWN");3524 }35253526 if(GC.getGame().isGameMultiPlayer() && GET_PLAYER(kMessage.m_eSourcePlayer).isHuman())3527 {3528 strSummary << GET_PLAYER(kMessage.m_eSourcePlayer).getNickName();3529 }3530 else3531 {3532 strSummary << GET_PLAYER(kMessage.m_eSourcePlayer).getNameKey();3533 }35343535 strNotification << GetSpyRankName(m_aSpyList[uiSpyIndex].m_eRank);3536#if defined(MOD_BUGFIX_SPY_NAMES)3537 strNotification << m_aSpyList[uiSpyIndex].GetSpyName(m_pPlayer);3538#else3539 strNotification << m_pPlayer->getCivilizationInfo().getSpyNames(m_aSpyList[uiSpyIndex].m_iName);3540#endif3541 strNotification << GET_PLAYER(kMessage.m_eSourcePlayer).getCivilizationAdjectiveKey();3542 }35433544 pNotifications->Add(eNotification, strNotification.toUTF8(), strSummary.toUTF8(), -1, -1, kMessage.m_eTargetPlayer);3545 }3546 break;3547 case INTRIGUE_TYPE_CONSTRUCTING_WONDER:3548 {3549 Localization::String strSummary = Localization::Lookup("TXT_KEY_NOTIFICATION_INTRIGUE_CONSTRUCT_WONDER_S");3550 if(GC.getGame().isGameMultiPlayer() && GET_PLAYER(kMessage.m_eSourcePlayer).isHuman())3551 {3552 strSummary << GET_PLAYER(kMessage.m_eSourcePlayer).getNickName();3553 }3554 else3555 {3556 strSummary << GET_PLAYER(kMessage.m_eSourcePlayer).getNameKey();3557 }3558 3559 if (kMessage.m_eBuilding != NO_BUILDING)3560 {3561 CvBuildingEntry* pBuildingInfo = GC.getBuildingInfo(kMessage.m_eBuilding);3562 CvAssertMsg(pBuildingInfo, "pBuildingInfo is null");3563 if (pBuildingInfo)3564 {3565 strSummary << pBuildingInfo->GetTextKey();3566 }3567 }3568 else if (kMessage.m_eProject != NO_PROJECT)3569 {3570 CvProjectEntry* pProjectInfo = GC.getProjectInfo(kMessage.m_eProject);3571 CvAssertMsg(pProjectInfo, "pProjectInfo is null");3572 if (pProjectInfo)3573 {3574 strSummary << pProjectInfo->GetTextKey();3575 }3576 }35773578 Localization::String strNotification = Localization::Lookup("TXT_KEY_NOTIFICATION_INTRIGUE_CONSTRUCT_WONDER");3579 strNotification << GetSpyRankName(m_aSpyList[uiSpyIndex].m_eRank);3580#if defined(MOD_BUGFIX_SPY_NAMES)3581 strNotification << m_aSpyList[uiSpyIndex].GetSpyName(m_pPlayer);3582#else3583 strNotification << m_pPlayer->getCivilizationInfo().getSpyNames(m_aSpyList[uiSpyIndex].m_iName);3584#endif3585 if(GC.getGame().isGameMultiPlayer() && GET_PLAYER(kMessage.m_eSourcePlayer).isHuman())3586 {3587 strNotification << GET_PLAYER(kMessage.m_eSourcePlayer).getNickName();3588 }3589 else3590 {3591 strNotification << GET_PLAYER(kMessage.m_eSourcePlayer).getNameKey();3592 }35933594 if (kMessage.m_eBuilding != NO_BUILDING)3595 {3596 CvBuildingEntry* pBuildingInfo = GC.getBuildingInfo(kMessage.m_eBuilding);3597 CvAssertMsg(pBuildingInfo, "pBuildingInfo is null");3598 if (pBuildingInfo)3599 {3600 strNotification << pBuildingInfo->GetTextKey();3601 }3602 }3603 else if (kMessage.m_eProject != NO_PROJECT)3604 {3605 CvProjectEntry* pProjectInfo = GC.getProjectInfo(kMessage.m_eProject);3606 CvAssertMsg(pProjectInfo, "pProjectInfo is null");3607 if (pProjectInfo)3608 {3609 strNotification << pProjectInfo->GetTextKey();3610 }3611 } 36123613 if (pCity)3614 {3615 strNotification << pCity->getNameKey();3616 }36173618 pNotifications->Add(NOTIFICATION_INTRIGUE_CONSTRUCTING_WONDER, strNotification.toUTF8(), strSummary.toUTF8(), kMessage.m_iCityX, kMessage.m_iCityY, -1);3619 }3620 break;3621 }3622 }3623}