<Nexus>
Traveler of the Multiverse
So I'd like to continue this topic here and ask for @f1rpo 's help
I am very noob for programming but tying to learn a thing or two
So I found these code parts that I consider relevant:
and this:
I think this second part is the place to insert the code to print an alert. Maybe something like this:
Am I at least on the right track?
CvPlot.cpp attached too.
This, for example, shows the "your Farm has been destroyed by a marauding Barbarian Warrior" message.
I am very noob for programming but tying to learn a thing or two
So I found these code parts that I consider relevant:
C++:
int CvPlot::getTerrainTurnDamage(CvSelectionGroup* pGroup) const
{
if (!GC.getGameINLINE().isModderGameOption(MODDERGAMEOPTION_TERRAIN_DAMAGE))
{
return 0;
}
CLLNode<IDInfo>* pUnitNode = pGroup->headUnitNode();
CvUnit* pLoopUnit;
int iMaxDamage = 0;
FAssertMsg(pUnitNode != NULL, "headUnitNode() expected to be non-NULL");
while (pUnitNode != NULL)
{
pLoopUnit = ::getUnit(pUnitNode->m_data);
pUnitNode = pGroup->nextUnitNode(pUnitNode);
int iDamage = getTerrainTurnDamage(pLoopUnit);
if ( iDamage > iMaxDamage )
{
iMaxDamage = iDamage;
}
}
return iMaxDamage;
}
int CvPlot::getTerrainTurnDamage(CvUnit* pUnit) const
{
//PROFILE_FUNC();
int iDamagePercent = -GC.getTerrainInfo(getTerrainType()).getHealthPercent();
// Movement Limits by 45deg - START
if (pUnit != NULL)
{
if (GC.getGameINLINE().isOption(GAMEOPTION_MOVEMENT_LIMITS))
{
if (pUnit->isOutsideMovementLimits(this))
{
iDamagePercent += 25;
}
}
}
// Movement Limits by 45deg - END
and this:
C++:
int CvPlot::getTotalTurnDamage(CvUnit* pUnit) const
{
return getTerrainTurnDamage(pUnit) + getFeatureTurnDamage();
}
I think this second part is the place to insert the code to print an alert. Maybe something like this:
C++:
int CvPlot::getTotalTurnDamage(CvUnit* pUnit) const
{
return getTerrainTurnDamage(pUnit) + getFeatureTurnDamage()
{
szBuffer = gDLL->getText("TXT_KEY_MISC_IMP_DESTROYED", GC.getImprovementInfo(pPlot->getImprovementType()).getTextKeyWide(), getNameKey(), getVisualCivAdjective(pPlot->getTeam()));
gDLL->getInterfaceIFace()->addMessage(pPlot->getOwnerINLINE(), false, GC.getEVENT_MESSAGE_TIME(), szBuffer, "AS2D_PILLAGED", MESSAGE_TYPE_INFO, getButton(), (ColorTypes)GC.getInfoTypeForString("COLOR_RED"), pPlot->getX_INLINE(), pPlot->getY_INLINE(), true, true);
}
}
Am I at least on the right track?
CvPlot.cpp attached too.