Kailric
Jack of All Trades
I have searched all over to find out what this does or is. I see it used a lot in the SDK. Looks like some kind of debugging code?
it is used to launch a pop up with the message with a compiled debug version of the dll . However to get it work you need a debug exe ( not provided ) . i've tried with a final debug version and get a ctd in 1/2 message .
Perhaps a skilled programmer know a way to use them .
Tcho !
I am using VS 2003 to write and debug the SDK.
What is the procedure to enable FAssertMsg text?
FAssertMsg(false, "This is a test!");
Interesting, I have been doing this for a few years, and have had crashes while play-testing while debug is enabled, i.e. with a debug build, monitoring the Civ4 process etc., and have never seen these messages.
Interesting, I have been doing this for a few years, and have had crashes while play-testing while debug is enabled, i.e. with a debug build, monitoring the Civ4 process etc., and have never seen these messages.
At a minimum, you must get a popup when the game first loads which says "DLL enabled", or something close to that, correct? If not, then I don't think you are actually getting a debug DLL linked up.
The mod I am working on currently, Dune Wars, is built on top of RevDCM, and I get about a dozen assert dialogs like this at the end of each turn. The *goal* of asserts is that an assert should be triggered just before any crash. But, it takes an awful lot of programming to ensure that. The asserts in the civ sdk mostly come when range checking array access. If an array has valid values from 0 ... N, and an access function takes an int to index the array, it uses FAssertMsg to complain if the int is less than 0 or greater than N. As pointed out above, you can easily make lots of programming errors without related asserts. (Not you personally, of course, but I do all the time )
You can link the Debug DLL without any announcement Popup. I have never seen one, and I use debug builds VERY frequently.
You can easily get a ton of crashes without every seeing an Assert message if the crash is in the code you wrote, and you didn't add any assert messages. They are kinda the "Sticky Note" for a programmer to slip into his work where he didn't make it ROCK SOLID unable to crash, but was relatively certain that all the code elsewhere was written to not use it improperly. So he leaves a little note saying what improper use would be so that when he runs a debug build it will check certain facts for him automatically.
If you find that you don't say "Oh crap! I have to go fix that!" after seeing an Assert message, that is a sign that you either don't understand what that message is there for, or that it is no longer important and you ought to remove it to save yourself the bother of clicking to Ignore.
EDIT: Ah, good thing Afforess pre-posted me Odd thing to add, but apparently the main programmer of BULL liked confirmation. Though if you launch Civ from VS then VS itself gives you the confirmation in the Output window.
Why do I rarely run a debug build? Habit. In my day job I write server software that needs to have extensive logging code throughout that we leave in the code. It is easily disabled by setting the logging level, so we don't take it out. I created the same mechanism in Python via BugUtil.debug()/info()/warn()/error()/fatal(). In the SDK I have been removing my temporary logging only because I don't feel like writing a robust configurable logging system in C++.
I do, however, put asserts into the CvCity functions that provide the "building actual effects" values, ensuring you pass in a valid building/yield/commerce type etc.
So you did get a job? Glad to hear it!
By the way, when you say "Day Job", does that mean you have a "Night Job" too? Mild mannered programmer by day, superhero by night kinda deal?
Or when I forget to add my latest modifiers into the actual effects, and the values mismatch...
void CvCity::processBuilding(...)
{
int aiYields[NUM_YIELDS];
for (int i = 0; i < NUM_YIELDS; i++)
{
aiYields[i] = getYieldRate((YieldTypes)i) + getAdditionalYieldByBuilding(eBuilding, (YieldTypes)i);
}
...
for (int i = 0; i < NUM_YIELDS; i++)
{
FAssertMsg(aiYields[i] == getYieldRate((YieldTypes)i), "new yield mismatches expected value");
}
}