Hooks
static bool BeforeCvDeal_AddOpenBorders(CvDeal* self, PlayerTypes eFrom, int iDuration);static void AfterCvDeal_AddOpenBorders(CvDeal* self, PlayerTypes eFrom, int iDuration);static void ReplaceCvDeal_AddOpenBorders(void (*original)(CvDeal*, PlayerTypes, int), CvDeal* self, PlayerTypes eFrom, int iDuration);CivRegisterBefore<CivHooks::CvDeal_AddOpenBorders>(host, &BeforeCvDeal_AddOpenBorders);CivRegisterAfter<CivHooks::CvDeal_AddOpenBorders>(host, &AfterCvDeal_AddOpenBorders);CivRegisterReplace<CivHooks::CvDeal_AddOpenBorders>(host, &ReplaceCvDeal_AddOpenBorders);
Code
1091/// Insert an open borders pact1092void CvDeal::AddOpenBorders(PlayerTypes eFrom, int iDuration)1093{1094 CvAssertMsg(iDuration >= 0, "DEAL: Trying to add a negative duration to a TradeItem. Please send Jon this with your last 5 autosaves and what changelist # you're playing.");1095 CvAssertMsg(iDuration < GC.getGame().getEstimateEndTurn() * 2, "DEAL: Trade item has a crazy long duration (probably invalid). Please send Jon this with your last 5 autosaves and what changelist # you're playing.");1096 CvAssertMsg(eFrom == m_eFromPlayer || eFrom == m_eToPlayer, "DEAL: Adding deal item for a player that's not actually in this deal! Please send Jon this with your last 5 autosaves and what changelist # you're playing.");10971098 if(IsPossibleToTradeItem(eFrom, GetOtherPlayer(eFrom), TRADE_ITEM_OPEN_BORDERS, iDuration))1099 {1100 CvTradedItem item;1101 item.m_eItemType = TRADE_ITEM_OPEN_BORDERS;1102 item.m_iDuration = iDuration;1103 //item.m_iFinalTurn = iDuration + GC.getGame().getGameTurn();1104 item.m_iFinalTurn = -1;1105 item.m_eFromPlayer = eFrom;1106 m_TradedItems.push_back(item);1107 }1108 else1109 {1110 CvAssertMsg(false, "DEAL: Trying to add an invalid Open Borders item to a deal");1111 }1112}