[BNW] Is this custom function for the DLL okay?

FlammieJerynZ

Flammy
Joined
Aug 6, 2023
Messages
10
Location
Santiago de Chile
Hi everyone! How're you?
I hope you all be okay.
I was having the idea to create a custom function for CvCity in the DLL, to check if a City has a Secondary Pantheon Belief (gained by the Religious Tolerance Social Policy in Piety Social Policy Tree).
But I was wondering if is well writed here, you know, to avoid any Crashes, bad data or confusions.
There is it:
Spoiler The script for the function :

// ----------------------------------------------------------------------------
bool CvCity::HasSecondaryReligionPantheonBelief(BeliefTypes iBeliefType) const
{
BeliefTypes eSecondaryPantheon = GetCityReligions()->GetSecondaryReligionPantheonBelief();

return (eSecondaryPantheon != NO_BELIEF && eSecondaryPantheon == iBeliefType);
}

Thank you in advance and I will appreciate any answer!
 
Last edited:
Why noy just use the existing Lua API method pCity:GetSecondaryReligionPantheonBelief() and do it all in Lua?
 
Thank you, Whoward!
You're right, my bad, I didn't check completely the Lua API methods and I didn't imagine that method was there... But this one you have provided must work perfectly fine!
One last question: pCity:GetSecondaryReligionPantheonBelief() can be used for a certain Pantheon Belief or any?
For example: If we do in Lua a new Function where the God of War Pantheon Belief have a new effect, pCity:GetSecondaryReligionPantheonBelief() will fire only when God of War is the Secondary Pantheon Belief in a City who follows a Religion majority and a Religion with God of War in second place, and the owner of said City have the Religious Tolerance Social Policy adopted?
Thank you very much again!
 
Nope, it's not an event, it's a method that returns the secondary belief for the specified city
 
Finally I see! Thank you very much!
For instance, it could be writen in the following manner: city:GetSecondaryReligionPantheonBelief() == GameInfoTypes["BELIEF_GOD_WAR"].
I will test it, I hope it doesn't have crashes, hehe.
Thank you again and I hope this help somebody else too!
 
Top Bottom