TheLadiesOgre
Aspiring Codesmith
- Joined
- Jan 16, 2009
- Messages
- 505
Again thank you all gentlemen, I have no idea what was causing the CTD's, but last night I decided on a whim to restart that part of the code from square one (read: the first post). Anyway, it works perfectly now with only a minor graphical quibble (after the unit "dies" it becomes just a flag with 0.0/X strength until the beginning of the next turn). If you're interested this is the code as it stands now.
::updateCombat (like above this is only one of the two basically identical entries)
::kill
and finally in ::doTurn
While I have your attention, I would like to ask you how I would go about fixing a notification that informs me that 3498738957 [NUM:Units:Unit] have been healed. This is the code I'm referring to.
This is in ::updateCombat and is similar to the code above in that it is one of two basically identical sections.
Thank you for your help as well as your time and consideration in reading this.
::updateCombat (like above this is only one of the two basically identical entries)
Spoiler :
Code:
bool bSurvivor = false;
if (getSurvivorChance() > 0)
{
if (GC.getGameINLINE().getSorenRandNum(100, "Too Badass Check") <= getSurvivorChance())
{
bSurvivor = true;
setSurvivor(true);
jumpToNearestValidPlot();
}
}
if ((!bSurvivor) && (isOneUp()))
{
setCanRespawn(true);
}
::kill
Spoiler :
Code:
m_bDeathDelay = true;
if (isCanRespawn())
{
CvCity* pCapitalCity = GET_PLAYER(getOwnerINLINE()).getCapitalCity();
setXY(pCapitalCity->getX_INLINE(), pCapitalCity->getY_INLINE(), false, false, false);
changeDamage(-getDamage());
changeOneUpCount(-1);
CvWString szBuffer = gDLL->getText("TXT_KEY_MISC_BATTLEFIELD_EVAC", getNameKey());
gDLL->getInterfaceIFace()->addMessage(getOwnerINLINE(), true, GC.getEVENT_MESSAGE_TIME(), szBuffer, "AS2D_POSITIVE_DINK", MESSAGE_TYPE_INFO, getButton(), (ColorTypes)GC.getInfoTypeForString("COLOR_GREEN"), getX_INLINE(), getY_INLINE());
m_bDeathDelay = false;
return;
}
if (isSurvivor())
{
changeDamage(-getDamage());
setDamage(GC.getMAX_HIT_POINTS() -(getSurvivorChance() / 1000));
CvWString szBuffer = gDLL->getText("TXT_KEY_MISC_YOUR_UNIT_IS_HARDCORE", getNameKey());
gDLL->getInterfaceIFace()->addMessage(getOwnerINLINE(), true, GC.getEVENT_MESSAGE_TIME(), szBuffer, "AS2D_POSITIVE_DINK", MESSAGE_TYPE_INFO, getButton(), (ColorTypes)GC.getInfoTypeForString("COLOR_GREEN"), getX_INLINE(), getY_INLINE());
m_bDeathDelay = false;
return;
}
and finally in ::doTurn
Spoiler :
Code:
if (isCanRespawn())
{
setCanRespawn(false);
}
if (isSurvivor())
{
setSurvivor(false);
}
While I have your attention, I would like to ask you how I would go about fixing a notification that informs me that 3498738957 [NUM:Units:Unit] have been healed. This is the code I'm referring to.
This is in ::updateCombat and is similar to the code above in that it is one of two basically identical sections.
Spoiler :
Code:
int iUnitsHealed = 0;
if (pDefender->getVictoryAdjacentHeal() > 0)
{
if (GC.getGameINLINE().getSorenRandNum(100, "Field Hospital Die Roll") <= pDefender->getVictoryAdjacentHeal())
{
int iI;
for (iI = 0; iI < NUM_DIRECTION_TYPES; iI++)
{
CvPlot* pLoopPlot = plotDirection(pPlot->getX_INLINE(), pPlot->getY_INLINE(), ((DirectionTypes)iI));
if (pLoopPlot != NULL)
{
if (pLoopPlot->area() == pPlot->area())
{
CLLNode<IDInfo>* pUnitNode = pLoopPlot->headUnitNode();
while (pUnitNode != NULL)
{
CvUnit* pLoopUnit = ::getUnit(pUnitNode->m_data);
pUnitNode = pLoopPlot->nextUnitNode(pUnitNode);
if (pLoopUnit->getTeam() == getTeam())
{
iUnitsHealed++;
pLoopUnit->doHeal();
}
}
}
}
}
}
}
bool bDefenderHealed = false;
if (pDefender->getVictoryStackHeal() > 0)
{
if (GC.getGameINLINE().getSorenRandNum(100, "Field Surgeon Die Roll") <= pDefender->getVictoryStackHeal())
{
bDefenderHealed = true;
CLLNode<IDInfo>* pUnitNode = pPlot->headUnitNode();
while (pUnitNode != NULL)
{
CvUnit* pLoopUnit = ::getUnit(pUnitNode->m_data);
pUnitNode = pPlot->nextUnitNode(pUnitNode);
if (pLoopUnit->getTeam() == getTeam())
{
iUnitsHealed++;
pLoopUnit->doHeal();
}
}
}
}
if (!bDefenderHealed)
{
if (pDefender->getVictoryHeal() > 0)
{
if (GC.getGameINLINE().getSorenRandNum(100, "Field Medic Die Roll") <= pDefender->getVictoryHeal())
{
pDefender->doHeal();
}
}
}
if (iUnitsHealed > 1)
{
CvWString szBuffer = gDLL->getText("TXT_KEY_MISC_ENEMY_FIELD_MEDIC_DEFENDERS", GET_PLAYER(pDefender->getOwnerINLINE()).getCivilizationAdjective());
gDLL->getInterfaceIFace()->addMessage(getOwnerINLINE(), true, GC.getEVENT_MESSAGE_TIME(), szBuffer, "AS2D_COMBAT", MESSAGE_TYPE_INFO, getButton(), (ColorTypes)GC.getInfoTypeForString("COLOR_RED"), pDefender->getX_INLINE(), pDefender->getY_INLINE());
szBuffer = gDLL->getText("TXT_KEY_MISC_FIELD_MEDIC_DEFENDERS", getNameKey(), iUnitsHealed);
gDLL->getInterfaceIFace()->addMessage(pDefender->getOwnerINLINE(), true, GC.getEVENT_MESSAGE_TIME(), szBuffer, "AS2D_POSITIVE_DINK", MESSAGE_TYPE_INFO, getButton(), (ColorTypes)GC.getInfoTypeForString("COLOR_GREEN"), pDefender->getX_INLINE(), pDefender->getY_INLINE());
}
Thank you for your help as well as your time and consideration in reading this.