AI Religion Choice Bug?

Mentos

Prince
Joined
Sep 29, 2010
Messages
377
I've added a backup-plan for the AI to choose its next best fitting religion type if a favored religion is already taken according to civilization type. In the Religion.xml is the dev comment:
"Matches for favored religions. Leaders will try to match on leader type first, then on civ type, then choose randomly".
Originally, there are only leader types defined in the file and no civilization type. I've added now these, for example like this by sql:
Code:
INSERT INTO FavoredReligions (CivilizationType, ReligionType) SELECT "CIVILIZATION_AMERICA", "RELIGION_CATHOLICISM";
Strangely, the game crashes now severely when starting a new game session.
According to 01_GameplaySchema.sql, there shouldn't be any problem as the table is defined like this:
Code:
-- Table of suggested religions. Will try to match leader first, then civ, then random pick
CREATE TABLE "FavoredReligions" (
       "LeaderType" TEXT,
       "CivilizationType" TEXT,
       "ReligionType" TEXT NOT NULL,
       PRIMARY KEY(LeaderType, CivilizationType, ReligionType),
       FOREIGN KEY (ReligionType) REFERENCES Religions(ReligionType) ON DELETE CASCADE ON UPDATE CASCADE,
       FOREIGN KEY (LeaderType) REFERENCES Leaders(LeaderType) ON DELETE CASCADE ON UPDATE CASCADE,
       FOREIGN KEY (CivilizationType) REFERENCES Civilizations(CivilizationType) ON DELETE CASCADE ON UPDATE CASCADE);
My additional LeaderType entries seem to work fine though, but what's wrong with the CivilizationTypes?
 
That didn't help either. Lua.log spits out "Runtime Error: table index is nil" and then it lists one lua file Runtime Error after the other crashing the whole game during the "Loading, please wait..." screen. That stinks like unfinished coding, or does it work for someone else?
 
I've tried again by adding a leadertype next to civtype. It first started the game fine without errorr but after 29 turns the game crashed again for unknown reasons. I didn't find any error in the logs, so I've given up for now.
 
Top Bottom