Announcement

Collapse
No announcement yet.

Need SDK/Copiling help - plss I have no idea about how to solve it!!!

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Need SDK/Copiling help - plss I have no idea about how to solve it!!!

    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
    .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 ()")
    in CyUnitInterface1.cpp
    .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 ()")
    in CyUnit.h
    bool canMove();
    bool hasMoved();
    //------------------------------ MIO OIL COST -----------------------
    int oilCostPerMove();
    //------------------------------------- end -------------------------------

    int airRange();
    int nukeRange();
    in CyUnit.cpp
    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;
    }
    in CvInfos.h
    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
    int m_iMinAreaSize;
    int m_iMoves;
    //--------------- MIO OIL COST --------------------
    int m_iOilCostPerMove;
    //-------------------- end ------------------------------

    int m_iAirRange;
    in CvInfos.cpp
    m_iMoves(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;
    }
    stream->Read(&m_iMoves);
    //--------------- 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);
    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");
    CvUnit.h
    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
    in CvUnit.cpp
    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 ----------------------------------------

    }
    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);
    }

    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>
    in CvUnitSchema.xml
    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"/>
    element type="iMinAreaSize"/>
    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
    Last edited by Duke176; November 30, 2006, 03:22.

  • #2
    iOilCostPerMove - is also in CvUnit.xml, CvUnitSchema.xml as

    in CvUnit.xml - under UNITCLASS_MECHANIZED_INFANTRY
    iMinAreaSize>-1/iMinAreaSize>
    iMoves>2/iMoves>

    iOilCostPerMove>1/iOilCostPerMove>

    iAirRange>0/iAirRange>
    in CvUnitSchema.xml
    ElementType name="iMinAreaSize" content="textOnly" dt:type="int"/>
    ElementType name="iMoves" content="textOnly" dt:type="int"/>

    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"/>

    element type="iOilCostPerMove" minOccurs="0"/>

    element type="iAirRange"/>
    element type="iNukeRange"/>

    for img of error given by compiler pls look here:
    Click here
    Last edited by Duke176; November 29, 2006, 13:50.

    Comment


    • #3
      if you don't see the "<" into quote areas it's becuase I should delete them to let the forum show the code. - dunno why

      Comment


      • #4
        it seems it could be a problem of using CvUnit.cpp from version 2.00 and other files (like the one in the shoot) from v. 2.08.

        I'll check and let you know - so it could help someone else with the same problem.

        Comment


        • #5
          YES the reason was that one sorry for idiot question

          Comment

          Working...
          X