Civilizations choose a random Religion to found, instead of their default.
Removing defaults does not work, because they just choose in alpha-order.
ReligionTypes CvGameReligions::GetReligionToFound(PlayerTypes ePlayer)
{
ReligionTypes eCivReligion;
/* eCivReligion = GET_PLAYER(ePlayer).getCivilizationInfo().GetReligion();
if(!HasBeenFounded(eCivReligion))
{
CvReligionEntry* pEntry = GC.getReligionInfo(eCivReligion);
if(pEntry)
{
return eCivReligion;
}
}*/
// Need to "borrow" from another civ. Loop through all religions looking for one that is eligible
for(int iI = 0; iI < GC.getNumReligionInfos(); iI++)
{
ReligionTypes eReligion = (ReligionTypes)iI;
CvReligionEntry* pEntry = GC.getReligionInfo(eReligion);
if(!pEntry)
{
continue;
}
if(pEntry->GetID() == RELIGION_PANTHEON)
{
continue;
}
if(HasBeenFounded((ReligionTypes)pEntry->GetID()))
{
continue;
}
if(IsPreferredByCivInGame(eReligion))
{
continue;
}
return (eReligion);
}
// Will have to use a religion that someone else prefers
for(int iI = 0; iI < GC.getNumReligionInfos(); iI++)
{
ReligionTypes eReligion = (ReligionTypes)iI;
CvReligionEntry* pEntry = GC.getReligionInfo(eReligion);
if(!pEntry)
{
continue;
}
if(pEntry->GetID() == RELIGION_PANTHEON)
{
continue;
}
if(HasBeenFounded((ReligionTypes)pEntry->GetID()))
{
continue;
}
return (eReligion);
}
return NO_RELIGION;
}
That will just remove the preferred religion check in C++ (which will have the same effect as removing the default religion from the XML) - ie you'll get the first alphabetical religion
To get a random choice you need to do that and also build a list of all possible religions and then pick one randomly.
// Removes religion preference
#define MOD_RELIGION_NO_PREFERRENCES (true)
// Randomises religion choice (if preferred religion unavailable)
#define MOD_RELIGION_RANDOMISE (true)
/// Get the appropriate religion for this player to found next
ReligionTypes CvGameReligions::GetReligionToFound(PlayerTypes ePlayer)
{
#if defined(MOD_RELIGION_NO_PREFERRENCES)
if (!MOD_RELIGION_NO_PREFERRENCES) {
// Choose the civs preferred religion if not disabled and available
#endif
ReligionTypes eCivReligion;
eCivReligion = GET_PLAYER(ePlayer).getCivilizationInfo().GetReligion();
if(!HasBeenFounded(eCivReligion))
{
CvReligionEntry* pEntry = GC.getReligionInfo(eCivReligion);
if(pEntry)
{
return eCivReligion;
}
}
#if defined(MOD_RELIGION_NO_PREFERRENCES)
}
#endif
#if defined(MOD_RELIGION_RANDOMISE)
// No preferred religion, so find all the possible religions
std::vector<ReligionTypes> availableReligions;
#endif
// Need to "borrow" from another civ. Loop through all religions looking for one that is eligible
for(int iI = 0; iI < GC.getNumReligionInfos(); iI++)
{
ReligionTypes eReligion = (ReligionTypes)iI;
CvReligionEntry* pEntry = GC.getReligionInfo(eReligion);
if(!pEntry)
{
continue;
}
if(pEntry->GetID() == RELIGION_PANTHEON)
{
continue;
}
if(HasBeenFounded((ReligionTypes)pEntry->GetID()))
{
continue;
}
#if defined(MOD_RELIGION_NO_PREFERRENCES)
// Only excluded religions preferred by other civs if not disabled
if (!MOD_RELIGION_NO_PREFERRENCES) {
#endif
if(IsPreferredByCivInGame(eReligion))
{
continue;
}
#if defined(MOD_RELIGION_NO_PREFERRENCES)
}
#endif
#if defined(MOD_RELIGION_RANDOMISE)
if (MOD_RELIGION_RANDOMISE) {
// If we want a random religion, remember this as a possible candidate ...
availableReligions.push_back(eReligion);
} else {
// ... otherwise just return it
#endif
return (eReligion);
#if defined(MOD_RELIGION_RANDOMISE)
}
#endif
}
#if defined(MOD_RELIGION_RANDOMISE)
if (availableReligions.empty()) {
#endif
// Will have to use a religion that someone else prefers
for(int iI = 0; iI < GC.getNumReligionInfos(); iI++)
{
ReligionTypes eReligion = (ReligionTypes)iI;
CvReligionEntry* pEntry = GC.getReligionInfo(eReligion);
if(!pEntry)
{
continue;
}
if(pEntry->GetID() == RELIGION_PANTHEON)
{
continue;
}
if(HasBeenFounded((ReligionTypes)pEntry->GetID()))
{
continue;
}
#if defined(MOD_RELIGION_RANDOMISE)
if (MOD_RELIGION_RANDOMISE) {
// If we want a random religion, remember this as a possible candidate ...
availableReligions.push_back(eReligion);
} else {
// ... otherwise just return it
#endif
return (eReligion);
#if defined(MOD_RELIGION_RANDOMISE)
}
#endif
}
#if defined(MOD_RELIGION_RANDOMISE)
}
#endif
#if defined(MOD_RELIGION_RANDOMISE)
// Pick a random religion
if (!availableReligions.empty()) {
int index = 0;
// Pick a random one if required
if (MOD_RELIGION_RANDOMISE) {
index = GC.getGame().getJonRandNum(availableReligions.size(), "Random Religion To Found");
}
return availableReligions[index];
}
#endif
return NO_RELIGION;
}
Civilizations choose a random Religion to found, instead of their default.
Removing defaults does not work, because they just choose in alpha-order.
No need for dll. Just randomize preferred religion in SQL. PowelS has an example of random table order for city names here.
-- Create a temp religions table from the standard Pantheon entry
CREATE TABLE Religions_Temp AS
SELECT *
FROM Religions
WHERE Type = 'RELIGION_PANTHEON';
-- Copy the remaining religions to the temp table in a random order
INSERT INTO Religions_Temp
SELECT *
FROM Religions
WHERE Type != 'RELIGION_PANTHEON'
ORDER BY RANDOM();
-- Renumber the religions
UPDATE Religions_Temp
SET ID = (rowid-1);
-- Copy everything back from the temp table, keeping the same order, and then tidy up after ourselves
DELETE FROM Religions;
INSERT INTO Religions SELECT * FROM Religions_Temp ORDER BY rowid ASC;
DROP TABLE Religions_Temp;
-- Finally delete all the preferred religions
DELETE FROM Civilization_Religions;
I know that many people were quite annoyed about a missing queue to give to orders to their units, especially workers.
Does anybody know if it is possible by now to implement such thing?
We would need an event trigger, like pressing shift + giving an order, then record the given orders and store them in an array.
If that is possible, the rest is just a question of UI.
I tried to get into lua programming the last 2 days, but I still don't feel qualified to answer my question.
I honestly don't know if this is the right place to request this, but... It would be great if there was a way to assign already existant (or custom too) game music to a completelly custom leader and civ, just so we don't have to replace an existing one to have music ingame...