hello,
I have a question about compliling sdk files.
I made a minor mod to base files:
- added an "iCostant" to xml unit infos
- modified cvinfo.cpp/.h; cvunit.cpp/h;cyinterface1.cpp; cyunit.cpp/h and cyinterface1.cpp
the change (part of a dev project) just verify if a function that lower player gold of the "iCostant" ammount when a unit moves works.
I never touched cvgroupselection.cpp but while I'm compliling to see if it works the compiler find a bug in that file - I never touched it.
Here is a shoot to give oyu an idea.
I cannot really get the wrong change I made - all other modded files are complied without any prb.
little add on to help my helpers:
in CyInfoInterface1.cpp
in CyUnitInterface1.cpp
in CyUnit.h
in CyUnit.cpp
in CvInfos.h
in CvInfos.cpp
CvUnit.h
in CvUnit.cpp
THAT'S ALL.
Anyone can help me???
iOilCostPerMove - is also in CvUnit.xml, CvUnitSchema.xml as
in CvUnit.xml - under UNITCLASS_MECHANIZED_INFANTRY
in CvUnitSchema.xml
for img of error given by compiler pls look here:
Click here
P.s. I had to delete the "<" in Xml files to let the forum show the row, dunno why
I have a question about compliling sdk files.
I made a minor mod to base files:
- added an "iCostant" to xml unit infos
- modified cvinfo.cpp/.h; cvunit.cpp/h;cyinterface1.cpp; cyunit.cpp/h and cyinterface1.cpp
the change (part of a dev project) just verify if a function that lower player gold of the "iCostant" ammount when a unit moves works.
I never touched cvgroupselection.cpp but while I'm compliling to see if it works the compiler find a bug in that file - I never touched it.
Here is a shoot to give oyu an idea.
I cannot really get the wrong change I made - all other modded files are complied without any prb.
little add on to help my helpers:
in CyInfoInterface1.cpp
.def("getMinAreaSize", &CvUnitInfo::getMinAreaSize, "int ()")
.def("getMoves", &CvUnitInfo::getMoves, "int ()")
//------------------------------ MIO OIL COST -------------------------------
.def("getOilCostPerMove", &CvUnitInfo::getOilCostPerMove, "int ()")
//---------------------------------------- end -------------------------------------
.def("getAirRange", &CvUnitInfo::getAirRange, "int ()")
.def("getNukeRange", &CvUnitInfo::getNukeRange, "int ()")
.def("getMoves", &CvUnitInfo::getMoves, "int ()")
//------------------------------ MIO OIL COST -------------------------------
.def("getOilCostPerMove", &CvUnitInfo::getOilCostPerMove, "int ()")
//---------------------------------------- end -------------------------------------
.def("getAirRange", &CvUnitInfo::getAirRange, "int ()")
.def("getNukeRange", &CvUnitInfo::getNukeRange, "int ()")
.def("maxMoves", &CyUnit::maxMoves, "int ()")
.def("canMove", &CyUnit::canMove, "bool ()")
.def("hasMoved", &CyUnit::hasMoved, "bool ()")
//------------------------------------- MIO OIL COST --------------------------------------------------
.def("oilCostPerMove", &CyUnit:
ilCostPerMove, "int ()")
//--------------------------------------------- end ----------------------------------------------------------
.def("airRange", &CyUnit::airRange, "int ()")
.def("nukeRange", &CyUnit::nukeRange, "int ()")
.def("canMove", &CyUnit::canMove, "bool ()")
.def("hasMoved", &CyUnit::hasMoved, "bool ()")
//------------------------------------- MIO OIL COST --------------------------------------------------
.def("oilCostPerMove", &CyUnit:

//--------------------------------------------- end ----------------------------------------------------------
.def("airRange", &CyUnit::airRange, "int ()")
.def("nukeRange", &CyUnit::nukeRange, "int ()")
bool canMove();
bool hasMoved();
//------------------------------ MIO OIL COST -----------------------
int oilCostPerMove();
//------------------------------------- end -------------------------------
int airRange();
int nukeRange();
bool hasMoved();
//------------------------------ MIO OIL COST -----------------------
int oilCostPerMove();
//------------------------------------- end -------------------------------
int airRange();
int nukeRange();
bool CyUnit::hasMoved()
{
return m_pUnit ? m_pUnit->hasMoved() : false;
}
//---------------------------------- MIO OIL COST ---------------------------------
int CyUnit:
ilCostPerMove()
{
return m_pUnit ? m_pUnit->oilCostPerMove() : -1;
}
//------------------------------------- end ----------------------------------------------
int CyUnit::airRange()
{
return m_pUnit ? m_pUnit->airRange() : -1;
}
{
return m_pUnit ? m_pUnit->hasMoved() : false;
}
//---------------------------------- MIO OIL COST ---------------------------------
int CyUnit:

{
return m_pUnit ? m_pUnit->oilCostPerMove() : -1;
}
//------------------------------------- end ----------------------------------------------
int CyUnit::airRange()
{
return m_pUnit ? m_pUnit->airRange() : -1;
}
DllExport int getMinAreaSize() const; // Exposed to Python
DllExport int getMoves() const; // Exposed to Python
//---------------- MIO OIL COST -------------------------
DllExport int getOilCostPerMove() const; // Exposed to Python
//--------------------- end -------------------------------------
DllExport int getAirRange() const; // Exposed to Python
DllExport int getNukeRange() const; // Exposed to Python
DllExport int getMoves() const; // Exposed to Python
//---------------- MIO OIL COST -------------------------
DllExport int getOilCostPerMove() const; // Exposed to Python
//--------------------- end -------------------------------------
DllExport int getAirRange() const; // Exposed to Python
DllExport int getNukeRange() const; // Exposed to Python
int m_iMinAreaSize;
int m_iMoves;
//--------------- MIO OIL COST --------------------
int m_iOilCostPerMove;
//-------------------- end ------------------------------
int m_iAirRange;
int m_iMoves;
//--------------- MIO OIL COST --------------------
int m_iOilCostPerMove;
//-------------------- end ------------------------------
int m_iAirRange;
m_iMoves(0),
//----------------------- MIO OIL COST ------------------
m_iOilCostPerMove(0),
//-------------------------- end -------------------------------
m_iAirRange(0),
//----------------------- MIO OIL COST ------------------
m_iOilCostPerMove(0),
//-------------------------- end -------------------------------
m_iAirRange(0),
int CvUnitInfo::getMoves() const
{
return m_iMoves;
}
//------------------------- MIO OIL COST ------------------------
int CvUnitInfo::getOilCostPerMove() const
{
return m_iOilCostPerMove;
}
//--------------------------- end --------------------------------------
int CvUnitInfo::getAirRange() const
{
return m_iAirRange;
}
{
return m_iMoves;
}
//------------------------- MIO OIL COST ------------------------
int CvUnitInfo::getOilCostPerMove() const
{
return m_iOilCostPerMove;
}
//--------------------------- end --------------------------------------
int CvUnitInfo::getAirRange() const
{
return m_iAirRange;
}
stream->Read(&m_iMoves);
//--------------- MIO OIL COST -------------------------
stream->Read(&m_iOilCostPerMove);
//--------------------- end ---------------------------------
stream->Read(&m_iAirRange);
//--------------- MIO OIL COST -------------------------
stream->Read(&m_iOilCostPerMove);
//--------------------- end ---------------------------------
stream->Read(&m_iAirRange);
stream->Write(m_iMoves);
//--------------------- MIO OIL COST -------------------------
stream->Write(m_iOilCostPerMove);
//------------------------------ end -------------------------------
stream->Write(m_iAirRange);
//--------------------- MIO OIL COST -------------------------
stream->Write(m_iOilCostPerMove);
//------------------------------ end -------------------------------
stream->Write(m_iAirRange);
pXML->GetChildXmlValByName(&m_iMinAreaSize, "iMinAreaSize");
pXML->GetChildXmlValByName(&m_iMoves, "iMoves");
//------------------------- MIO OIL COST -----------------------------------
pXML->GetChildXmlValByName(&m_iOilCostPerMove, "iOilCostPerMove");
//------------------------------------- end ---------------------------------------
pXML->GetChildXmlValByName(&m_iAirRange, "iAirRange");
pXML->GetChildXmlValByName(&m_iNukeRange, "iNukeRange");
pXML->GetChildXmlValByName(&m_iMoves, "iMoves");
//------------------------- MIO OIL COST -----------------------------------
pXML->GetChildXmlValByName(&m_iOilCostPerMove, "iOilCostPerMove");
//------------------------------------- end ---------------------------------------
pXML->GetChildXmlValByName(&m_iAirRange, "iAirRange");
pXML->GetChildXmlValByName(&m_iNukeRange, "iNukeRange");
DllExport bool canMove() const; // Exposed to Python
DllExport bool hasMoved() const; // Exposed to Python
//----------------------------------- MIO OIL COST -----------------------------------
DllExport int oilCostPerMove() const; // Exposed to Python //--------------------------------------end-------------------------------------------------
DllExport int airRange() const; // Exposed to Python
DllExport int nukeRange() const; // Exposed to Python
DllExport bool hasMoved() const; // Exposed to Python
//----------------------------------- MIO OIL COST -----------------------------------
DllExport int oilCostPerMove() const; // Exposed to Python //--------------------------------------end-------------------------------------------------
DllExport int airRange() const; // Exposed to Python
DllExport int nukeRange() const; // Exposed to Python
void CvUnit::attack(CvPlot* pPlot, bool bQuick)
{
FAssert(canMoveInto(pPlot, true));
FAssert(getCombatTimer() == 0);
setAttackPlot(pPlot);
updateCombat(bQuick);
}
//---------------------------------- MIO OIL COST ------------------------------------I get this here to decleare the function that recalls the row after
int CvUnit:
ilCostPerMove() const
{
return GC.getUnitInfo(getUnitType()).getOilCostPerMove();
}
//------------------------------------------- end -----------------------------
void CvUnit::move(CvPlot* pPlot, bool bShow)
{
FeatureTypes eFeature;
EffectTypes eEffect;
FAssert(canMoveOrAttackInto(pPlot) || isMadeAttack());
changeMoves(pPlot->movementCost(this, plot()));
setXY(pPlot->getX_INLINE(), pPlot->getY_INLINE(), true, true, (bShow && pPlot->isVisibleToWatchingHuman()));
if (getOwnerINLINE() == GC.getGameINLINE().getActivePlayer())
{
if (!(pPlot->isOwned()))
{
//spawn birds if trees present - JW
eFeature = pPlot->getFeatureType();
if (eFeature != NO_FEATURE)
{
if (GC.getASyncRand().get(100) < GC.getFeatureInfo(eFeature).getEffectProbability() )
{
eEffect = (EffectTypes)GC.getInfoTypeForString(GC.getFeature Info(eFeature).getEffectType());
gDLL->getEngineIFace()->TriggerEffect(eEffect, pPlot->getPoint(), (float)(GC.getASyncRand().get(360)));
gDLL->getInterfaceIFace()->playGeneralSound("AS3D_UN_BIRDS_SCATTER", pPlot->getPoint());
}
}
}
}
gDLL->getEventReporterIFace()->unitMove(pPlot, this);
//------------------------------- MIO OIL COST ------------------------------
GET_PLAYER(getOwnerINLINE()).changeGold(-(oilCostPerMove()));
//------------------------------------- end ----------------------------------------
}
{
FAssert(canMoveInto(pPlot, true));
FAssert(getCombatTimer() == 0);
setAttackPlot(pPlot);
updateCombat(bQuick);
}
//---------------------------------- MIO OIL COST ------------------------------------I get this here to decleare the function that recalls the row after
int CvUnit:

{
return GC.getUnitInfo(getUnitType()).getOilCostPerMove();
}
//------------------------------------------- end -----------------------------
void CvUnit::move(CvPlot* pPlot, bool bShow)
{
FeatureTypes eFeature;
EffectTypes eEffect;
FAssert(canMoveOrAttackInto(pPlot) || isMadeAttack());
changeMoves(pPlot->movementCost(this, plot()));
setXY(pPlot->getX_INLINE(), pPlot->getY_INLINE(), true, true, (bShow && pPlot->isVisibleToWatchingHuman()));
if (getOwnerINLINE() == GC.getGameINLINE().getActivePlayer())
{
if (!(pPlot->isOwned()))
{
//spawn birds if trees present - JW
eFeature = pPlot->getFeatureType();
if (eFeature != NO_FEATURE)
{
if (GC.getASyncRand().get(100) < GC.getFeatureInfo(eFeature).getEffectProbability() )
{
eEffect = (EffectTypes)GC.getInfoTypeForString(GC.getFeature Info(eFeature).getEffectType());
gDLL->getEngineIFace()->TriggerEffect(eEffect, pPlot->getPoint(), (float)(GC.getASyncRand().get(360)));
gDLL->getInterfaceIFace()->playGeneralSound("AS3D_UN_BIRDS_SCATTER", pPlot->getPoint());
}
}
}
}
gDLL->getEventReporterIFace()->unitMove(pPlot, this);
//------------------------------- MIO OIL COST ------------------------------
GET_PLAYER(getOwnerINLINE()).changeGold(-(oilCostPerMove()));
//------------------------------------- end ----------------------------------------
}
int CvUnit::movesLeft() const
{
return max(0, (maxMoves() - getMoves()));
}
bool CvUnit::canMove() const
{
//----------------------------- MIO OIL COST --------------------------------- look if the cost of movement in oil ammount is higher than total ammount of OIL
if (GET_PLAYER(getOwnerINLINE()).getGold() < oilCostPerMove())
{
return false;
}
//------------------------------------------------- end ------------------------------
return (getMoves() < maxMoves());
}
bool CvUnit::hasMoved() const
{
return (getMoves() > 0);
}
{
return max(0, (maxMoves() - getMoves()));
}
bool CvUnit::canMove() const
{
//----------------------------- MIO OIL COST --------------------------------- look if the cost of movement in oil ammount is higher than total ammount of OIL
if (GET_PLAYER(getOwnerINLINE()).getGold() < oilCostPerMove())
{
return false;
}
//------------------------------------------------- end ------------------------------
return (getMoves() < maxMoves());
}
bool CvUnit::hasMoved() const
{
return (getMoves() > 0);
}
THAT'S ALL.
Anyone can help me???
iOilCostPerMove - is also in CvUnit.xml, CvUnitSchema.xml as
in CvUnit.xml - under UNITCLASS_MECHANIZED_INFANTRY
iMinAreaSize>-1/iMinAreaSize>
iMoves>2/iMoves>
!-- MIO OIL COST -->
iOilCostPerMove>1/iOilCostPerMove>
!-- end -->
iAirRange>0/iAirRange>
iMoves>2/iMoves>
!-- MIO OIL COST -->
iOilCostPerMove>1/iOilCostPerMove>
!-- end -->
iAirRange>0/iAirRange>
ElementType name="iMinAreaSize" content="textOnly" dt:type="int"/>
ElementType name="iMoves" content="textOnly" dt:type="int"/>
!-- COSTO PER MOVE MOD -->
ElementType name="iOilCostPerMove" content="textOnly" dt:type="int"/>
ElementType name="iAirRange" content="textOnly" dt:type="int"/>
ElementType name="iNukeRange" content="textOnly" dt:type="int"/>
ElementType name="iMoves" content="textOnly" dt:type="int"/>
!-- COSTO PER MOVE MOD -->
ElementType name="iOilCostPerMove" content="textOnly" dt:type="int"/>
ElementType name="iAirRange" content="textOnly" dt:type="int"/>
ElementType name="iNukeRange" content="textOnly" dt:type="int"/>
element type="iMinAreaSize"/>
element type="iMoves"/>
!-- MIO OIL COST -->
element type="iOilCostPerMove" minOccurs="0"/>
element type="iAirRange"/>
element type="iNukeRange"/>
element type="iMoves"/>
!-- MIO OIL COST -->
element type="iOilCostPerMove" minOccurs="0"/>
element type="iAirRange"/>
element type="iNukeRange"/>
for img of error given by compiler pls look here:
Click here
P.s. I had to delete the "<" in Xml files to let the forum show the row, dunno why

Comment