Jean Elcard
The Flavournator
Hi peeps,
I'm totally lost with something that should be a simple task. All I want to do is copying a mechanism from Warlords to Vanilla. Means, I want to recreate the Python event function onImprovementDestroyed for Vanilla Civ.
I added this to the file CvEventManager.py (my changes are bold):
This to CvDLLEventReporterIFaceBase.h:
And this to CvPlot.cpp:
After compiling successfully the dll and copying it to the right place as well as the Python Civ4 loads but crashes back to windows when I try to start a game.
I have no idea what I'm doing wrong. I hope you can help me. Maybe I missed something totally obvious? Please tell me if you need mor information.
Greetings, Elgor.
I'm totally lost with something that should be a simple task. All I want to do is copying a mechanism from Warlords to Vanilla. Means, I want to recreate the Python event function onImprovementDestroyed for Vanilla Civ.
I added this to the file CvEventManager.py (my changes are bold):
Code:
## EVENTLIST
self.EventHandlerMap = {
...
[B]'improvementDestroyed' : self.onImprovementDestroyed,[/B]
...
}
...
[B]def onImprovementDestroyed(self, argsList):
'Improvement Destroyed'
iImprovement, iOwner, iX, iY = argsList
if (not self.__LOG_IMPROVEMENT):
return
CvUtil.pyPrint('Improvement %s was Destroyed at %d, %d'
%(PyInfo.ImprovementInfo(iImprovement).getDescription(), iX, iY))[/B]
...
This to CvDLLEventReporterIFaceBase.h:
Code:
...
virtual void improvementBuilt(int iImprovementType, int iX, int iY) = 0;
[B]virtual void improvementDestroyed(int iImprovementType, int iPlayer, int iX, int iY) = 0;[/B]
virtual void routeBuilt(int RouteType, int iX, int iY) = 0;
...
And this to CvPlot.cpp:
Code:
...
void CvPlot::setImprovementType(ImprovementTypes eNewValue)
{
int iI;
[B]ImprovementTypes eTempType;
eTempType = getImprovementType();[/B]
...
if (getImprovementType() != NO_IMPROVEMENT)
{
gDLL->getEventReporterIFace()->improvementBuilt(getImprovementType(), getX_INLINE(), getY_INLINE());
}
[B]if (getImprovementType() == NO_IMPROVEMENT)
{
gDLL->getEventReporterIFace()->improvementDestroyed(eTempType, getOwnerINLINE(), getX_INLINE(), getY_INLINE());
}[/B]
}
}
...
After compiling successfully the dll and copying it to the right place as well as the Python Civ4 loads but crashes back to windows when I try to start a game.
I have no idea what I'm doing wrong. I hope you can help me. Maybe I missed something totally obvious? Please tell me if you need mor information.
Greetings, Elgor.