Question about CvEnum.h files...

LoneTraveller

Warlord
Joined
Apr 30, 2008
Messages
283
Location
Montreal, Quebec
Hi there,

I'm joining "Merged Mod" with Asio's WW2 mod and i'm having problems with enums that are of the following sort :

Spoiler :

#ifdef _USRDLL
NUM_INTERFACEMODE_TYPES
#endif


I can't find what activates the "_USRDLL" and having never played with #ifdef I'm a little confused on how it works.

Can anyone enlighted me a little ?

Thank you for your time
 
_USRDLL is called a preprocessor flag because it is used to tell the C preprocessor what to do. Let me back up a step.

When you compile the SDK's C++ code into a DLL, it goes through a four-step process:

  1. C preprocessor can modify the C++ (see below)
  2. The C++ compiler compiles .cpp files into .obj (object) files
  3. The linker links .obj files into a single .lib (library)
  4. The linker produces a .dll from the .lib
There are other minor steps (assembler) in there, but the first three are the important ones. You can think of 3 and 4 as a single step that produces two output files if you like.

The first step, the C preprocessor, uses preprocessor directives like "#ifdef" and "#define" to modify the C/C++ code before it goes to the compiler. These constructs work much like C's "if (...)" runtime construct except they operate on the source code itself rather than on the data the program is using.

"#ifdef" (pronounced pound-if-def, short for "if X is defined") allows you to control whether or not a block of code is included in the final code to be compiled based on a flag. These flags can be defined in source code directly using "#define",

Code:
#define _USRDLL

or they can be defined in the "cpp" command-line using the /D switch:

Code:
cpp /D_USRDLL file.c

The latter method is used for _USRDLL in the makefile. If _USRDLL is not defined, the preprocessor removes all code between "#ifdef" and its matching "#endif". These matching directives work just like C's matching braces { and }.

You may be asking, "Why would you want the code guarded by _USRDLL to be removed?" Good question; I don't have an answer. For some reason, Firaxis needed to use these source files in a context where that code would break something.

As to your first question, I don't really understand it. What "problems" are you having with them? If you are getting compilation errors, it would help significantly to post them. If not, please describe what is breaking, what bad behavior your seeing, or whatever may help us help you.

That code you posted looks fine. Just make sure it's the last value defined in the enum. If both mods added new values to the same enum, make sure they all go a) after the original BTS values and b) before the NUM_XXX_TYPES value.
 
There are no compilation errors. All errors are runtime errors. Here is an example of problems I'm encountering but I don't understand the context of it.


1 of the variables that is not assigned any value in the project is NUM_INTERFACEMODE_TYPES which is located in the CvEnum.h file in between #ifdef and #endif tags.

After opening the dump file with "Debug Diagnostic Tool GUI" I have found that the problem was located in the CvXMLLoadUtilitySet.cpp file in the SetGlobalActionInfo() function. I then wrote fprintf command through out the function and identified the location of the error.

piPriorityList[iTotalActionInfoCount] = GC.getInterfaceModeInfo((InterfaceModeTypes)i).getOrderPriority();

This line is contained inside a "for loop" that begins at 0 and ends at NUM_INTERFACEMODE_TYPES.

I have narrowed the error to happen when the array hits 19 when the actual value of NUM_INTERFACEMODE_TYPES is 27. The length of the array piPriorityList is 742 according to it's declaration "int* piIndexList = new int[iNumActionInfos];"

I bypassed the error by modifying the range of the loop to a fixed value but I find this to be unpractical when/if NUM_INTERFACEMODE_TYPES changes value in future modification of the mod.

I would like to know where NUM_INTERFACEMODE_TYPES value is loaded from so I could modify it to be dependant on the usual parameters. But I do not know what those parameters are or where to find them.

--------

Also I have encountered another error with which I don't know to locate the problem. The dump file states that the problem comes from the following lines but I can't find "initCvPythonExtensions" anywhere using Windows "search for text inside all files" program.


Thread 0 - System ID 5132

Function Arg 1 Arg 2 Arg 3 Source
Civ4BeyondSword+206e8b ffffffff 00606b4a 43bf4fc0
Civ4BeyondSword!initCvPythonExtensions+36491b ffffffff 00473fe3 021f0560
Civ4BeyondSword!initCvPythonExtensions+364946 208eb2d8 7c802446 021f0560
Civ4BeyondSword+75098 208eb2d8 7c802446 021f6ae0
Civ4BeyondSword+131528 00be3201 01987120 019871b4
Civ4BeyondSword+12d7c 01987120 7c80b741 0016233f
Civ4BeyondSword+882d 01987120 00400000 0016233f
Civ4BeyondSword+d6f35 80000001 00fad0c0 7ffdf000
kernel32!BaseProcessStart+23 7c817080 00000000 00000000
kernel32!_SEH_epilog+18 00000000 00000000 008f47fa

Is there a way to locate the problem with better accuracy ?


Thank you for your time
 
initCvPythonExtensions is most likely in the EXE since it's definitely not in Python nor the SDK. My guess is that you need to do a clean build: delete all of the .obj files and compile again.

Whenever you modify a header (.h) file, all files that depend on that file must be recompiled. The makefile is not complete as it only has immediate dependencies for files with the same name. For example, CvArea.cpp depends on CvArea.h (it should), but it doesn't have any dependencies for any other header files it #includes (also immediate). On top of that, it doesn't have any header files #included by other header files it #includes (transitive).

This results in some files thinking NUM_INTERFACEMODE_TYPES is 19 while others think it's 27.
 
Thanks for the answer but even if I delete the .obj files and recompile, I still get the same runtime error...I'm not sure what to do now.
 
what results do you get if you search for NUM_INTERFACEMODE_TYPES?
It should be defined in CvEnums.h and not modified somewhere else.
 
what results do you get if you search for NUM_INTERFACEMODE_TYPES?
It should be defined in CvEnums.h and not modified somewhere else.

It is present in CvEnum.h in the section "enum InterfaceModeTypes" located as such :
#ifdef _USRDLL
NUM_INTERFACEMODE_TYPES
#endif

The other files it is present in (but only used, not assigned a value) are CvXMLLoadUtilisySet.cpp, CvGlobals.h (but it's commented), CvGlobal.cpp (used in an FAssert (what are does anyways ?) and CyEnumsInterface.cpp (but that one is for exposure to Python).

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

Honestly, since I have managed to bypass this problem I'm more concerned with the new problem that come up.

I get runtime errors after I have selected all the parameter for launching a scenario. The stack of errors looks very similar to the one previously mentionned :

Function Arg 1 Arg 2 Arg 3 Source
kernel32!RaiseException+53 e06d7363 00000001 00000003
msvcr71!_CxxThrowException+34 0013f8d8 7c3d8230 f93b96e0
msvcp71!std::_Nomemory+61 00000001 00463dd1 f93b96e0
Civ4BeyondSword!initCvPythonExtensions+22a208 f93b96e0 439a3df0 00ffe8ef
Civ4BeyondSword+63dd1 fa3b7fce 0000002f 008f022f
Civ4BeyondSword+206ecd ffffffff 00606b4a 43516880
Civ4BeyondSword!initCvPythonExtensions+36491b ffffffff 00473fe3 021f0560
Civ4BeyondSword!initCvPythonExtensions+364946 433e3cf0 7c802446 021f0560
Civ4BeyondSword+75098 433e3cf0 7c802446 021f6ae0
Civ4BeyondSword+131528 00be3201 01987120 019871b4
Civ4BeyondSword+12d7c 01987120 7c80b741 0016233f
Civ4BeyondSword+882d 01987120 00400000 0016233f
Civ4BeyondSword+d6f35 80000001 00fad0c0 7ffd4000
kernel32!BaseProcessStart+23 7c817080 00000000 00000000
kernel32!_SEH_epilog+18 00000000 00000000 008f47fa

I have checked with winmerge if I was missing any python files and I also merged the necessary ones. I also verified the logs and deleted them between each try. I don't see any error messages in them.

Any help would be appreciated

Thank you
 
Code:
kernel32!RaiseException+53 e06d7363 00000001 00000003
msvcr71!_CxxThrowException+34 0013f8d8 7c3d8230 f93b96e0
msvcp71!std::_Nomemory+61 00000001 00463dd1 f93b96e0

This looks a lot like it's running out of memory and trying to raise an OutOfMemoryException. What system are you running on, and what specs does it have?

FAsserts are functions that check equations for validity. They are conditionally-compiled into the debug builds; they are cut out of Final_Release builds. They are good for sanity-checking code and expected values, like ePlayer != NO_PLAYER or 0 <= eBuilding < GC.getNumBuildingInfos().

Have you tried running a debug build?
 
My specs are the following :

Intel Duo 2.13 Ghz
4 gig ram 800 Mhz (Windows only sees 3gig)
Nvidia 9800GTX+ 512 mb ddr
Win XP Pro SP3
Asus P5B Deluxe
2 SATA 7200 rpm drives
SB X-Fi sound card
Viewsonic flatscreen
logitech mouse and keyboard

all my drivers are up to date and I have the onboard soundcard disactivated.

Have you tried running a debug build?

I have never done such a thing and I'm rather certain that I don't know how.

PS : Since I tried rise of mankind 2.81 my system has been less tolerant with my games. I usually play on huge maps but sometimes the game shuts down altogether (with no message relating to a dump file, like when I try to make my mod's mod work) after 30 or so turns on different Mods. Perharps it is related my problems maybe not. I just added this incase somebody else had this problem before.
 
Assuming you are using Visual Studio to do you compiling and you followed Refar's guide, you should have a dropdown menu in the toolbar with options to select the build profile: Final_Release or Debug. Select Debug and do a build (F7). This will create a DLL in a Debug subfolder which you can use instead of the one from the Final_Release folder.

Using the tutorial here you can attach VS to the game while it's running and step through the troubled code. Otherwise, you can just let it run normally, and you'll see any FAssert messages that fail.
 
Hi, EmperorFool!

Let me ask a question. You wrote

initCvPythonExtensions is most likely in the EXE since it's definitely not in Python nor the SDK. My guess is that you need to do a clean build: delete all of the .obj files and compile again.
Are you sure "it's definitely not in Python"?
I made a search "CvPythonExtensions" in Civ4Colonization and found 73 hits in 70 files. Here full list.

Spoiler :
E:\DataFiles\Games\CivIVCol\Original\1.01f\Assets\Assets\Python\CvAdvisorUtils.py (1 hits)
Line 7: from CvPythonExtensions import *
E:\DataFiles\Games\CivIVCol\Original\1.01f\Assets\Assets\Python\CvCameraControls.py (1 hits)
Line 6: from CvPythonExtensions import *
E:\DataFiles\Games\CivIVCol\Original\1.01f\Assets\Assets\Python\CvDebugTools.py (1 hits)
Line 8: from CvPythonExtensions import *
E:\DataFiles\Games\CivIVCol\Original\1.01f\Assets\Assets\Python\CvDefineEditor.py (1 hits)
Line 2: from CvPythonExtensions import *
E:\DataFiles\Games\CivIVCol\Original\1.01f\Assets\Assets\Python\CvDiplomacy.py (1 hits)
Line 3: from CvPythonExtensions import *
E:\DataFiles\Games\CivIVCol\Original\1.01f\Assets\Assets\Python\CvEventManager.py (1 hits)
Line 9: from CvPythonExtensions import *
E:\DataFiles\Games\CivIVCol\Original\1.01f\Assets\Assets\Python\CvGameUtils.py (1 hits)
Line 7: from CvPythonExtensions import *
E:\DataFiles\Games\CivIVCol\Original\1.01f\Assets\Assets\Python\CvMapGeneratorUtil.py (1 hits)
Line 3: from CvPythonExtensions import *
E:\DataFiles\Games\CivIVCol\Original\1.01f\Assets\Assets\Python\CvUtil.py (1 hits)
Line 13: from CvPythonExtensions import *
E:\DataFiles\Games\CivIVCol\Original\1.01f\Assets\Assets\Python\EntryPoints\CvAppInterface.py (4 hits)
Line 18: from CvPythonExtensions import *
Line 30: import CvPythonExtensions
Line 31: helpFile=file("CvPythonExtensions.hlp.txt", "w")
Line 34: pydoc.help(CvPythonExtensions)
E:\DataFiles\Games\CivIVCol\Original\1.01f\Assets\Assets\Python\EntryPoints\CvDiplomacyInterface.py (1 hits)
Line 3: from CvPythonExtensions import *
E:\DataFiles\Games\CivIVCol\Original\1.01f\Assets\Assets\Python\EntryPoints\CvEventInterface.py (1 hits)
Line 14: from CvPythonExtensions import *
E:\DataFiles\Games\CivIVCol\Original\1.01f\Assets\Assets\Python\EntryPoints\CvGameInterface.py (1 hits)
Line 16: from CvPythonExtensions import *
E:\DataFiles\Games\CivIVCol\Original\1.01f\Assets\Assets\Python\EntryPoints\CvGameInterfaceFile.py (1 hits)
Line 9: from CvPythonExtensions import *
E:\DataFiles\Games\CivIVCol\Original\1.01f\Assets\Assets\Python\EntryPoints\CvMapScriptInterface.py (1 hits)
Line 3: from CvPythonExtensions import *
E:\DataFiles\Games\CivIVCol\Original\1.01f\Assets\Assets\Python\EntryPoints\CvOptionsScreenCallbackInterface.py (1 hits)
Line 1: from CvPythonExtensions import *
E:\DataFiles\Games\CivIVCol\Original\1.01f\Assets\Assets\Python\EntryPoints\CvPopupInterface.py (1 hits)
Line 3: from CvPythonExtensions import *
E:\DataFiles\Games\CivIVCol\Original\1.01f\Assets\Assets\Python\EntryPoints\CvRandomEventInterface.py (1 hits)
Line 14: from CvPythonExtensions import *
E:\DataFiles\Games\CivIVCol\Original\1.01f\Assets\Assets\Python\EntryPoints\CvScreensInterface.py (1 hits)
Line 38: from CvPythonExtensions import *
E:\DataFiles\Games\CivIVCol\Original\1.01f\Assets\Assets\Python\EntryPoints\CvTranslator.py (1 hits)
Line 3: from CvPythonExtensions import *
E:\DataFiles\Games\CivIVCol\Original\1.01f\Assets\Assets\Python\EntryPoints\CvUnitControlInterface.py (1 hits)
Line 3: from CvPythonExtensions import *
E:\DataFiles\Games\CivIVCol\Original\1.01f\Assets\Assets\Python\EntryPoints\CvWBInterface.py (1 hits)
Line 3: from CvPythonExtensions import *
E:\DataFiles\Games\CivIVCol\Original\1.01f\Assets\Assets\Python\EntryPoints\PbMain.py (1 hits)
Line 7: from CvPythonExtensions import *
E:\DataFiles\Games\CivIVCol\Original\1.01f\Assets\Assets\Python\PitBoss\PbAdmin.py (1 hits)
Line 7: from CvPythonExtensions import *
E:\DataFiles\Games\CivIVCol\Original\1.01f\Assets\Assets\Python\PitBoss\PbWizard.py (1 hits)
Line 7: from CvPythonExtensions import *
E:\DataFiles\Games\CivIVCol\Original\1.01f\Assets\Assets\Python\pyHelper\Unit.py (1 hits)
Line 3: from CvPythonExtensions import *
E:\DataFiles\Games\CivIVCol\Original\1.01f\Assets\Assets\Python\pyHelper\UnitEntity.py (1 hits)
Line 3: from CvPythonExtensions import *
E:\DataFiles\Games\CivIVCol\Original\1.01f\Assets\Assets\Python\pyUnit\CvUnitController.py (1 hits)
Line 1: from CvPythonExtensions import *
E:\DataFiles\Games\CivIVCol\Original\1.01f\Assets\Assets\Python\pyWB\CvWBDesc.py (1 hits)
Line 8: from CvPythonExtensions import *
E:\DataFiles\Games\CivIVCol\Original\1.01f\Assets\Assets\Python\pyWB\CvWBPopups.py (1 hits)
Line 3: from CvPythonExtensions import *
E:\DataFiles\Games\CivIVCol\Original\1.01f\Assets\Assets\Python\Screens\CvAdvisorScreen.py (1 hits)
Line 6: from CvPythonExtensions import *
E:\DataFiles\Games\CivIVCol\Original\1.01f\Assets\Assets\Python\Screens\CvCongressAdvisor.py (1 hits)
Line 4: from CvPythonExtensions import *
E:\DataFiles\Games\CivIVCol\Original\1.01f\Assets\Assets\Python\Screens\CvDawnOfMan.py (1 hits)
Line 5: from CvPythonExtensions import *
E:\DataFiles\Games\CivIVCol\Original\1.01f\Assets\Assets\Python\Screens\CvDomesticAdvisor.py (1 hits)
Line 3: from CvPythonExtensions import *
E:\DataFiles\Games\CivIVCol\Original\1.01f\Assets\Assets\Python\Screens\CvEuropeScreen.py (1 hits)
Line 3: from CvPythonExtensions import *
E:\DataFiles\Games\CivIVCol\Original\1.01f\Assets\Assets\Python\Screens\CvForeignAdvisor.py (1 hits)
Line 3: from CvPythonExtensions import *
E:\DataFiles\Games\CivIVCol\Original\1.01f\Assets\Assets\Python\Screens\CvFoundingFatherScreen.py (1 hits)
Line 3: from CvPythonExtensions import *
E:\DataFiles\Games\CivIVCol\Original\1.01f\Assets\Assets\Python\Screens\CvGFCScreen.py (1 hits)
Line 4: from CvPythonExtensions import *
E:\DataFiles\Games\CivIVCol\Original\1.01f\Assets\Assets\Python\Screens\CvHallOfFameScreen.py (1 hits)
Line 3: from CvPythonExtensions import *
E:\DataFiles\Games\CivIVCol\Original\1.01f\Assets\Assets\Python\Screens\CvInfoScreen.py (1 hits)
Line 6: from CvPythonExtensions import *
E:\DataFiles\Games\CivIVCol\Original\1.01f\Assets\Assets\Python\Screens\CvIntroMovieScreen.py (1 hits)
Line 3: from CvPythonExtensions import *
E:\DataFiles\Games\CivIVCol\Original\1.01f\Assets\Assets\Python\Screens\CvMainInterface.py (1 hits)
Line 3: from CvPythonExtensions import *
E:\DataFiles\Games\CivIVCol\Original\1.01f\Assets\Assets\Python\Screens\CvMilitaryAdvisor.py (1 hits)
Line 5: from CvPythonExtensions import *
E:\DataFiles\Games\CivIVCol\Original\1.01f\Assets\Assets\Python\Screens\CvOptionsScreen.py (1 hits)
Line 7: from CvPythonExtensions import *
E:\DataFiles\Games\CivIVCol\Original\1.01f\Assets\Assets\Python\Screens\CvPediaBonus.py (1 hits)
Line 3: from CvPythonExtensions import *
E:\DataFiles\Games\CivIVCol\Original\1.01f\Assets\Assets\Python\Screens\CvPediaBuilding.py (1 hits)
Line 3: from CvPythonExtensions import *
E:\DataFiles\Games\CivIVCol\Original\1.01f\Assets\Assets\Python\Screens\CvPediaCivic.py (1 hits)
Line 3: from CvPythonExtensions import *
E:\DataFiles\Games\CivIVCol\Original\1.01f\Assets\Assets\Python\Screens\CvPediaCivilization.py (1 hits)
Line 3: from CvPythonExtensions import *
E:\DataFiles\Games\CivIVCol\Original\1.01f\Assets\Assets\Python\Screens\CvPediaFather.py (1 hits)
Line 8: from CvPythonExtensions import *
E:\DataFiles\Games\CivIVCol\Original\1.01f\Assets\Assets\Python\Screens\CvPediaFeature.py (1 hits)
Line 3: from CvPythonExtensions import *
E:\DataFiles\Games\CivIVCol\Original\1.01f\Assets\Assets\Python\Screens\CvPediaHistory.py (1 hits)
Line 3: from CvPythonExtensions import *
E:\DataFiles\Games\CivIVCol\Original\1.01f\Assets\Assets\Python\Screens\CvPediaImprovement.py (1 hits)
Line 3: from CvPythonExtensions import *
E:\DataFiles\Games\CivIVCol\Original\1.01f\Assets\Assets\Python\Screens\CvPediaLeader.py (1 hits)
Line 5: from CvPythonExtensions import *
E:\DataFiles\Games\CivIVCol\Original\1.01f\Assets\Assets\Python\Screens\CvPediaMain.py (1 hits)
Line 3: from CvPythonExtensions import *
E:\DataFiles\Games\CivIVCol\Original\1.01f\Assets\Assets\Python\Screens\CvPediaProfession.py (1 hits)
Line 5: from CvPythonExtensions import *
E:\DataFiles\Games\CivIVCol\Original\1.01f\Assets\Assets\Python\Screens\CvPediaPromotion.py (1 hits)
Line 3: from CvPythonExtensions import *
E:\DataFiles\Games\CivIVCol\Original\1.01f\Assets\Assets\Python\Screens\CvPediaScreen.py (1 hits)
Line 8: from CvPythonExtensions import *
E:\DataFiles\Games\CivIVCol\Original\1.01f\Assets\Assets\Python\Screens\CvPediaTerrain.py (1 hits)
Line 3: from CvPythonExtensions import *
E:\DataFiles\Games\CivIVCol\Original\1.01f\Assets\Assets\Python\Screens\CvPediaUnit.py (1 hits)
Line 3: from CvPythonExtensions import *
E:\DataFiles\Games\CivIVCol\Original\1.01f\Assets\Assets\Python\Screens\CvPediaYields.py (1 hits)
Line 3: from CvPythonExtensions import *
E:\DataFiles\Games\CivIVCol\Original\1.01f\Assets\Assets\Python\Screens\CvReplayScreen.py (1 hits)
Line 3: from CvPythonExtensions import *
E:\DataFiles\Games\CivIVCol\Original\1.01f\Assets\Assets\Python\Screens\CvRevolutionAdvisor.py (1 hits)
Line 4: from CvPythonExtensions import *
E:\DataFiles\Games\CivIVCol\Original\1.01f\Assets\Assets\Python\Screens\CvScreen.py (1 hits)
Line 6: from CvPythonExtensions import *
E:\DataFiles\Games\CivIVCol\Original\1.01f\Assets\Assets\Python\Screens\CvScreenEnums.py (1 hits)
Line 6: from CvPythonExtensions import CivilopediaPageTypes
E:\DataFiles\Games\CivIVCol\Original\1.01f\Assets\Assets\Python\Screens\CvVictoryMovieScreen.py (1 hits)
Line 3: from CvPythonExtensions import *
E:\DataFiles\Games\CivIVCol\Original\1.01f\Assets\Assets\Python\Screens\CvVictoryScreen.py (1 hits)
Line 3: from CvPythonExtensions import *
E:\DataFiles\Games\CivIVCol\Original\1.01f\Assets\Assets\Python\Screens\CvWonderMovieScreen.py (1 hits)
Line 3: from CvPythonExtensions import *
E:\DataFiles\Games\CivIVCol\Original\1.01f\Assets\Assets\Python\Screens\CvWorldBuilderDiplomacyScreen.py (1 hits)
Line 6: from CvPythonExtensions import *
E:\DataFiles\Games\CivIVCol\Original\1.01f\Assets\Assets\Python\Screens\CvWorldBuilderScreen.py (1 hits)
Line 3: from CvPythonExtensions import *
E:\DataFiles\Games\CivIVCol\Original\1.01f\Assets\Assets\Python\Screens\IconGrid.py (1 hits)
Line 2: from CvPythonExtensions import *

I guess the same situation in Civilization 4, too.

My question is how to find the reason of "initCvPythonExtensions" error?

My guess is that you need to do a clean build: delete all of the .obj files and compile again.
This way doesn't help and the same error accidently appears. I can load and play my mod, however sometimes this error takes place and I'm very interesting to find the reason and fix it.

Thank you in advance.
 
CvPythonExtensions is the Python psudeo-module that the EXE and SDK use to expose some of their objects and functions to the Python layer. This is done using a free library called Boost. You can see part of this in the SDK: all of the CyXXX objects are wrappers around their CvXXX counterparts, e.g. CyPlayer and CvPlayer.

The SDK's part of the CvPythonExtensions interface is initialized by CvDLLPython.cpp. My guess is that the EXE's part (all of the graphics and UI-related classes and functions) is initialized by that initCvPythonExtensions function you see.
 
The SDK's part of the CvPythonExtensions interface is initialized by CvDLLPython.cpp. My guess is that the EXE's part (all of the graphics and UI-related classes and functions) is initialized by that initCvPythonExtensions function you see.
Thank you, EmperorFool, for your very useful comments. :goodjob:

I found "initCvPythonExtensions" error exactly in graphics in one of my improvements (Tea_Plantation in CIV4ArtDefines_Improvements.xml).
 
Assuming you are using Visual Studio to do you compiling and you followed Refar's guide, you should have a dropdown menu in the toolbar with options to select the build profile: Final_Release or Debug. Select Debug and do a build (F7). This will create a DLL in a Debug subfolder which you can use instead of the one from the Final_Release folder.

Using the tutorial here you can attach VS to the game while it's running and step through the troubled code. Otherwise, you can just let it run normally, and you'll see any FAssert messages that fail.

I have attached the process to VS but when I reach the error the program states that it's an unhandled error exception in the Civ4BeyondSword.exe : std::bad_alloc at memory location...

In the "Call stack" window I see the following calls : 2* kernel32.dll!"hexadecimal", 2* msvcr71.dll!"hexadecimal" and the rest are Civ4BeyondSword.exe!"hexadecimal". I don't see a Civ4BeyondSword.exe!"withATruncableFunctionNameHere"

I used the instructions written here from the post of Gerikes :

http://forums.civfanatics.com/showthread.php?t=176199&highlight=attach+visual+studio

PS : I successfully compiled the Debug DLL and I when I started the mod I did get a message saying "dll attached"

What should I do ?
 
That message is a bit misleading. It is letting you know that you can attach VS to the process now. If you've set up VS to launch BTS, it will attach automatically, but if not you need to do it inside VS manually.

One thing I'd recommend at this point with nothing else to go on is to limit the changes you're testing. Don't add 5 new units and a new DLL all at once. Add one unit and test it. Add a DLL feature and test it. Maybe you've been doing this? I dunno.

That it's crashing inside the EXE makes me think it's art-related. The EXE handles all of the graphics and UI drawing. I haven't done any art myself, so I am unfamiliar with what kinds of problems there are or how they show up. All I've seen is "unidentifiable C++ exception" coming from the CvInfoBase::getButton() call. That tells me a button is specified incorrectly. Beyond that :confused:
 
That it's crashing inside the EXE makes me think it's art-related. The EXE handles all of the graphics and UI drawing. I haven't done any art myself, so I am unfamiliar with what kinds of problems there are or how they show up. All I've seen is "unidentifiable C++ exception" coming from the CvInfoBase::getButton() call. That tells me a button is specified incorrectly. Beyond that :confused:

Art related would make sense since everytime I try the mod itself I get alot of bright fluorescent pink units and icons.
 
Top Bottom