Civic Attitude Modifier

There was already a variable name after false before your change? Some files don't have that one, I can't quite remember why.

Running SAFE_DELETE before InitList might be required/helpful. Cannot remember if InitList is cautious about creating the variable memory allocation or not.

When we get back home and settled (will be at least 2 days), I'll try to look at your actual file and pick things apart. Full source so I can compile it myself and the other files to have your mod and try loading it myself would be VERY helpful. Or if you download WinDbg and set that up (I think you already did... but can't remember who it was I recently helped set it up precisely) if you check what function it claims to have crashed during we can find out precisely when/where it breaks.
 
There was already a variable name after false before your change? Some files don't have that one, I can't quite remember why.

Running SAFE_DELETE before InitList might be required/helpful. Cannot remember if InitList is cautious about creating the variable memory allocation or not.

When we get back home and settled (will be at least 2 days), I'll try to look at your actual file and pick things apart. Full source so I can compile it myself and the other files to have your mod and try loading it myself would be VERY helpful. Or if you download WinDbg and set that up (I think you already did... but can't remember who it was I recently helped set it up precisely) if you check what function it claims to have crashed during we can find out precisely when/where it breaks.

The mod is just Rise of Mankind 2.71. You can download that here at CFC. I'll upload my current sources later tonight...

EDIT:
Sources
 
I don't want to nag (even though I really am...)

Is there any chance of you looking at this, or will it have to wait until I learn more C++ in my programming classes...
 
Sorry, kid is quite the handful, and was 2 weeks early, so we have lots to clean & prepare around here still. My Mom is coming to town next week, so I'll probably actually be twice as busy, even though it is supposed to mean that I get time to relax. After that I head back to work and do night shift in a university, meaning I am alone most of the time and due to the nature of research, not expected to have many results. Thus I can take time to examine the code at that point most probably. Honestly, at this moment I don't recall what issues we were having (but a review of the thread at that point will reveal all ;))

A post next week wouldn't hurt to remind me to check this out.
 
@Afforess

When you do get this up and running, would you please share the sources?

If, I ever get it to work, I will release it as a modcomp. But as for now, it doesn't work at all.

Oh, Xienwolf, hopefully this post serves as your 1 week reminder. Thanks for all your help thus far...
 
Yup, nearly perfect timing to remind me. Planning to go back to work (and subsequently slack off by programming) on Tuesday of this upcoming week. I'll download this now so I remember it, and add it to my daily websites list for Tuesday.
 
Trying to set things up now so I can test things out. RoM main download doesn't seem to include the source files, where can I get those?

RoM uses RevDCM 2.51 DLL. Zappara doesn't know how to code SDK.
 
TheLadiesOgre pointed out for me that you uploaded the full source in this thread anyway. I had downloaded it from a few posts back, but not yet opened it to see that you offered us more than just what you had modified. So I should be set, but I'll snag the RevDCM code if I find myself needing a cleaner WinMerge to check all of your changes against.
 
Ok, I finally got the code set up so I can compile a debug DLL using your sources posted here, and confirmed that Rise of Mankind will launch and load a game without issue on my system. With the downloaded RoM mod, will I need anything added so that your DLL should work? (ie - new Global Defines or GameOptions. Things that the modified DLL requires to live)
 
This code is extra (unused) so if it isn't something you are working on you should remove it. Doesn't cause issues, just isn't needed.

Code:
void CvGame::createBarbarianUnits()
{
	CvUnit* pLoopUnit;
/*************************************************************************************************/
/** JOOYO_ADDON, Added by Jooyo, 07/12/09                                                        */
/**                                                                                              */
/**                                                                                              */
/*************************************************************************************************/
	CvUnit* pUnit;
/*************************************************************************************************/
/** JOOYO_ADDON                          END                                                     */
/*************************************************************************************************/


Failed Assert on loading,

Code:
CvLeaderHeadInfo& CvGlobals::getLeaderHeadInfo(LeaderHeadTypes eLeaderHeadNum)
{
	FAssert(eLeaderHeadNum > -1);
	FAssert(eLeaderHeadNum < GC.getNumLeaderHeadInfos());
	return *(m_paLeaderHeadInfo[eLeaderHeadNum]);
}

Triggered a Leaderhead request of -1 on this one while loading the game, so something is checking leaders too early, loading them wrong, or otherwise messing up there. But I was allowed to continue past this point and keep loading for a while.

--------------

Flavour_Military not found while loading your technologies

---------------

RELIGION_HELLENISM already exists Assert, got it during re-arranging of the TGA, so potentially not an issue, but WoC had things set up to supress those asserts during rearranging in the version I used at least. Triggered again for Egyptology or somesuch immediately

-----------------------

Failed to find dependancy data while trying to load Wilhelmina's Leaderheadinfos

----------------

Invalid characters or something MAJORLY messing up in loading of ForceControlInfos. Again I get popped into the TGA loading methods at this point, though I don't know why I would be this time.

------------------

After that, I have made it to the main menu screen.

------------------

After trying to launch a new game it tells me that you have failed to create a CopyNonDefaultsReadPass2 where you need to have one for EventInfo

-----------------

Assert on setPopulationgrowthratepercentage() being set to less than 0 while loading things up, on every player.

-----------------

That gets me into the game, I trigger Autoplay for 10 turns and immediately get an assert for CvCity checking isHasReligion for religion index -1 (NO_RELIGION) which it ought not to do, python is responsible for this.

-------------------

Moments later python tries to call CvPlayerAI::AI_getAttitude on itself, again it should not do so.

--------------------

My 10 turns of Autoplay end without any crashes at this point.

That's all the time I have for checking this out today. Looks like I might need to get the raw RoM code and check if these early asserts are theirs or yours. But compile that sourcecode again and tell me what/where you get an error, and check that it is reliable. I'll see if I can get any errors using a non-debug version which cause me a crash, sometimes debugs will allow you to keep moving past things which normal compiles will toss as a crash (but you still get an error message for them)
 
Some of this is explainable. I'm not building off of a fresh code like RevDCM sources, but another modders (Jooyo) changes, so a few of the exceptions and assert errors, are his fault. (The other one's I think are caused by WoC, but I'm not sure.) I'm going to scrap his changes for now and start over with a fresh copy of RevDCM and see what I get with that.
 
Hi Afforess!

xienwolf just contacted to check this thread and see if I could do anything. So here I am :D

First, I would like to know exactly what you want to do (but without reading all the posts ;)). Do you just want to add the excerpt of your first post or did you idea evolve?

You can either go for it by each civic, making the modifier dependent on the civic itself; then it would be somewhat easy. Or you could go the most flexible way and meddle in the LH file, so that, for each leader, you'd say: X modifier for Y civic for Z reason and it would be a bit more complicated but doable.

Edit: Okay, now I see what you want to do. Hmm, hard thing. I need to look at the sources.

Edit2: Not sure at all but, looking at what I did before (a bit differently but using a similar readpass2() code), I think you may need the bolded part here:
bool CvCivicInfo::readPass2(CvXMLLoadUtility* pXML)
{
if (!CvInfoBase::read(pXML))
{
return false;
}

if (gDLL->getXMLIFace()->SetToChildByTagName(pXML->GetXML(),"CivicAttitudeChanges"))
{
if (pXML->SkipToNextVal())
{
pXML->InitList(&m_piCivicAttitudeChanges, GC.getNumCivicInfos(), 0);

int iCount = gDLL->getXMLIFace()->GetNumChildren(pXML->GetXML());
TCHAR szCivicKey[256];

if (gDLL->getXMLIFace()->SetToChild(pXML->GetXML()))
{
if(!(iCount <= GC.getNumCivicInfos()))
{
char szMessage[1024];
sprintf( szMessage, "For loop iterator is greater than array size \n Current XML file is: %s", GC.getCurrentXMLFile().GetCString());
gDLL->MessageBox(szMessage, "XML Error");
}

for (int i = 0; i < iCount; i++)
{
if (pXML->SkipToNextVal())
{
if (pXML->GetChildXmlVal(szCivicKey))
{
int iCivicType = pXML->FindInInfoClass(szCivicKey);
if (iCivicType >= 0)
{
pXML->GetNextXmlVal(&m_piCivicAttitudeChanges[iCivicType]);
//pXML->GetNextXmlVal(&m_pszCivicAttitudeTextKeys[iCivicType]);

gDLL->getXMLIFace()->SetToParent(pXML->GetXML());
}
else
{
// skip unknown civic type
gDLL->getXMLIFace()->SetToParent(pXML->GetXML());
}
}

if (!gDLL->getXMLIFace()->NextSibling(pXML->GetXML()))
{
break;
}
}
}

gDLL->getXMLIFace()->SetToParent(pXML->GetXML());
}
}

gDLL->getXMLIFace()->SetToParent(pXML->GetXML());
}

return true;
}
Sorry about the indentation, though :/
 
Hi Afforess!

xienwolf just contacted to check this thread and see if I could do anything. So here I am :D
I'm glad I have someone to help me. This modcomp desperately needs help.

Edit2: Not sure at all but, looking at what I did before (a bit differently but using a similar readpass2() code), I think you may need the bolded part here:Sorry about the indentation, though :/

Okay, I'm going to try that...my compiler has gotten past CvInfos without error, but has finished yet.
 
Okay. Keep me updated :)

If it works, doing the TXT_KEY part shouldn't be hard.
 
I forgot that you hadn't exposed this new field to Python yet. This part is pretty easy. Add this line to CyInfoInterface1.cpp:

Code:
    python::class_<CvCivicInfo, python::bases<CvInfoBase> >("CvCivicInfo")
        ...

        // Arrays
        ...
        [B].def("getCivicAttitudeChanges", &CvCivicInfo::getCivicAttitudeChanges, "int (int /*CivicTypes*/ iCivicType)")[/B]
        ;

    python::class_<CvUnitClassInfo, python::bases<CvInfoBase> >("CvUnitClassInfo")
        ...
This should be enough to allow you to enter that test code above. :D


I just noticed this post, and I had never followed these directions. However, now, When I updated CyInfoInterface1.cpp, I get compiler errors:

Spoiler :

Code:
CyInfoInterface1.cpp(382) : error C2780: 'boost::python::class_<W,X1>::self &boost::python::class_<W,X1>::def(const char *,Fn,const A1 &,const A2 &,const A3 &)' : expects 5 arguments - 3 provided
        with
        [
            W=CvCivicInfo,
            X1=boost::python::bases<CvInfoBase>
        ]
        Boost-1.32.0\include\boost\python\class.hpp(265) : see declaration of 'boost::python::class_<W,X1>::def'
        with
        [
            W=CvCivicInfo,
            X1=boost::python::bases<CvInfoBase>
        ]
CyInfoInterface1.cpp(382) : error C2780: 'boost::python::class_<W,X1>::self &boost::python::class_<W,X1>::def(const char *,Fn,const A1 &,const A2 &)' : expects 4 arguments - 3 provided
        with
        [
            W=CvCivicInfo,
            X1=boost::python::bases<CvInfoBase>
        ]
        Boost-1.32.0\include\boost\python\class.hpp(249) : see declaration of 'boost::python::class_<W,X1>::def'
        with
        [
            W=CvCivicInfo,
            X1=boost::python::bases<CvInfoBase>
        ]
CyInfoInterface1.cpp(382) : error C2914: 'boost::python::class_<W,X1>::def' : cannot deduce template argument as function argument is ambiguous
        with
        [
            W=CvCivicInfo,
            X1=boost::python::bases<CvInfoBase>
        ]
CyInfoInterface1.cpp(382) : error C2784: 'boost::python::class_<W,X1>::self &boost::python::class_<W,X1>::def(const char *,A1,const A2 &)' : could not deduce template argument for 'overloaded function type' from 'overloaded function type'
        with
        [
            W=CvCivicInfo,
            X1=boost::python::bases<CvInfoBase>
        ]
        Boost-1.32.0\include\boost\python\class.hpp(242) : see declaration of 'boost::python::class_<W,X1>::def'
        with
        [
            W=CvCivicInfo,
            X1=boost::python::bases<CvInfoBase>
        ]
CyInfoInterface1.cpp(382) : error C2780: 'boost::python::class_<W,X1>::self &boost::python::class_<W,X1>::def(const char *,F)' : expects 2 arguments - 3 provided
        with
        [
            W=CvCivicInfo,
            X1=boost::python::bases<CvInfoBase>
        ]
        Boost-1.32.0\include\boost\python\class.hpp(233) : see declaration of 'boost::python::class_<W,X1>::def'
        with
        [
            W=CvCivicInfo,
            X1=boost::python::bases<CvInfoBase>
        ]
CyInfoInterface1.cpp(382) : error C2780: 'boost::python::class_<W,X1>::self &boost::python::class_<W,X1>::def(const boost::python::def_visitor<Derived> &)' : expects 1 arguments - 3 provided
        with
        [
            W=CvCivicInfo,
            X1=boost::python::bases<CvInfoBase>
        ]
        Boost-1.32.0\include\boost\python\class.hpp(223) : see declaration of 'boost::python::class_<W,X1>::def'
        with
        [
            W=CvCivicInfo,
            X1=boost::python::bases<CvInfoBase>
        ]
CyInfoInterface1.cpp(382) : error C2228: left of '.def' must have class/struct/union type
CyInfoInterface1.cpp(382) : error C2228: left of '.def' must have class/struct/union type
CyInfoInterface1.cpp(382) : error C2228: left of '.def' must have class/struct/union type
CyInfoInterface1.cpp(382) : error C2228: left of '.def' must have class/struct/union type
CyInfoInterface1.cpp(382) : error C2228: left of '.def' must have class/struct/union type
CyInfoInterface1.cpp(382) : error C2228: left of '.def' must have class/struct/union type
CyInfoInterface1.cpp(382) : error C2228: left of '.def' must have class/struct/union type
CyInfoInterface1.cpp(382) : error C2228: left of '.def' must have class/struct/union type
CyInfoInterface1.cpp(382) : error C2228: left of '.def' must have class/struct/union type
CyInfoInterface1.cpp(382) : error C2228: left of '.def' must have class/struct/union type
CyInfoInterface1.cpp(382) : error C2228: left of '.def' must have class/struct/union type
CyInfoInterface1.cpp(382) : error C2228: left of '.def' must have class/struct/union type

The code for that section looks like this:


Code:
        .def("pyGetWeLoveTheKing", &CvCivicInfo::pyGetWeLoveTheKing, "wstring ()")

        // Arrays

        .def("getYieldModifier", &CvCivicInfo::getYieldModifier, "int (int i)")
        
      [COLOR=Red]  .def("getCivicAttitudeChanges", &CvCivicInfo::getCivicAttitudeChanges, "int (int /*CivicTypes*/ iCivicType)") //Afforess[/COLOR]
        
        .def("getCapitalYieldModifier", &CvCivicInfo::getCapitalYieldModifier, "int (int i)")
        .def("getTradeYieldModifier", &CvCivicInfo::getTradeYieldModifier, "int (int i)")
        .def("getCommerceModifier", &CvCivicInfo::getCommerceModifier, "int (int i)")

I'm not sure what I did wrong.

Oh, and Opera, I compiled a new DLL before I noticed those CyInfoInterface changes, and it compiled fine and the game loaded, but I have no way to test if the codes working, since it hasn't been exposed to python, and there is no code for the foreign diplo screens yet...
 
Yay! I'd really like to see this completed. I feel bad for getting it so close but not having enough time to delve into the WoC sources to figure out what we're missing.

BTW, to preserve the indentation, post using [CODE]...[/CODE] tags (the # button).
 
Back
Top Bottom