FfH Version 1.10c

woodelf said:
Kael - do you want another CTD or do you have enough? Did you fix the problem I sent you before?

Send it, im just installing 1.10c to load up chalids anyway.
 
Sent away. Careful, this time it didn't CTD, but looped me and I had to reboot the entire computer.
 
Gonna need some Talchas help here.

The crash appears to be happening when the Ai considers what spells it should cast. I ran the following scenerios:

1. Playing out the the turn. Result: CTD 100% of the time.
2. From a fresh reload killing the 3 adepts in Varn's capital. Result: No CTD 100% of the time.
3. From a fresh reload removing the Fire1 and Channeling1 promotion from the 3 adepts in Varns capital. Result: No CTD 100% of the time. (Fire1 and channeling1 gives access to the scorch spell).
4. Block the scorch spell by setting return false as the first line of the reqScorch check. Result: CTD 100% of the time.
5. Block the scorch spell by changing the promotion requirements to ones the unit doesnt have. Result: No CTD 100% of the time.
6. Block the scorch spell but allow the Wall of Stone spell. Result: CTD 100% of the time.

So, in some situation (obviously the computer considers the Scorch spell tons of times without the CTD) when the computer considers if it should cast or not it CTD's. The ai.log shows the following:

[25727.623] AI_update(unit:UNIT_SCOUT id:24578 turn:138
[25727.623] anyAttack(unit:UNIT_SCOUT id:24578 range:1,odds:70,stack:0,follow,0
[25727.635] AI_update - unitAI done, calling doMagic 0,1
[25727.635] AI_update(unit:UNIT_ADEPT id:163856 turn:138
[25727.664] anyAttack(unit:UNIT_ADEPT id:163856 range:1,odds:60,stack:0,follow,0
[25727.664] AI_update - unitAI done, calling doMagic 0,1
[25727.664] AI_update(unit:UNIT_WARRIOR id:131084 turn:138
[25727.664] AI_update - unitAI done, calling doMagic 0,1
[25727.664] AI_update(unit:UNIT_ADEPT id:180242 turn:138
[25727.664] anyAttack(unit:UNIT_ADEPT id:180242 range:1,odds:60,stack:0,follow,0
[25727.664] AI_update - unitAI done, calling doMagic 0,1
[25727.664] AI_update(unit:UNIT_ADEPT id:229376 turn:138
[25727.664] anyAttack(unit:UNIT_ADEPT id:229376 range:1,odds:65,stack:0,follow,0
[25727.664] anyAttack(unit:UNIT_ADEPT id:229376 range:1,odds:45,stack:0,follow,0
[25727.674] anyAttack - bestSpell is -1, value -1

(god bless talchas for logging all his activity)

I suspect the -1 is the cause of the crash. I attached all the logs from the load and crash for Talchas to consider.
 
Woodelfs CTD is a match:

[27041.594] AI_update(unit:UNIT_WORKER id:32771 turn:206
[27041.594] AI_update - unitAI done, calling doMagic 0,1
[27041.594] AI_update(unit:UNIT_PRIEST_OF_THE_VEIL id:81920 turn:206
[27041.594] AI_update - start call doMagicAttack
[27041.594] magicAttack(minStrRatN:2,minStrRatD:1
[27041.594] AI_update - after start call doMagicAttack
[27041.594] AI_update - unitAI done, calling doMagic 0,1
[27041.594] magicAttack(minStrRatN:0,minStrRatD:1
[27041.594] attackSpell,str:-1,-1 buffSpell/str:43,-4
[27041.594] AI_update(unit:UNIT_SKELETON id:98308 turn:206
[27041.594] anyAttack(unit:UNIT_SKELETON id:98308 range:1,odds:65,stack:0,follow,0
[27041.594] anyAttack(unit:UNIT_SKELETON id:98308 range:1,odds:55,stack:0,follow,0
[27041.594] AI_update - unitAI done, calling doMagic 0,1
[27041.594] AI_update(unit:UNIT_ARCHER id:16385 turn:206
[27041.594] anyAttack(unit:UNIT_ARCHER id:16385 range:1,odds:65,stack:0,follow,0
[27041.594] AI_update - unitAI done, calling doMagic 0,1
[27042.334] AI_update(unit:UNIT_HUNTER id:40964 turn:206
[27042.334] anyAttack(unit:UNIT_HUNTER id:40964 range:1,odds:70,stack:0,follow,0
[27042.344] AI_update - unitAI done, calling doMagic 0,1
[27042.344] AI_update(unit:UNIT_CARAVEL id:147466 turn:206
[27042.344] anyAttack(unit:UNIT_CARAVEL id:147466 range:1,odds:70,stack:0,follow,0
[27042.363] AI_update - unitAI done, calling doMagic 0,1
[27042.363] AI_update(unit:UNIT_THE_DROWN id:155659 turn:206
[27042.373] AI_update - unitAI done, calling doMagic 0,1
[27042.373] AI_update(unit:UNIT_THE_DROWN id:114695 turn:206
[27042.373] AI_update - unitAI done, calling doMagic 0,1
[27042.373] AI_update(unit:UNIT_THE_DROWN id:90114 turn:206
[27042.373] AI_update - unitAI done, calling doMagic 0,1
[27042.373] AI_update(unit:UNIT_THE_DROWN id:98310 turn:206
[27042.373] anyAttack(unit:UNIT_THE_DROWN id:98310 range:1,odds:65,stack:0,follow,0
[27042.373] AI_update - unitAI done, calling doMagic 0,1
[27042.373] AI_update(unit:UNIT_THE_DROWN id:139273 turn:206
[27042.373] anyAttack(unit:UNIT_THE_DROWN id:139273 range:1,odds:65,stack:0,follow,0
[27042.373] AI_update - unitAI done, calling doMagic 0,1
[27042.373] AI_update(unit:UNIT_THE_DROWN id:122888 turn:206
[27042.373] AI_update - unitAI done, calling doMagic 0,1
[27042.373] AI_update(unit:UNIT_THE_DROWN id:73728 turn:206
[27042.373] AI_update - unitAI done, calling doMagic 0,1
[27042.373] AI_update(unit:UNIT_SETTLER id:172037 turn:206
[27042.395] AI_update - unitAI done, calling doMagic 0,1
[27042.395] anyAttack(unit:UNIT_SETTLER id:172037 range:1,odds:70,stack:2,follow,1
[27042.545] AI_update(unit:UNIT_HORSEMAN id:638993 turn:206
[27042.545] AI_update - unitAI done, calling doMagic 0,1
[27042.545] AI_update(unit:UNIT_ADEPT id:221195 turn:206
[27042.545] AI_update - start call doMagicAttack
[27042.545] magicAttack(minStrRatN:2,minStrRatD:1
[27042.545] AI_update - after start call doMagicAttack
[27042.545] AI_update - unitAI done, calling doMagic 0,1
[27042.555] magicAttack(minStrRatN:0,minStrRatD:1
[27042.555] attackSpell,str:-1,-1 buffSpell/str:9,-11
[27042.555] AI_update(unit:UNIT_ADEPT id:90119 turn:206
[27042.555] AI_update - start call doMagicAttack
[27042.555] magicAttack(minStrRatN:2,minStrRatD:1
[27042.555] AI_update - after start call doMagicAttack
[27042.555] AI_update - unitAI done, calling doMagic 0,1
[27042.555] magicAttack(minStrRatN:0,minStrRatD:1
[27042.555] attackSpell,str:-1,-1 buffSpell/str:9,-21
[27042.555] AI_update(unit:UNIT_ADEPT id:155648 turn:206
[27042.555] AI_update - start call doMagicAttack
[27042.555] magicAttack(minStrRatN:2,minStrRatD:1
[27042.555] AI_update - after start call doMagicAttack
[27042.555] AI_update - unitAI done, calling doMagic 0,1
[27042.555] magicAttack(minStrRatN:0,minStrRatD:1
[27042.555] attackSpell,str:-1,-1 buffSpell/str:-1,-1
[27042.555] AI_update(unit:UNIT_ADEPT id:73734 turn:206
[27042.555] AI_update - start call doMagicAttack
[27042.555] magicAttack(minStrRatN:2,minStrRatD:1
[27042.555] AI_update - after start call doMagicAttack
[27042.555] AI_update - unitAI done, calling doMagic 0,1
[27042.555] magicAttack(minStrRatN:0,minStrRatD:1
[27042.555] attackSpell,str:-1,-1 buffSpell/str:-1,-1
[27042.555] AI_update(unit:UNIT_ADEPT id:344077 turn:206
[27042.555] AI_update - start call doMagicAttack
[27042.555] magicAttack(minStrRatN:2,minStrRatD:1
[27042.555] AI_update - after start call doMagicAttack
[27042.555] AI_update - unitAI done, calling doMagic 0,1
[27042.555] magicAttack(minStrRatN:0,minStrRatD:1
[27042.555] attackSpell,str:-1,-1 buffSpell/str:9,25
[27042.586] AI_update(unit:UNIT_ARCHER id:24578 turn:206
[27042.586] anyAttack(unit:UNIT_ARCHER id:24578 range:1,odds:65,stack:0,follow,0
[27042.586] AI_update - unitAI done, calling doMagic 0,1
[27042.586] AI_update(unit:UNIT_ARCHER id:16385 turn:206
[27042.586] anyAttack(unit:UNIT_ARCHER id:16385 range:1,odds:65,stack:0,follow,0
[27042.586] AI_update - unitAI done, calling doMagic 0,1
[27042.586] AI_update(unit:UNIT_ADEPT id:442382 turn:206
[27042.586] AI_update - start call doMagicAttack
[27042.586] magicAttack(minStrRatN:2,minStrRatD:1
[27042.586] AI_update - after start call doMagicAttack
[27042.586] anyAttack(unit:UNIT_ADEPT id:442382 range:1,odds:60,stack:0,follow,0
[27042.586] AI_update - unitAI done, calling doMagic 0,1
[27042.586] magicAttack(minStrRatN:0,minStrRatD:1
[27042.586] attackSpell,str:-1,-1 buffSpell/str:-1,-1
[27042.586] AI_update(unit:UNIT_ADEPT id:524292 turn:206
[27042.586] AI_update - start call doMagicAttack
[27042.586] magicAttack(minStrRatN:2,minStrRatD:1
[27042.586] AI_update - after start call doMagicAttack
[27042.596] anyAttack(unit:UNIT_ADEPT id:524292 range:1,odds:60,stack:0,follow,0
[27042.596] AI_update - unitAI done, calling doMagic 0,1
[27042.596] magicAttack(minStrRatN:0,minStrRatD:1
[27042.596] attackSpell,str:-1,-1 buffSpell/str:9,-5
[27042.596] AI_update(unit:UNIT_ADEPT id:622607 turn:206
[27042.596] AI_update - start call doMagicAttack
[27042.596] magicAttack(minStrRatN:2,minStrRatD:1
[27042.596] AI_update - after start call doMagicAttack
[27042.596] anyAttack(unit:UNIT_ADEPT id:622607 range:1,odds:60,stack:0,follow,0
[27042.596] AI_update - unitAI done, calling doMagic 0,1
[27042.596] magicAttack(minStrRatN:0,minStrRatD:1
[27042.596] attackSpell,str:-1,-1 buffSpell/str:-1,-1
[27042.596] AI_update(unit:UNIT_ADEPT id:303114 turn:206
[27042.596] AI_update - start call doMagicAttack
[27042.596] magicAttack(minStrRatN:2,minStrRatD:1
[27042.596] AI_update - after start call doMagicAttack
[27042.596] AI_update - unitAI done, calling doMagic 0,1
[27042.596] magicAttack(minStrRatN:0,minStrRatD:1
[27042.596] attackSpell,str:-1,-1 buffSpell/str:9,23
[27042.744] AI_update(unit:UNIT_DESTROY_UNDEAD id:647180 turn:206
[27042.744] anyAttack(unit:UNIT_DESTROY_UNDEAD id:647180 range:1,odds:65,stack:0,follow,0
[27042.744] anyAttack(unit:UNIT_DESTROY_UNDEAD id:647180 range:1,odds:55,stack:0,follow,0
[27042.756] anyAttack(unit:UNIT_DESTROY_UNDEAD id:647180 range:1,odds:65,stack:0,follow,0
[27042.756] anyAttack(unit:UNIT_DESTROY_UNDEAD id:647180 range:1,odds:45,stack:0,follow,0
[27042.756] anyAttack(unit:UNIT_DESTROY_UNDEAD id:647180 range:2,odds:40,stack:0,follow,0
[27042.766] AI_update - unitAI done, calling doMagic 0,1
[27042.766] AI_update(unit:UNIT_DESTROY_UNDEAD id:655368 turn:206
[27042.766] anyAttack(unit:UNIT_DESTROY_UNDEAD id:655368 range:1,odds:65,stack:0,follow,0
[27042.766] anyAttack(unit:UNIT_DESTROY_UNDEAD id:655368 range:1,odds:55,stack:0,follow,0
[27042.766] anyAttack(unit:UNIT_DESTROY_UNDEAD id:655368 range:1,odds:65,stack:0,follow,0
[27042.766] anyAttack(unit:UNIT_DESTROY_UNDEAD id:655368 range:1,odds:45,stack:0,follow,0
[27042.766] anyAttack(unit:UNIT_DESTROY_UNDEAD id:655368 range:2,odds:40,stack:0,follow,0
[27042.775] AI_update - unitAI done, calling doMagic 0,1
[27043.246] AI_update(unit:UNIT_CARAVEL id:221190 turn:206
[27043.246] anyAttack(unit:UNIT_CARAVEL id:221190 range:1,odds:70,stack:0,follow,0
[27043.256] AI_update - unitAI done, calling doMagic 0,1
[27043.256] AI_update(unit:UNIT_HUNTER id:40964 turn:206
[27043.256] anyAttack(unit:UNIT_HUNTER id:40964 range:1,odds:70,stack:0,follow,0
[27043.307] AI_update - unitAI done, calling doMagic 0,1
[27043.307] AI_update(unit:UNIT_ADEPT id:155657 turn:206
[27043.307] AI_update - unitAI done, calling doMagic 0,1
[27043.307] AI_update(unit:UNIT_ARCHER id:16385 turn:206
[27043.307] anyAttack(unit:UNIT_ARCHER id:16385 range:1,odds:65,stack:0,follow,0
[27043.307] AI_update - unitAI done, calling doMagic 0,1
[27043.307] AI_update(unit:UNIT_ADEPT id:237584 turn:206
[27043.336] anyAttack(unit:UNIT_ADEPT id:237584 range:1,odds:65,stack:0,follow,0
[27043.336] anyAttack(unit:UNIT_ADEPT id:237584 range:1,odds:45,stack:0,follow,0
[27043.336] anyAttack(unit:UNIT_ADEPT id:237584 range:2,odds:40,stack:0,follow,0
[27043.336] AI_update - unitAI done, calling doMagic 0,1
[27043.336] AI_update(unit:UNIT_ARCHER id:24578 turn:206
[27043.336] anyAttack(unit:UNIT_ARCHER id:24578 range:1,odds:65,stack:0,follow,0
[27043.336] AI_update - unitAI done, calling doMagic 0,1
[27043.336] AI_update(unit:UNIT_ENFORCER id:180237 turn:206
[27043.336] anyAttack(unit:UNIT_ENFORCER id:180237 range:1,odds:65,stack:0,follow,0
[27043.336] AI_update - unitAI done, calling doMagic 0,1
[27043.336] AI_update(unit:UNIT_ENFORCER id:147466 turn:206
[27043.336] anyAttack(unit:UNIT_ENFORCER id:147466 range:1,odds:65,stack:0,follow,0
[27043.336] AI_update - unitAI done, calling doMagic 0,1
[27043.336] AI_update(unit:UNIT_ENFORCER id:204800 turn:206
[27043.336] anyAttack(unit:UNIT_ENFORCER id:204800 range:1,odds:65,stack:0,follow,0
[27043.336] AI_update - unitAI done, calling doMagic 0,1
[27043.336] AI_update(unit:UNIT_ENFORCER id:163851 turn:206
[27043.336] anyAttack(unit:UNIT_ENFORCER id:163851 range:1,odds:65,stack:0,follow,0
[27043.336] AI_update - unitAI done, calling doMagic 0,1
[27043.336] AI_update(unit:UNIT_ENFORCER id:229391 turn:206
[27043.336] AI_update - unitAI done, calling doMagic 0,1
[27043.336] AI_update(unit:UNIT_ENFORCER id:106504 turn:206
[27043.336] anyAttack(unit:UNIT_ENFORCER id:106504 range:1,odds:65,stack:0,follow,0
[27043.336] AI_update - unitAI done, calling doMagic 0,1
[27043.336] AI_update(unit:UNIT_ENFORCER id:172044 turn:206
[27043.336] anyAttack(unit:UNIT_ENFORCER id:172044 range:1,odds:65,stack:0,follow,0
[27043.336] AI_update - unitAI done, calling doMagic 0,1
[27043.336] AI_update(unit:UNIT_ENFORCER id:131077 turn:206
[27043.336] anyAttack(unit:UNIT_ENFORCER id:131077 range:1,odds:65,stack:0,follow,0
[27043.336] AI_update - unitAI done, calling doMagic 0,1
[27043.336] AI_update(unit:UNIT_ENFORCER id:188430 turn:206
[27043.336] anyAttack(unit:UNIT_ENFORCER id:188430 range:1,odds:65,stack:0,follow,0
[27043.336] AI_update - unitAI done, calling doMagic 0,1
[27043.766] AI_update(unit:UNIT_RANGER id:40964 turn:206
[27043.766] anyAttack(unit:UNIT_RANGER id:40964 range:1,odds:70,stack:0,follow,0
[27043.797] AI_update - unitAI done, calling doMagic 0,1
[27043.797] AI_update(unit:UNIT_DWARVEN_SOLDIER id:155659 turn:206
[27043.797] anyAttack(unit:UNIT_DWARVEN_SOLDIER id:155659 range:1,odds:70,stack:0,follow,0
[27043.836] AI_update - unitAI done, calling doMagic 0,1
[27043.836] AI_update(unit:UNIT_DWARVEN_SOLDIER id:122888 turn:206
[27043.836] AI_update - unitAI done, calling doMagic 0,1
[27043.836] AI_update(unit:UNIT_LION id:237568 turn:206
[27043.836] anyAttack(unit:UNIT_LION id:237568 range:1,odds:0,stack:0,follow,0
[27043.836] AI_update - unitAI done, calling doMagic 0,1
[27043.836] AI_update(unit:UNIT_DWARVEN_SOLDIER id:180231 turn:206
[27043.846] AI_update - unitAI done, calling doMagic 0,1
[27043.846] AI_update(unit:UNIT_ADEPT id:204809 turn:206
[27043.846] AI_update - unitAI done, calling doMagic 0,1
[27043.846] AI_update(unit:UNIT_ADEPT id:229381 turn:206
[27043.846] AI_update - unitAI done, calling doMagic 0,1
[27043.846] AI_update(unit:UNIT_ADEPT id:253953 turn:206
[27043.846] AI_update - unitAI done, calling doMagic 0,1
[27043.846] AI_update(unit:UNIT_WOLF id:221186 turn:206
[27043.846] anyAttack(unit:UNIT_WOLF id:221186 range:1,odds:0,stack:0,follow,0
[27043.846] AI_update - unitAI done, calling doMagic 0,1
[27043.846] AI_update(unit:UNIT_WARRIOR id:163850 turn:206
[27043.846] anyAttack(unit:UNIT_WARRIOR id:163850 range:1,odds:65,stack:0,follow,0
[27043.846] AI_update - unitAI done, calling doMagic 0,1
[27044.047] AI_update(unit:UNIT_ADEPT id:155656 turn:206
[27044.047] anyAttack(unit:UNIT_ADEPT id:155656 range:1,odds:65,stack:0,follow,0
[27044.047] anyAttack(unit:UNIT_ADEPT id:155656 range:1,odds:45,stack:0,follow,0
[27044.047] anyAttack - bestSpell is -1, value -1
 
God Bless anyone who can figure that out! My brain hurts from reading it.
 
Ugh, I'll take a look about this asap, can you provide a save - the last logged message can't (I hope) be directly behind the ctd, because I can't find an assumption that bestSpell >=0.
 
Here is a save. In this save there are 3 adepts in Golden Leane (yellow capital). They are the adepts I was playing with in the steps above.
 
loki1232 said:
How do i access these logs?

Perhaps a simple capitalization error on "bestSpell"?

They are in 'My Documents\My Games\Sid Meier's Civilization 4\Logs'
 
Do we need to download the patch? Did they add anything we don't already have?
 
Its the same except for maybe some italian tranlation. They have been in lockdown for quite a while just waiting for take2 to certify.
 
Found it. I forgot that pBestPlot in cityAttack and anyAttack isn't always the plot the unit will be attacking - its just the plot the unit will be moving to this turn. Therefore sometimes pBestPlot has no units, pBestPlot->getBestDefender() == NULL, and Civ4 CTDs when I do enemy->anything. I've uploaded new versions, the only thing that has changed is CvUnitAI.cpp.
 
talchas said:
Found it. I forgot that pBestPlot in cityAttack and anyAttack isn't always the plot the unit will be attacking - its just the plot the unit will be moving to this turn. Therefore sometimes pBestPlot has no units, pBestPlot->getBestDefender() == NULL, and Civ4 CTDs when I do enemy->anything. I've uploaded new versions, the only thing that has changed is CvUnitAI.cpp.

Woohoo, you code stud you! I will try to get a build out that includes this soon.
 
Top Bottom