S3rgeus
Emperor
I'm attempting to make the following part of a UA:
This civilization declares war on any civilization that refuses a trade proposal from it.
There's gonna be a DLL as a part of my mod, so I've been trying to work it out in there. But I cannot, to save my life, find where deals are 'refused'. My initial thoughts had me put my code just after "end hack" comment in the CvDealClasses.cpp file (line 2043):
I've added IsRefusingTradeCausesWar and it functions correctly. Some debugging has shown me that this section of the code (the stuff within "if (bFoundIt) {" from line 2004 in CvDealClasses.cpp) only executes when AIs are negotiating with each other, not the player. Even then, I'm unsure if it runs when an AI refuses a trade.
I've looked into CvDiplomacyRequests, CvDealAI, and CvDiplomacyAI, as well as tried to follow the 'refuse' button down from lua into the DLL, but no luck. The button seems to just close the screen. And I'm beginning to get the creeping sensation that unless you're in a networked multiplayer game "refusals" aren't ever transmitted, the proposed deal is just deleted.
This civilization declares war on any civilization that refuses a trade proposal from it.
There's gonna be a DLL as a part of my mod, so I've been trying to work it out in there. But I cannot, to save my life, find where deals are 'refused'. My initial thoughts had me put my code just after "end hack" comment in the CvDealClasses.cpp file (line 2043):
Code:
// If the deal was refused, and the player being refused's trait causes war then, we've gotta start a war!
if (bValid && !bAccepted)
{
CvPlayer& kPlayer = GET_PLAYER(kDeal.GetFromPlayer());
CvTeam& kTeam = GET_TEAM(kPlayer.getTeam());
TeamTypes eOtherTeam = GET_PLAYER(kDeal.GetToPlayer()).getTeam();
if (kPlayer.GetPlayerTraits()->IsRefusingTradeCausesWar() && kTeam.canDeclareWar(eOtherTeam))
{
kTeam.declareWar(eOtherTeam);
}
}
I've added IsRefusingTradeCausesWar and it functions correctly. Some debugging has shown me that this section of the code (the stuff within "if (bFoundIt) {" from line 2004 in CvDealClasses.cpp) only executes when AIs are negotiating with each other, not the player. Even then, I'm unsure if it runs when an AI refuses a trade.
I've looked into CvDiplomacyRequests, CvDealAI, and CvDiplomacyAI, as well as tried to follow the 'refuse' button down from lua into the DLL, but no luck. The button seems to just close the screen. And I'm beginning to get the creeping sensation that unless you're in a networked multiplayer game "refusals" aren't ever transmitted, the proposed deal is just deleted.