Magean
Prince
- Joined
- Aug 7, 2009
- Messages
- 474
Hi all,
I'm a noob in modding this game. I wanted to make the warmonger penalty for conquest dependent on the size of the conquered city.
Putmalk gave me great help on reddit and told me which lines I should add in the DLL, but I'm not sure they've been correctly inserted.
And here on civfanatics, it's more practical for code insertions.
So, in CvPlayer.cpp, in the CvPlayer::acquireCity function, I added the following lines (in bold) in the warmonger calculation part :
Am I doing it right ?
Thanks in advance
I'm a noob in modding this game. I wanted to make the warmonger penalty for conquest dependent on the size of the conquered city.
Putmalk gave me great help on reddit and told me which lines I should add in the DLL, but I'm not sure they've been correctly inserted.
And here on civfanatics, it's more practical for code insertions.
So, in CvPlayer.cpp, in the CvPlayer::acquireCity function, I added the following lines (in bold) in the warmonger calculation part :
Code:
// slewis - warmonger calculations
if (bConquest)
{
if(!isMinorCiv())
{
bool bDoWarmonger = true;
// Don't award warmongering if you're conquering a city you owned back
if (pOldCity->getOriginalOwner() == GetID())
{
bDoWarmonger = false;
}
if (bDoWarmonger)
{
for(int iMajorLoop = 0; iMajorLoop < MAX_MAJOR_CIVS; iMajorLoop++)
{
PlayerTypes eMajor = (PlayerTypes)iMajorLoop;
if(GetID() != eMajor && GET_PLAYER(eMajor).isAlive())
{
// Have I met the player who conquered the city?
if(GET_TEAM(GET_PLAYER(eMajor).getTeam()).isHasMet(getTeam()))
{
int iNumCities = max(GET_PLAYER(pOldCity->getOwner()).getNumCities(), 1);
int iWarmongerOffset = (1000 * GC.getMap().getWorldInfo().GetEstimatedNumCities()) / (max(GC.getGame().getNumCities(), 1) * iNumCities);
[B]// city size effect on warmonger calculation
iWarmongerOffset *= (pOldCity->getPopulation() * 100 / 12);
iWarmongerOffset /= 100;[/B]
GET_PLAYER(eMajor).GetDiplomacyAI()->ChangeOtherPlayerWarmongerAmount(GetID(), iWarmongerOffset);
}
}
}
}
}
}
Am I doing it right ?
Thanks in advance