I created a mission in CIV4MissionInfos.xml, added it to CvEnums.h, CvSelectionGroup.cpp, CvGameCoreUtils.cpp, and CyEnumsInterface.cpp. I based my code off the other missions I found there.
When I try to load my mod, however, as soon as the game starts initializing, it crashes. I tried to debug it, but it says:
The top item in the call stack box is Civ4BeyondSword.exe, and I am assuming the symbols aren't loaded because it is crashing in the .exe not the .dll.
What could be causing this crash? I'm assuming I did something which makes the .dll not compatible with the .exe, but I have no idea what this could be.
Here's my code:
Thanks in advance!
When I try to load my mod, however, as soon as the game starts initializing, it crashes. I tried to debug it, but it says:
No symbols are loaded for any call stack frame. The source code cannot be displayed.
The top item in the call stack box is Civ4BeyondSword.exe, and I am assuming the symbols aren't loaded because it is crashing in the .exe not the .dll.
What could be causing this crash? I'm assuming I did something which makes the .dll not compatible with the .exe, but I have no idea what this could be.
Here's my code:
Spoiler :
In CvEnums.h:
In CvSelectionGroup.cpp:
And CvGameCoreUtils.cpp:
All new code is in comments. Hope I provided enough.
Code:
enum MissionTypes // Exposed to Python
{
NO_MISSION = -1,
MISSION_MOVE_TO,
...
MISSION_MULTI_DESELECT,
/********************************************************************************/
/* LyTning94 1/14/11 */
/* Begin Assassins! Code */
/********************************************************************************/
MISSION_DIPLOMACY,
/********************************************************************************/
/* End Assassins! Code */
/********************************************************************************/
#ifdef _USRDLL
NUM_MISSION_TYPES
#endif
};
In CvSelectionGroup.cpp:
Code:
CvPlot* CvSelectionGroup::lastMissionPlot()
{
CLLNode<MissionData>* pMissionNode;
CvUnit* pTargetUnit;
pMissionNode = tailMissionQueueNode();
while (pMissionNode != NULL)
{
switch (pMissionNode->m_data.eMissionType)
{
case MISSION_MOVE_TO:
case MISSION_ROUTE_TO:
return GC.getMapINLINE().plotINLINE(pMissionNode->m_data.iData1, pMissionNode->m_data.iData2);
break;
...
case MISSION_DIE_ANIMATION:
/********************************************************************************/
/* LyTning94 1/14/11 */
/* Begin Assassins! Code */
/********************************************************************************/
case MISSION_DIPLOMACY:
/********************************************************************************/
/* End Assassins! Code */
/********************************************************************************/
break;
default:
FAssert(false);
break;
}
pMissionNode = prevMissionQueueNode(pMissionNode);
}
return plot();
}
Code:
bool CvSelectionGroup::canStartMission(int iMission, int iData1, int iData2, CvPlot* pPlot, bool bTestVisible, bool bUseCache)
{
...
while (pUnitNode != NULL)
{
pLoopUnit = ::getUnit(pUnitNode->m_data);
pUnitNode = nextUnitNode(pUnitNode);
switch (iMission)
{
case MISSION_MOVE_TO:
if (!(pPlot->at(iData1, iData2)))
{
return true;
}
break;
...
case MISSION_DIE_ANIMATION:
return false;
break;
/********************************************************************************/
/* LyTning94 1/14/11 */
/* Begin Assassins! Code */
/********************************************************************************/
case MISSION_DIPLOMACY:
if (pLoopUnit->canBoostDiplomacy(pPlot))
{
return true;
}
break;
/********************************************************************************/
/* End Assassins! Code */
/********************************************************************************/
case MISSION_BEGIN_COMBAT:
case MISSION_END_COMBAT:
case MISSION_AIRSTRIKE:
case MISSION_SURRENDER:
case MISSION_IDLE:
case MISSION_DIE:
case MISSION_DAMAGE:
case MISSION_MULTI_SELECT:
case MISSION_MULTI_DESELECT:
break;
default:
FAssert(false);
break;
}
}
return false;
}
Code:
void CvSelectionGroup::startMission()
{
...
switch (headMissionQueueNode()->m_data.eMissionType)
{
case MISSION_MOVE_TO:
...
case MISSION_DIE_ANIMATION:
/********************************************************************************/
/* LyTning94 1/14/11 */
/* Begin Assassins! Code */
/********************************************************************************/
case MISSION_DIPLOMACY:
/********************************************************************************/
/* End Assassins! Code */
/********************************************************************************/
break;
default:
FAssert(false);
break;
}
if ( bNotify )
{
NotifyEntity( headMissionQueueNode()->m_data.eMissionType );
}
pUnitNode = headUnitNode();
while (pUnitNode != NULL)
{
pLoopUnit = ::getUnit(pUnitNode->m_data);
pUnitNode = nextUnitNode(pUnitNode);
if (pLoopUnit->canMove())
{
switch (headMissionQueueNode()->m_data.eMissionType)
{
case MISSION_MOVE_TO:
...
case MISSION_DIE_ANIMATION:
bAction = true;
break;
/********************************************************************************/
/* LyTning94 1/14/11 */
/* Begin Assassins! Code */
/********************************************************************************/
case MISSION_DIPLOMACY:
if (pLoopUnit->boostDiplomacy())
{
bAction = true;
}
break;
/********************************************************************************/
/* End Assassins! Code */
/********************************************************************************/
...
}
}
}
}
Code:
void CvSelectionGroup::continueMission(int iSteps)
{
...
case MISSION_DIE_ANIMATION:
/********************************************************************************/
/* LyTning94 1/14/11 */
/* Begin Assassins! Code */
/********************************************************************************/
case MISSION_DIPLOMACY:
/********************************************************************************/
/* End Assassins! Code */
/********************************************************************************/
break;
case MISSION_BUILD:
if (!groupBuild((BuildTypes)(headMissionQueueNode()->m_data.iData1)))
{
bDone = true;
}
break;
default:
FAssert(false);
break;
}
...
case MISSION_DIE_ANIMATION:
/********************************************************************************/
/* LyTning94 1/14/11 */
/* Begin Assassins! Code */
/********************************************************************************/
case MISSION_DIPLOMACY:
/********************************************************************************/
/* End Assassins! Code */
/********************************************************************************/
bDone = true;
break;
...
}
}
}
}
}
And CvGameCoreUtils.cpp:
Code:
case MISSION_DIE_ANIMATION: szString = L"MISSION_DIE_ANIMATION"; break;
/********************************************************************************/
/* LyTning94 1/14/11 */
/* Begin Assassins! Code */
/********************************************************************************/
case MISSION_DIPLOMACY: szString = L"MISSION_DIPLOMACY"; break;
/********************************************************************************/
/* End Assassins! Code */
/********************************************************************************/
case MISSION_BEGIN_COMBAT: szString = L"MISSION_BEGIN_COMBAT"; break;
All new code is in comments. Hope I provided enough.

Thanks in advance!