Trouble merging kmod and super forts

OK, this is a bit more complex, so I took another approach.

I have tried to merge the function CvUnitAI::AI_cityAttack between K-Mod and Super Forts. For me, it compiles. So in this version of the CvUnitAI.cpp file attached, I reverted to Karadoc's code as well for the function CvUnitAI::AI_follow.

It means that we have to undo all the other changes as stated in my posts # 14, 16, 18 and 20 (I told you to keep notes...):

edit CvPlot.h, find AI_sumStrength and comment it out as per Karadoc.

edit CvUnitAI.h, find AI_cityAttack and replace the line as follows as per Karadoc:
bool AI_cityAttack(int iRange, int iOddsThreshold, int iFlags = 0, bool bFollow = false);

edit CvUnitAI.h again, find AI_finalOddsThreshold, comment it out as per Karadoc.

same file still, in the beginning, find bool AI_follow and put it back as per Karadoc:

//bool AI_follow();
bool AI_follow(bool bFirst = true); // K-Mod
// K-Mod

in CvUnit.h this time, find virtual bool AI_follow and put it back as per Karadoc:

//virtual bool AI_follow() = 0;
virtual bool AI_follow(bool bFirst = true) = 0; // K-Mod

Cross fingers...

EDIT: actually, the files CvUnit.h and CvUnitAI.h were correct as per attachments in your posts #7 and 8! You just need to revert back to the previous version of CvPlot.h which I don't have.
 
So close! :)
Spoiler :
1>CvUnitAI.cpp
1>CvUnitAI.cpp(17049) : error C2039: 'AI_sumStrength' : is not a member of 'CvPlot'
1> c:\Games\CivIV\2K Games\Firaxis Games\Sid Meier's Civilization 4 Complete\Beyond the Sword\Mods\K-Fallout\Assets\CvGameCoreDLL\CvPlot.h(30) : see declaration of 'CvPlot'
1>CvUnitAI.cpp(17078) : error C2039: 'AI_sumStrength' : is not a member of 'CvPlot'
1> c:\Games\CivIV\2K Games\Firaxis Games\Sid Meier's Civilization 4 Complete\Beyond the Sword\Mods\K-Fallout\Assets\CvGameCoreDLL\CvPlot.h(30) : see declaration of 'CvPlot'
1>CvUnitAI.cpp(17222) : error C2143: syntax error : missing ',' before 'if'
1>CvUnitAI.cpp(17225) : error C2143: syntax error : missing ')' before '{'
1>CvUnitAI.cpp(17225) : error C2143: syntax error : missing ';' before '{'


did I miss something or not puit something back, because that is the one I commented out, but did not see a replacement for.. and it is all over unitAI.cpp...even in what looks like some of K's code..
 
Well, it was disabled by Karadoc, even if it is still there at some places. But the error only shows at one function CvUnitAI::AI_bombardCity.

Since I have not touched this function today, I guess it has to be put back in as you say, but I don't understand it more than you do!

There are other errors in CvUnitAI::AI_anyAttack (they were not obvious before and were left unattended) so I have attached a new file.

Yes, we are getting closer... :confused:
 
4 errors! damn you sum strength! :p

Spoiler :
1>CvUnitAI.cpp
1>CvUnitAI.cpp(17049) : error C2039: 'AI_sumStrength' : is not a member of 'CvPlot'
1> c:\Games\CivIV\2K Games\Firaxis Games\Sid Meier's Civilization 4 Complete\Beyond the Sword\Mods\K-Fallout\Assets\CvGameCoreDLL\CvPlot.h(30) : see declaration of 'CvPlot'
1>CvUnitAI.cpp(17078) : error C2039: 'AI_sumStrength' : is not a member of 'CvPlot'
1> c:\Games\CivIV\2K Games\Firaxis Games\Sid Meier's Civilization 4 Complete\Beyond the Sword\Mods\K-Fallout\Assets\CvGameCoreDLL\CvPlot.h(30) : see declaration of 'CvPlot'
 
That could be normal if you didn't put it back in CvPlot.h. What did you do with it?
 
damn I thought that did it!

I added it back in, well removed the notation marks.

but I got this:

Spoiler :
1>CvUnitAI.obj : error LNK2019: unresolved external symbol "public: int __thiscall CvPlot::AI_sumStrength(enum PlayerTypes,enum PlayerTypes,enum DomainTypes,bool,bool,bool)const " (?AI_sumStrength@CvPlot@@QBEHW4PlayerTypes@@0W4DomainTypes@@_N22@Z) referenced in function "protected: bool __thiscall CvUnitAI::AI_bombardCity(void)" (?AI_bombardCity@CvUnitAI@@IAE_NXZ)
 
OK, too complicated, have to review strategy.

K-Mod has modified heavily all files, so until a proper merge can be done, the function bool CvUnitAI::AI_bombardCity() should be Karadoc's version.

Here is the revised file.

It also means that in CvPlot.h, AI_sumStrength should be commented out as per Karadoc's version.

Agreed?...
 
You mean ... you have a compiled dll???... Congratulations!

Let's recapitulate: you have one problematic file: CvUnitAI.cpp

Three functions could not be merged properly with K-Mod and Super Forts included:

CvUnitAI::AI_bombardCity (currently only K-Mod's version)

CvUnitAI::AI_cityAttack

CvUnitAI::AI_anyAttack

For the last two functions, I tried to incorporate into K-Mod's code the intended Super Forts changes - since I don't understand a thing, I might as well have pissed in a violin!

So if you really want to have Super Forts - complete edition - in your mod, maybe you should ask Red Key to review these three functions for you (and us), as he kindly proposed.

PS: another thing, 'en passant', I read that you intended to include OrionVeteran' s City Size Prerequisite modcomp. I saw that your CvPlot.cpp was missing the code for it.
 
Looks like you made some great progress. I could merge those last three functions. What are the challenges in merging them? I only skimmed over all the posts in here, but I thought I saw you mention Kmod disables some functions that my code uses. Is that part of the problem in these three functions or was that already fixed?

If you want me to merge - please post both the Super Forts version and your version of CvUnitAI because my current version of Super Forts is not the same as the one you are merging.
 
Thanks, Red Key. Here are the two files CvUnitAI.cpp.

As I said earlier, Karadoc has changed an enormous amount of stuff almost in every SDK file, you will see when you will compare the two files.

You will tell us for the challenges in merging them because for us, it is "Mission Impossible" without a proper knowledge of C++. The functions disabled by K-Mod are still disabled, it was the only way to compile the dll for us.

Thanks again!
 
yeah, he sent me the updated code to do it, so I am going to try and merge that again in a bit :) I deleted it and moved on to Super forts (Bad Idea!! :p)

but that is my next job!

Here are the files key, yours are in SF

Obviously if you need any others let me know...My head is still spinning! :D

haha ya beat me Isen!!
 

Attachments

  • CvUnitAI.rar
    157.4 KB · Views: 55
CvUnitAI::AI_bombardCity (currently only K-Mod's version)

CvUnitAI::AI_cityAttack

CvUnitAI::AI_anyAttack

You guys forgot to mention CvUnitAI::AI_improveBonus had not been merged yet. I did it too. Without that the AI wouldn't build forts outside their borders to claim resources. Hopefully it works because K-mod added a new function called "doesImprovementConnectBonus" and I don't know what that does so it might prevent the AI from building outside borders.

For AI_bombardCity I just took out the AI_sumStrength part of my code. For AI_cityAttack what you guys did looked fine. For AI_anyAttack I decided it didn't really need any changes so I just reverted it back to the K-mod code.

Let me know if the attached file works. I didn't try compiling it. I just tried to be careful about my merging.
 

Attachments

  • CvUnitAI_merged.zip
    124.2 KB · Views: 53
nearly but not quite :) By the time Isen had got it to work for me I was so lost! :) I was just adding his latest effort and reporting the errors I completely lost what was actually happening :D

Spoiler :
1>CvUnitAI.cpp
1>CvUnitAI.cpp(21224) : error C2065: 'iValue' : undeclared identifier
1>CvUnitAI.cpp(21227) : error C3861: 'iValue': identifier not found, even with argument-dependent lookup
1>CvUnitAI.cpp(21231) : error C3861: 'iValue': identifier not found, even with argument-dependent lookup
1>CvUnitAI.cpp(21236) : error C3861: 'iValue': identifier not found, even with argument-dependent lookup
1>CvUnitAI.cpp(21237) : error C3861: 'iValue': identifier not found, even with argument-dependent lookup
1>CvUnitAI.cpp(21242) : error C3861: 'iValue': identifier not found, even with argument-dependent lookup
1>CvUnitAI.cpp(21244) : error C3861: 'iValue': identifier not found, even with argument-dependent lookup
 
Oops. Just add in the line "int iValue;" like so before line 21224:

Spoiler :
// Super Forts begin *AI_worker* - this should better determine the value of a build than the original code
int iValue;
if(GC.getDefineINT("SUPER_FORTS_SAFE_BUILD") != 0)
{
iValue = GC.getBuildInfo(eBuild).getTime();
if(GC.getBuildInfo(eBuild).isKill())
{
iValue += 10000;
}
if(GC.getImprovementInfo((ImprovementTypes)GC.getBuildInfo(eBuild).getImprovement()).isActsAsCity())
{
iValue /= 10;
}
}
else
 
I added a secon int value thing that I think was also missing (which is why I attached the file), I just wasn't confident about this last one

Spoiler :
1>CvUnitAI.cpp
1>CvUnitAI.cpp(21244) : error C2065: 'iValue' : undeclared identifier
1>CvUnitAI.cpp(21246) : error C3861: 'iValue': identifier not found, even with argument-dependent lookup
1>NMAKE : fatal error U1077: '"C:\Program Files\Microsoft Visual C++ Toolkit 2003\bin\cl.exe"' : return code '0x2'
 

Attachments

  • CvUnitAI.rar
    102.2 KB · Views: 42
Put it outside/before the if statement like I did in my spoiler. You won't need the second one and it will fix the problem.
 
Top Bottom