CvDeal::AddDeclarationOfFriendship(PlayerTypes)
- Defined in
- CvDealClasses.cpp, line 1324
- Class
- CvDeal
- Hook name
CivHooks::CvDeal_AddDeclarationOfFriendship
Hooks
static bool BeforeCvDeal_AddDeclarationOfFriendship(CvDeal* self, PlayerTypes eFrom);static void AfterCvDeal_AddDeclarationOfFriendship(CvDeal* self, PlayerTypes eFrom);static void ReplaceCvDeal_AddDeclarationOfFriendship(void (*original)(CvDeal*, PlayerTypes), CvDeal* self, PlayerTypes eFrom);CivRegisterBefore<CivHooks::CvDeal_AddDeclarationOfFriendship>(host, &BeforeCvDeal_AddDeclarationOfFriendship);CivRegisterAfter<CivHooks::CvDeal_AddDeclarationOfFriendship>(host, &AfterCvDeal_AddDeclarationOfFriendship);CivRegisterReplace<CivHooks::CvDeal_AddDeclarationOfFriendship>(host, &ReplaceCvDeal_AddDeclarationOfFriendship);
Code
1323/// Insert adding a declaration of peace to the deal1324void CvDeal::AddDeclarationOfFriendship(PlayerTypes eFrom)1325{1326 CvAssertMsg(eFrom == m_eFromPlayer || eFrom == m_eToPlayer, "DEAL: Adding deal item for a player that's not actually in this deal!");13271328 if(IsPossibleToTradeItem(eFrom, GetOtherPlayer(eFrom), TRADE_ITEM_DECLARATION_OF_FRIENDSHIP))1329 {1330 if (!ContainsItemType(TRADE_ITEM_DECLARATION_OF_FRIENDSHIP, eFrom))1331 {1332 CvTradedItem item;1333 item.m_eItemType = TRADE_ITEM_DECLARATION_OF_FRIENDSHIP;1334 item.m_eFromPlayer = eFrom;1335 m_TradedItems.push_back(item);1336 }1337 }1338 else1339 {1340 CvAssertMsg(false, "DEAL: Trying to add an invalid Declaration of Friendship item to a deal");1341 }1342}