TheLadiesOgre
Aspiring Codesmith
- Joined
- Jan 16, 2009
- Messages
- 505
Alright, I finished up the PillageCommerce stuff and when I went to compile, it complained about an illegal else without an if, but there is an if. This is the code (watch out its a lot, I've bolded the if and the matching else):
It looks perfectly fine to me, but it refuses to work, what is it that I am missing? I know that it has to be something idiotically simple
Edit: The bold if and the bold else line up in VC++
Spoiler :
Code:
[B]if[/B] (isDead())
{
int iExperience = defenseXPValue();
iExperience = ((iExperience * iAttackerStrength) / iDefenderStrength);
iExperience = range(iExperience, GC.getDefineINT("MIN_EXPERIENCE_PER_COMBAT"), GC.getDefineINT("MAX_EXPERIENCE_PER_COMBAT"));
pDefender->changeExperience(iExperience, maxXPValue(), true, pPlot->getOwnerINLINE() == pDefender->getOwnerINLINE(), !isBarbarian());
/******************************************************************************************/
/* Author: TheLadiesOgre (Original Concept By: Tsentom1) */
/* Date: 03.09.2009 */
/* ModComp: Promotions DLL */
/* Intended to: Add functionality for iVictory________Heals */
/******************************************************************************************/
int iUnitsHealed = 0;
if ((pDefender->getVictoryAdjacentTileHeal()) >= GC.getGameINLINE().getSorenRandNum(100, "Field Hospital Die Roll"))
{
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->getVictorySameTileHeal()) >= GC.getGameINLINE().getSorenRandNum(100, "Field Surgeon Die Roll"))
{
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 && (pDefender->getVictoryHeal()) >= GC.getGameINLINE().getSorenRandNum(100, "Field Medic Die Roll"))
{
pDefender->doHeal();
}
if (iUnitsHealed > 0)
{
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());
}
if (pDefender->isPillageOnVictory())
{
// Use python to determine pillage amounts...
lPillageGold = 0;
CyPlot* pyPlot = new CyPlot(pPlot);
CyUnit* pyUnit = new CyUnit(this);
CyArgsList argsList;
argsList.add(gDLL->getPythonIFace()->makePythonObject(pyPlot)); // pass in plot class
argsList.add(gDLL->getPythonIFace()->makePythonObject(pyUnit)); // pass in unit class
gDLL->getPythonIFace()->callFunction(PYGameModule, "doPillageGold", argsList.makeFunctionArgs(),&lPillageGold);
delete pyPlot; // python fxn must not hold on to this pointer
delete pyUnit; // python fxn must not hold on to this pointer
iPillageGold = (int)lPillageGold;
iPillageGold += (iPillageGold * getPillageChange()) / 100;
int iI = 0;
if ((iPillageGold > 0) && (!pDefender->isPillageCommerceChange((CommerceTypes)iI)))
{
GET_PLAYER(pDefender->getOwnerINLINE()).changeGold(iPillageGold);
szBuffer = gDLL->getText("TXT_KEY_MISC_PLUNDERED_GOLD_ON_VICTORY", iPillageGold, pDefender->getNameKey(), getVisualCivAdjective(getTeam()));
gDLL->getInterfaceIFace()->addMessage(pDefender->getOwnerINLINE(), true, GC.getEVENT_MESSAGE_TIME(), szBuffer, "AS2D_PILLAGE", MESSAGE_TYPE_INFO, getButton(), (ColorTypes)GC.getInfoTypeForString("COLOR_GREEN"), pPlot->getX_INLINE(), pPlot->getY_INLINE());
szBuffer = gDLL->getText("TXT_KEY_MISC_DEAD_LOOTED", getNameKey(), getVisualCivAdjective(pDefender->getTeam()));
gDLL->getInterfaceIFace()->addMessage(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);
}
}
if ((iPillageGold > 0) && (pDefender->isPillageCommerceChange(COMMERCE_CULTURE) == true))
{
float fInfluenceRatio = 0.0f;
fInfluenceRatio = doVictoryInfluence(this, false, false);
GET_PLAYER(pDefender->getOwnerINLINE()).changeGold(iPillageGold);
szBuffer = gDLL->getText("TXT_KEY_MISC_PLUNDERED_CULTURE_GOLD_ON_VICTORY", iPillageGold, pDefender->getNameKey(), getVisualCivAdjective(getTeam()));
if (fInfluenceRatio > 0.0f)
{
CvWString szInfluence;
szInfluence.Format(L" Tile influence: +%.1f%%", fInfluenceRatio);
szBuffer += szInfluence;
}
gDLL->getInterfaceIFace()->addMessage(pDefender->getOwnerINLINE(), true, GC.getEVENT_MESSAGE_TIME(), szBuffer, "AS2D_PILLAGE", MESSAGE_TYPE_INFO, getButton(), (ColorTypes)GC.getInfoTypeForString("COLOR_GREEN"), pPlot->getX_INLINE(), pPlot->getY_INLINE());
szBuffer = gDLL->getText("TXT_KEY_MISC_LOOTED_DEAD_SLANDERED", getNameKey(), getVisualCivAdjective(pDefender->getTeam()));
CvWString szInfluence;
szInfluence.Format(L" Tile influence: -%.1f%%", fInfluenceRatio);
szBuffer += szInfluence;
gDLL->getInterfaceIFace()->addMessage(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);
}
}
if ((iPillageGold > 0) && (pDefender->isPillageCommerceChange(COMMERCE_ESPIONAGE) == true))
{
GET_PLAYER(pDefender->getOwnerINLINE()).changeGold(iPillageGold);
GET_TEAM(getTeam()).changeEspionagePointsAgainstTeam(GET_PLAYER(pDefender->getOwnerINLINE()).getTeam(), iPillageGold);
szBuffer = gDLL->getText("TXT_KEY_MISC_PLUNDERED_ESPIONAGE_GOLD_ON_VICTORY", iPillageGold, getVisualCivAdjective(getTeam()));
gDLL->getInterfaceIFace()->addMessage(pDefender->getOwnerINLINE(), true, GC.getEVENT_MESSAGE_TIME(), szBuffer, "AS2D_PILLAGE", MESSAGE_TYPE_INFO, getButton(), (ColorTypes)GC.getInfoTypeForString("COLOR_GREEN"), pPlot->getX_INLINE(), pPlot->getY_INLINE());
szBuffer = gDLL->getText("TXT_KEY_MISC_INTERROGATED_BEFORE_EXECUTION", getNameKey(), getVisualCivAdjective(pDefender->getTeam()));
gDLL->getInterfaceIFace()->addMessage(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);
}
if ((iPillageGold > 0) && (pDefender->isPillageCommerceChange(COMMERCE_GOLD) == true))
{
GET_PLAYER(pDefender->getOwnerINLINE()).changeGold(iPillageGold * 2);
szBuffer = gDLL->getText("TXT_KEY_MISC_PLUNDERED_GOLD_ON_VICTORY", iPillageGold);
gDLL->getInterfaceIFace()->addMessage(pDefender->getOwnerINLINE(), true, GC.getEVENT_MESSAGE_TIME(), szBuffer, "AS2D_PILLAGE", MESSAGE_TYPE_INFO, getButton(), (ColorTypes)GC.getInfoTypeForString("COLOR_GREEN"), pPlot->getX_INLINE(), pPlot->getY_INLINE());
szBuffer = gDLL->getText("TXT_KEY_MISC_BEGGED_FOR_MERCY", getNameKey(), getVisualCivAdjective(pPlot->getTeam()));
gDLL->getInterfaceIFace()->addMessage(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);
}
if ((iPillageGold > 0) && (pDefender->isPillageCommerceChange(COMMERCE_RESEARCH) == true))
{
GET_PLAYER(pDefender->getOwnerINLINE()).changeGold(iPillageGold);
TechTypes eCurrentTech = GET_PLAYER(pDefender->getOwnerINLINE()).getCurrentResearch();
GET_TEAM(getTeam()).changeResearchProgress(eCurrentTech, iPillageGold, pDefender->getOwnerINLINE());
szBuffer = gDLL->getText("TXT_KEY_MISC_PLUNDERED_RESEARCH_GOLD_ON_VICTORY", iPillageGold);
gDLL->getInterfaceIFace()->addMessage(pDefender->getOwnerINLINE(), true, GC.getEVENT_MESSAGE_TIME(), szBuffer, "AS2D_PILLAGE", MESSAGE_TYPE_INFO, getButton(), (ColorTypes)GC.getInfoTypeForString("COLOR_GREEN"), pPlot->getX_INLINE(), pPlot->getY_INLINE());
szBuffer = gDLL->getText("TXT_KEY_MISC_TECH_COMPROMISED", getNameKey(), getVisualCivAdjective(pPlot->getTeam()));
gDLL->getInterfaceIFace()->addMessage(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);
}
}
/******************************************************************************************/
/* Promotions DLL End; TheLadiesOgre; 03.09.2009 */
/******************************************************************************************/
}
[B]else[/B]
It looks perfectly fine to me, but it refuses to work, what is it that I am missing? I know that it has to be something idiotically simple
Edit: The bold if and the bold else line up in VC++