Debugging MagisterModMod

Tholal

Emperor
Joined
May 19, 2009
Messages
1,676
@MagisterCultuum - Thanks for the alpha and save.

First issue found.
  • CIV4UnitInfos.xml - UNITCLASS_ARTIST - You have a stray '3' outside of the XML tags in the UnitClassUpgrades section
Also looks like you have hardcoded paths to Magister Modmod in several places. This will break anyone trying to run it from a different directory.
 
changeFreeBonus() - FAssert(getFreeBonus(eIndex) >= 0);

This happens when switching religions and looks to be related to your ReligiousMana section in onPlayerChangeStateReligion. Players are ending up with negative mana values. This may be By Design on your part? If so, it's not gamebreaking but it may confuse the AI at some points. And it also results in a cascade of other asserts related to bonuses.
 
@MagisterCultuum - Thanks for the alpha and save.

First issue found.
  • CIV4UnitInfos.xml - UNITCLASS_ARTIST - You have a stray '3' outside of the XML tags in the UnitClassUpgrades section
Also looks like you have hardcoded paths to Magister Modmod in several places. This will break anyone trying to run it from a different directory.

I don't know how that 3 got there, but of course removed it promptly.

changeFreeBonus() - FAssert(getFreeBonus(eIndex) >= 0);

This happens when switching religions and looks to be related to your ReligiousMana section in onPlayerChangeStateReligion. Players are ending up with negative mana values. This may be By Design on your part? If so, it's not gamebreaking but it may confuse the AI at some points. And it also results in a cascade of other asserts related to bonuses.

It is intentional for the religious mana buildings to subtract some mana.

(Originally I only wanted the religion to provide -1 mana in the opposing sphere, but a +1 kept being read as a +3. I just did a quick test, and found that a -1 now seems to be read as a +5 now.)

I've never had any problems with this before. None of those bonus related asserts seem to be anything other but a minor annoyance to be hidden in debug mode and never even noticed otherwise.

At what points would it confuse the AI?

This is related to trying to play a movie for the Market.

Why would it be trying to play a move for the Market? That building never had any movies associated with it, and I pretty much always play with movies turned off.

CvSpellInterface.py - you're missing some indentation between lines 15954 and 15959

I don't think there actually was any missing indentation there. I use "break" and "continue" statements there right after the colon. If the "then" part of an "if-then" statement is a single line, then it is perfectly acceptable in python to place it on the same line right after the colon rather than using any indentation.

Just to make things clearer though, I moved those statements to the next line, indented them, and put the following code in (probably unnecessary) "else" statements.


As far as I can tell, nothing you have mentioned yet is at all related to the crash though. Have you any clue what is causing that last assert?
Code:
Assert Failed

File:  CvGlobals.cpp
Line:  1845
Expression:  eImprovementNum > -1
Message:
 
In started a new game and I came across these new Asserts, but no crash yet.

Code:
Assert Failed

File:  CvTeam.cpp
Line:  7510
Expression:  eTeam < MAX_CIV_TEAMS
Message:  eTeam is expected to be within maximum bounds (invalid Index)

----------------------------------------------------------

Assert Failed

File:  CvPlot.cpp
Line:  8626
Expression:  getStolenVisibilityCount(eTeam) >= 0
Message:

----------------------------------------------------------

Assert Failed

File:  CvTeamAI.cpp
Line:  3726
Expression:  !isAtWar(eWarTeam)
Message:  should be at peace with eWarTeam

----------------------------------------------------------
Assert Failed

File:  CvUnit.cpp
Line:  11925
Expression:  !at(iX, iY)
Message:

----------------------------------------------------------
Assert Failed

File:  CvUnit.cpp
Line:  12519
Expression:  pOldPlot != pNewPlot
Message:

----------------------------------------------------------

Assert Failed

File:  c:\users\phil\desktop\projects\cvgamecoredll\CvPlayerAI.h
Line:  25
Expression:  ePlayer != NO_PLAYER
Message:  Player is not assigned a valid value

----------------------------------------------------------
Assert Failed

File:  CvGame.cpp
Line:  5798
Expression:  getBuildingClassCreatedCount(eIndex) <= GC.getBuildingClassInfo(eIndex).getMaxGlobalInstances()
Message:  Index is expected to be within maximum bounds (invalid Index)

----------------------------------------------------------
Assert Failed

File:  CvCity.cpp
Line:  1517
Expression:  isNoBonus((BonusTypes)iI) || getNumBonuses((BonusTypes)iI) >= ((isConnectedToCapital()) ? (GET_PLAYER(getOwnerINLINE()).getBonusImport((BonusTypes)iI) - GET_PLAYER(getOwnerINLINE()).getBonusExport((BonusTypes)iI)) : 0)
Message:

----------------------------------------------------------

Assert Failed

File:  CvUnit.cpp
Line:  12722
Expression:  getMoves() >= 0
Message:

----------------------------------------------------------


Assert Failed

File:  CvInfos.cpp
Line:  2669
Expression:  i > -1
Message:  Index out of bounds

----------------------------------------------------------

Assert Failed

File:  CvSelectionGroupAI.cpp
Line:  228
Expression:  false
Message: 

----------------------------------------------------------
Assert Failed

File:  CvGlobals.cpp
Line:  3741
Expression:  strcmp(szType, "NONE")==0 || strcmp(szType, "")==0
Message:  info type RevealPlot not found, Current XML file is: xml\GameInfo/CIV4EspionageMissionInfo.xml

----------------------------------------------------------
Assert Failed

File:  CvPlayerAI.cpp
Line:  14710
Expression:  false
Message: 

----------------------------------------------------------
Assert Failed

File:  CvPlayer.cpp
Line:  11277
Expression:  getTotalLandScored() >= 0
Message: 

----------------------------------------------------------
Assert Failed

File:  CvPlayer.cpp
Line:  13239
Expression:  getLandScore() >= 0
Message:  

----------------------------------------------------------

I imagine the one that gives a path to a file on your desktop rather than in the same directory as the rest of the DLL source files is in no way my fault but something that should be fixed in MNAI too.
 
Last edited:
It is intentional for the religious mana buildings to subtract some mana.

At what points would it confuse the AI?

There are some points in which the AI might use the number of bonuses it has to calculate some value. Negative values could cause unexpected results. I don't have any specific examples, just wanted to mention the possibility


Why would it be trying to play a move for the Market? That building never had any movies associated with it, and I pretty much always play with movies turned off.

No idea. I'm just reporting on the information the DLL is receiving from python. I imagine there is an incorrect value being sent in this case.



As far as I can tell, nothing you have mentioned yet is at all related to the crash though. Have you any clue what is causing that last assert?
Assert Failed

I think I have a fix in the DLL, though I'm not entirely sure what was going on. Something to do with a Pirate Cove.
 
Last edited:
Back
Top Bottom