Commander Bello
Say No 2 Net Validations
I have a problem understanding how the diplomacy works.
I want to limit some options in diplomacy with the king, here: transporting treasures.
The respective function is:
void CvUnit::kingTransport(bool bSkipPopup)
Everything upto beginDiplomacy is clear to me (I hope
).
But, the player will have two options: to accept the king's offer or to deny it. If he accepts, I had planned to each time decrease a variable iCounter until iCounter = 0 and accordingly, if he denies, iCounter will stay unchanged.
The definition of beginDiplomacy is in CvDLLUtilityIFaceBase.h and then I am lost.
There isn't a CvDLLUtilityIFaceBase.cpp and looking for calls from or to beginDiplomacy results in either "no function definition found" (calls from) or "no search results" (calls to).
In general, I don't get how the DLL actually does the diplomacy nor where I can find a hook to attach my coding to.
Can any wizard guide me through the night?
Ok, I had a look now from where doKingTransport() will be called. Once it is called from void CvUnit::kingTransport and once from void CvPlayer::handleDiploEvent
Seems that I could hook up there.
I want to limit some options in diplomacy with the king, here: transporting treasures.
The respective function is:
void CvUnit::kingTransport(bool bSkipPopup)
Spoiler :
Code:
void CvUnit::kingTransport(bool bSkipPopup)
{
if (!canKingTransport())
{
return;
}
if (isHuman() && !bSkipPopup)
{
CvDiploParameters* pDiplo = new CvDiploParameters(GET_PLAYER(getOwnerINLINE()).getParent());
pDiplo->setDiploComment((DiploCommentTypes)GC.getInfoTypeForString("AI_DIPLOCOMMENT_TREASURE_TRANSPORT"));
pDiplo->setData(getID());
int iCommission = GC.getDefineINT("KING_TRANSPORT_TREASURE_COMISSION");
pDiplo->addDiploCommentVariable(iCommission);
int iAmount = getYieldStored();
iAmount -= (iAmount * iCommission) / 100;
iAmount -= (iAmount * GET_PLAYER(getOwnerINLINE()).getTaxRate()) / 100;
pDiplo->addDiploCommentVariable(iAmount);
pDiplo->setAIContact(true);
gDLL->beginDiplomacy(pDiplo, getOwnerINLINE());
}
else
{
doKingTransport();
}
Everything upto beginDiplomacy is clear to me (I hope

But, the player will have two options: to accept the king's offer or to deny it. If he accepts, I had planned to each time decrease a variable iCounter until iCounter = 0 and accordingly, if he denies, iCounter will stay unchanged.
The definition of beginDiplomacy is in CvDLLUtilityIFaceBase.h and then I am lost.

There isn't a CvDLLUtilityIFaceBase.cpp and looking for calls from or to beginDiplomacy results in either "no function definition found" (calls from) or "no search results" (calls to).
In general, I don't get how the DLL actually does the diplomacy nor where I can find a hook to attach my coding to.
Can any wizard guide me through the night?

Ok, I had a look now from where doKingTransport() will be called. Once it is called from void CvUnit::kingTransport and once from void CvPlayer::handleDiploEvent
Seems that I could hook up there.