[SDK] Using Microsoft Visual C++ 2005 Express Edition

You only need to build and use a debug DLL if your code doesn't work. ;)

BTW, you can point the makefile to the Boost Python include and library folders inside BTS--no need to copy them to your mod folder, but it doesn't hurt.

Ah. I'm new to this stuff, so I don't really know if some steps can be skipped or not.

Apparently there's no makefile for RFC, so I was wondering if I can still use Kael's guide with Codeblocks as long as I'm just making a minor change in CvTeamAI.cpp?
 
I've never looked at the RFC code, but as long as it hasn't added any .cpp files you can use the same makefile.
 
I've never looked at the RFC code, but as long as it hasn't added any .cpp files you can use the same makefile.

He added CvRhyes.cpp and CvRhyes.h. I don't know how to modify the makefile to that those files into account however, so I can't use Refar's/Chazcon's guide.
 
Find all places where CvArea appears, copy and paste it, and replace the copy with CvRhyes. So if you see "CvArea.obj", make that "CvArea.obj CvRhyes.obj". There should be two lines with the first starting with CvArea.obj--duplicate the whole line. Everywhere else should just require adding one file to a list.
 
Find all places where CvArea appears, copy and paste it, and replace the copy with CvRhyes. So if you see "CvArea.obj", make that "CvArea.obj CvRhyes.obj". There should be two lines with the first starting with CvArea.obj--duplicate the whole line. Everywhere else should just require adding one file to a list.

All the parts where CVArea appears:

Code:
Debug_OBJS=Debug\CvArea.obj Debug\CvArtFileMgr.obj (a whole bunch more files)

For this I should insert Debug\CvRhyes.obj after Debug\CvArea.obj.

Code:
Final_Release_OBJS=Final_Release\CvArea.obj Final_Release\CvArtFileMgr.obj (a whole bunch more files)

For this I should insert Final_Release\CvRhyes.obj after Final_Release\CvArea.obj.

Code:
dist:
	@zip CvGameCoreDLL.cbp.zip CvGameCoreDLL.cbp Makefile CvArea.cpp CvArea.h CvArtFileMgr.cpp (a whole bunch more files)


For this I should add CvRhyes.cpp CvRhyes.h after CvArea.h.

Code:
Debug/CvArea.obj: CvArea.cpp
	$(Debug_CPP) /nologo $(Debug_CFLAGS) $(Debug_INCS) /c CvArea.cpp /FoDebug/CvArea.obj

Code:
Final_Release/CvArea.obj: CvArea.cpp
	$(Final_Release_CPP) /nologo $(Final_Release_CFLAGS) $(Final_Release_INCS) /c CvArea.cpp /FoFinal_Release/CvArea.obj

For these two I should just duplicate the lines but replace CvArea with CvRhyes.

Is that all correct? Common sense tells me so, but I want to make absolutely sure, since I'm a complete novice at this. :D
 
Nope.

Code:
1>------ Build started: Project: CvGameCoreDLL, Configuration: Debug Win32 ------
1>Performing Makefile project actions
1>Microsoft (R) Program Maintenance Utility Version 8.00.50727.42
1>Copyright (C) Microsoft Corporation.  All rights reserved.
1> "C:/Program Files/Microsoft Visual C++ Toolkit 2003/bin/cl.exe" /nologo  /MD /GR /Od /W3 /EHsc /DWIN32 /D_DEBUG /D_WINDOWS /D_USRDLL /DCVGAMECOREDLL_EXPORTS /nologo /Zi /Gd /TP   /IBoost-1.32.0/include /IPython24/include /I"C:/Program Files/Microsoft Visual C++ Toolkit 2003/include" /I"C:/Program Files/Microsoft SDKs/Windows/v6.0A/Include" /c CvArea.cpp /FoDebug/CvArea.obj
1>CvArea.cpp
1>c:\Users\Household\Desktop\New Folder\CvGameCoreDLL\CvGameCoreDLL.h(17) : fatal error C1083: Cannot open include file: 'windows.h': No such file or directory
1>NMAKE : fatal error U1077: '"C:/Program Files/Microsoft Visual C++ Toolkit 2003/bin/cl.exe"' : return code '0x2'
1>Stop.
1>Project : error PRJ0019: A tool returned an error code from "Performing Makefile project actions"
1>Build log was saved at "file://c:\Users\Household\Desktop\New Folder\CvGameCoreDLL\Debug\BuildLog.htm"
1>CvGameCoreDLL - 3 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

Here's my makefile. Besides the above edits, I only took out the "x86" that somebody had trouble with earlier since apparently that's for 64 bit systems only and I'm running 32 bit. I tried with the x86 anyways and it didn't work.
 

Attachments

Before you try to compile your modified RFC SDK, get the normal SDK compiling. Take Refar's makefile, set it up for your environment, and compile the unmodified BTS SDK files. Once you work out those kinks, apply that knowledge to your modified files.

You have not set up the paths to the Windows PSDK files correctly:

Code:
1>c:\Users\Household\Desktop\New Folder\CvGameCoreDLL\CvGameCoreDLL.h(17) : 
    fatal error C1083: 
    [B]Cannot open include file: '[COLOR="Red"]windows.h[/COLOR]': No such file or directory[/B]
 
Before you try to compile your modified RFC SDK, get the normal SDK compiling. Take Refar's makefile, set it up for your environment, and compile the unmodified BTS SDK files. Once you work out those kinks, apply that knowledge to your modified files.

You have not set up the paths to the Windows PSDK files correctly:

Code:
1>c:\Users\Household\Desktop\New Folder\CvGameCoreDLL\CvGameCoreDLL.h(17) : 
    fatal error C1083: 
    [B]Cannot open include file: '[COLOR="Red"]windows.h[/COLOR]': No such file or directory[/B]

Refar's guide told me only the change the first PSDK file line, which I changed to where I installed Platform SDK. So I don't know what's wrong. Or do I have to link to the lib subfolder?

/Off to compile
 
Refar's guide told me only the change the first PSDK file line, which I changed to where I installed Platform SDK. So I don't know what's wrong. Or do I have to link to the lib subfolder?

/Off to compile

Ok, found the error. The old makefile, which what both Chazcon's and Refar's guide works off of, has only one line each for the Toolkit/PSDK, thus they only tell you to edit one line. However, glider's makefile has two lines each for the Toolkit/PSDK. I had only edited the first line.

Gosh do I feel idiotic. :lol:

RFC is compiling right now. Thanks for all the help EmperorFool. I wouldn't have been able to change two measly numbers without you.

Edit: Tried to rep you, but apparently the admins here didn't implement it into the board. Here's a +1 to you anyways.
 
Ok, found the error. The old makefile, which what both Chazcon's and Refar's guide works off of, has only one line each for the Toolkit/PSDK, thus they only tell you to edit one line. However, glider's makefile has two lines each for the Toolkit/PSDK. I had only edited the first line.

Gosh do I feel idiotic. :lol:

RFC is compiling right now. Thanks for all the help EmperorFool. I wouldn't have been able to change two measly numbers without you.

Edit: Tried to rep you, but apparently the admins here didn't implement it into the board. Here's a +1 to you anyways.

Spoke too soon. At the end of compilation, another error:

Code:
1>   Creating library Debug\CvGameCoreDLL.lib and object Debug\CvGameCoreDLL.exp
1>The system cannot find the path specified.
1>        0 file(s) copied.

Is that determined by the "#YOURMOD" part of the makefile?

I get the same message when I try to compile either the normal SDK or the modified RFC SDK.
 
This is only failing when trying to copy the completed DLL to your BTS folder. Search for "cp" or "copy" and fix the path. But you have a built DLL and can manually copy it from the Final_Release folder to your mod folder. Yay! :goodjob:
 
This is only failing when trying to copy the completed DLL to your BTS folder. Search for "cp" or "copy" and fix the path. But you have a built DLL and can manually copy it from the Final_Release folder to your mod folder. Yay! :goodjob:

The weird thing was it didn't create a Final_Release folder. But all the stuff is there, so I'm happy. :D
 
So I was able to compile, but my changes to CvTeamAI aren't taking.

This is the original code:

Code:
/*//Rhye - start (5 vassals cap if already the strongest; 6 vas+all cap)	
	int mastersVassals = 0;
	int mastersAllies = 0;
	int mastersPower = kMasterTeam.getPower(true);
	bool bStrongest = true;
	for (int iLoopTeam = 0; iLoopTeam < NUM_MAJOR_PLAYERS; iLoopTeam++)
	{
		CvTeam& kLoopTeam = GET_TEAM((TeamTypes)iLoopTeam);
		if (kLoopTeam.isAlive() && kLoopTeam.isVassal(eTeam) && iLoopTeam != getID())
			mastersVassals++;
		if (kLoopTeam.isAlive() && kLoopTeam.isDefensivePact((TeamTypes)eTeam) && iLoopTeam != getID())
			mastersAllies++;
		if (kLoopTeam.getPower(true) > mastersPower)
			bStrongest = false;
	}

	if (mastersVassals >= 5 && bStrongest)
		return DENIAL_POWER_YOU;	
	if (mastersVassals + mastersAllies >= 5)
		return DENIAL_POWER_YOU;	
	//Rhye - end*/

I want to eliminate the vassal cap, so I changed the two 5's at the bottom (but not the 5 at the top) to 27 in Notepad++, saved, replaced the file, then compiled. However, in-game the limit is still in place. I know this because Mansa and William both wanted to be my vassal when I only had 4, but once I vassaled Mansa William's "Become a vassal state" option was red with "You've grown too powerful for us." This happened even if I switched Mansa and William.

The only other time DENIAL_POWER_YOU shows up when the AI decides to peace-vassal is if by accepting the vassal I gain a domination win. Relevant code here:

Code:
if (GC.getGameINLINE().getAdjustedPopulationPercent((VictoryTypes)i) > 0 || GC.getGameINLINE().getAdjustedLandPercent((VictoryTypes)i) > 0)
			{
				if (bLandThreat && bPopulationThreat)
				{
					return DENIAL_POWER_YOU;
				}
			}

so in the game I referred to above I disabled domination when I started it.

I don't know what I'm doing wrong.

So frustrating.
 
I see two options: add logging messages so you can verify that your code is being used, or run a debug build and set a breakpoint there.
 
I see two options: add logging messages so you can verify that your code is being used, or run a debug build and set a breakpoint there.

How would logging message work? Would I have to change the vassal limit to a lower number since the code isn't supposed to activate unless a 27th nation wants to vassal to me?

For the debug option, Refar's guide has a good walkthrough, but would I have to restart a new game or could I use my savefile? Plus, it doesn't explain how to set a breakpoint.

Would deleting the whole section of code work? It was inserted by Rhye to create a vassal limit and I'm pretty sure it doesn't exist in regular Civ IV.
 
How would logging message work?

Check out logMsg() in CvBugOptions.cpp for how to write to your own log file in the My Games / BTS / Logs folder.

Would I have to restart a new game?

Nope, you can load your saved game as normal.

Plus, it doesn't explain how to set a breakpoint.

You'll need an IDE such as Visual Studio to do the debugging. In it you open the file where you want execution to pause, go to the line, and click in the margin (maybe double-click). You can also right-click and select Toggle Breakpoint I believe.

Would deleting the whole section of code work? It was inserted by Rhye to create a vassal limit and I'm pretty sure it doesn't exist in regular Civ IV.

Without knowing that code, I can only guess yes. You can compare it to the original BTS sources to find out. If all the code does is perform some logic checks and optionally say "no, you can't do this", then removing it entirely should work.
 
You'll need an IDE such as Visual Studio to do the debugging. In it you open the file where you want execution to pause, go to the line, and click in the margin (maybe double-click). You can also right-click and select Toggle Breakpoint I believe.

IDE's cost money, no? Regardless, I pm'ed Rhye to see if I can delete it, if not, then I'll try the logging thing.

Thanks again.
 
Could I start a new game now, then when Rhye replies to me I edit the file/recompile/replace file, and the elimination of the vassal limit would be in effect for my savefile, or would that not work? It seems logical that it would.
 
Back
Top Bottom