RevolutionDCM for BTS

Ok, rare it is then. Will look at it as soon as I set up yet another project and compiled all of it >_<

As for the setIsMinorCiv issue, do you get see something similar when you debug?
Not hard to see where it comes from and without logging cflag it should simply work.
 
I'm not that experienced with the debugger, and just added your suggested code from the previous post. You're right though, without the check to make sure the civ is alive, this error is going to occur. Do you want me to remove that check in CvTeam::makePeace, set a breakpoint in setIsMinorCiv and check the callstack?
 
Ok, rare it is then. Will look at it as soon as I set up yet another project and compiled all of it >_<

Yeah, used to be such a PITA, my computer would take 2 and a half hours (litterally) to compile a dll from scratch. That new make file kicks ass though. It finishes compiling the whole RevDCM dll in about 20 minutes, it must blaze by on newer computers.
 
Wol't hurt to add those though, I will have a look through CvTeam and add any isAlive() checks that seem necessary. I have removed Afforess's symptom fix and implemented your fix, and it checks out, so you seem to have fixed the root cause :goodjob:
 
Yes mamba, it should not happen, we all agree. Too bad it still does.

I am saying that given the description by phungus it cannot happen. If 2) and 3) are true, 1) cannot be true as well (the only way it still can to me is if you have some type conflicts, as I suggested). That is should not happen makes it a bug ;)
 
you seem to have fixed the root cause :goodjob:
Actually I think I fixed a symptom. The cause is declaring war and making peace with dead teams, that's a unique behavior of minor civs. Not sure if it's faulty by design, but at least it's unique.

tortoisesvn still downloading lor update, I'll continue this tomorrow.
 
Yeah, minor civs need to do that with RevDCM so that newly spawned civs are at war with minors without causing other diplo problems, and also fixes this gameoption in WBS files.

Trying to replicate the getCiv bug, I've ran into another crash, division by 0, this function:

int CvPlayerAI::AI_civicValue(CivicTypes eCivic, bool bCivicOptionVacuum, bool bCompleteVacuum, CivicTypes* paeSelectedCivics) const

This line of code:

iValue += (getNumCities() * 3 * iHappyValue) / (25 * iCount);

I could use straight up algebra (ensure iCount is not < 0) but I know there is some other method you guys have been using with max(something or other), forgot how that code is written.
 
iCount should always be > 0 if the civ has a city. But I guess that isn't always the case, and there was code to handle it even in the original code.

Code:
		[COLOR="Green"]//return (0 == iCount) ? 50 * iHappy : iHappyValue / iCount;[/COLOR]

		if (iCount <= 0)
		{
			[COLOR="Green"]//iValue += (getNumCities() * 12 * 50 * iHappy) / 100; //always 0 because 0 cities[/COLOR]
		}
		else
		{
			[COLOR="Green"]//iValue += (getNumCities() * 12 * iHappyValue) / (100 * iCount);[/COLOR]
			[COLOR="Green"]// line below is equal to line above[/COLOR]
			iValue += (getNumCities() * 3 * iHappyValue) / (25 * iCount);
		}
and
Code:
		[COLOR="Green"]//return (0 == iCount) ? 50*iHealth : iHealthValue / iCount;[/COLOR]

		if (iCount <= 0)
		{
			[COLOR="Green"]//iValue += (getNumCities() * 6 *50*iHealth) / 100; // always zero because 0 cities[/COLOR]
		}
		else
		{
			[COLOR="Green"]//iValue += (getNumCities() * 6 * iHealthValue) / (100 * iCount);[/COLOR]
			[COLOR="Green"]// line below is equal to line above[/COLOR]
			iValue += (getNumCities() * 3 * iHealthValue) / (50 * iCount);
		}
 
You must be mistaken ;)

CvUnit::canMoveInto has an issue but that's not one that causes crashes:
Undefended cities can not be conquered
I reverted to original code in Better BUG AI as recommended; RevDCM and LoR still have that problem though.

When loaded your savegame I did get any access violation but that had nothing to do with any settler or canMoveInto, it was just another logBBAI mistake.
in CvUnitAI::AI_lead() the bolded part was missing:
Code:
			if( gUnitLogLevel > 2 )
			{
				CvWString szString;
				getUnitAIString(szString, pBestUnit->AI_getUnitAIType());

				logBBAI("      Great general %d for %S chooses to lead %S with UNITAI %S", getID(), GET_PLAYER(getOwner()).getCivilizationDescription(0), pBestUnit->getName(0).GetCString(), szString[B].GetCString()[/B] );
			}
After I fix that, 1 round of AIAutoplay no longer causes any issues.
 
rev 544 had this listed in the log: Fixed Rogue Popups with AI Autoplay Enabled.

No - I was/am pretty sure I fixed the popups from appearing in AI Autoplay. You've updated to the latest version, right? Which popups are appearing, Barbarian Civ one's, or Revolution ones?
 
You must be mistaken ;)

CvUnit::canMoveInto has an issue but that's not one that causes crashes:
Undefended cities can not be conquered
I reverted to original code in Better BUG AI as recommended; RevDCM and LoR still have that problem though.

I have updated the better bug AI SVN on my comp but didn't see any revision to CvUnit, just CvPlayerAI.

When loaded your savegame I did get any access violation but that had nothing to do with any settler or canMoveInto, it was just another logBBAI mistake.
in CvUnitAI::AI_lead() the bolded part was missing:
Code:
			if( gUnitLogLevel > 2 )
			{
				CvWString szString;
				getUnitAIString(szString, pBestUnit->AI_getUnitAIType());

				logBBAI("      Great general %d for %S chooses to lead %S with UNITAI %S", getID(), GET_PLAYER(getOwner()).getCivilizationDescription(0), pBestUnit->getName(0).GetCString(), szString[B].GetCString()[/B] );
			}
After I fix that, 1 round of AIAutoplay no longer causes any issues.

How did you figure out it was a problem with logBBAI? Mine just crashed in CvUnit::canMoveInto as an access violation error. Thanks for figuring this out and fixing it, btw, but I'm wondering if I can't use your process to figure out what's going wrong with CvInitCore::getCiv. As with that access violation error and this one, all I get is a crash with no way to step anywhere to figure out what's going wrong.
 
Mine did not crash on CvUnit::canMoveInto ..
I was thinking the same; whatever you use to debug, you obviously don't get as much info as I do.
Spoiler :
For this one I had to use windowed mode because I couldn't alt-tab out of fullscreen LoR (it still worked for RevDCM) because the screeen was never redrawn and I had to navigate the taskmanager blindly (only by watching the mouse pointer change) to kill the process. A minor annoyance but I'm probably the only one doing debugging in fullscreen mode anyway :p.


I have updated the better bug AI SVN on my comp but didn't see any revision to CvUnit, just CvPlayerAI.
It's there: revision 99
 
Hmmm, are you sure that RevDCM doesn't have that fix then? I've merged in the latest Better Bug AI, and CvUnit::canMoveInto is the exact same as the Better Bug AI SVN.

As far as debugging goes I'm using MVS 2005 express. Also I can't seem to reproduce the crash with CvInitCore::getCiv, but I think it's still there. At least I can't get RevDCM to reproduce it, and did get it once in a LoR game recently but lost the save, and now I can't get either of them to do it... I feel strange wanting to have the game crash.
 
Last time I checked it didn't have it. And it's easy to overlook since it will look like any other additional code RevDCM has.

lines 2879ff:
Code:
			if (bAttack)
			{
/************************************************************************************************/
/* BETTER_BTS_AI_MOD                      02/21/10                                jdog5000      */
/*                                                                                              */
/* Efficiency                                                                                   */
/************************************************************************************************/
				// From Lead From Behind by UncutDragon
/* original code
				CvUnit* pDefender = pPlot->getBestDefender(NO_PLAYER, getOwnerINLINE(), this, true);
				if (NULL != pDefender)
				{
					if (!canAttack(*pDefender))
					{
						return false;
					}
				}
*/				// modified
				if (!pPlot->hasDefender(true, NO_PLAYER, getOwnerINLINE(), this, true))
						return false;
/************************************************************************************************/
/* BETTER_BTS_AI_MOD                       END                                                  */
/************************************************************************************************/
			}

edit:
As far as debugging goes I'm using MVS 2005 express. Also I can't seem to reproduce the crash with CvInitCore::getCiv, but I think it's still there. At least I can't get RevDCM to reproduce it, and did get it once in a LoR game recently but lost the save, and now I can't get either of them to do it... I feel strange wanting to have the game crash.
Who knows if it's really getCiv that's crashing ;) Just upload the savegame once you get another one.
I'm using Visual Studio .Net 2003 SP1, I compile my debug dll with /MDd and /NODEFAULTLIB:"msvcprtd.lib" (stanard Final_Debug setting from the vcproj file, only /MD had to be changed to /MDd), and for the debugging itself I copy dll, ilk and the 2 pdb files to Assets and start ..

So, what issues/errors/bugs are left to squish?
 
Thanks I somehow managed to put that fix in LoR, but forgot to port it over to RevDCM...
So, what issues/errors/bugs are left to squish?
Actually we've been cruising through these, thanks alot for the help :king:

On the todo list the following items are still outstanding, and these are the issues I think need to be resolved before I'd consider RevDCM to be stable. In it's current shape I think it's got all the features it needs to be what it should be, a very functional moding core base. Just some remaining bugs are the issue:

  • Accepting an empire wide revolt that causes a change of leadership for a specified amount of turns no longer causes the human to loose control of the civ with AI taking over with AI autoplay for the specified amount of turns.
    -I think this could be fixed pretty easily and was intending to work on it after I can reproduce the CvInitCore::getCiv crash. Basically I think the updated AIAutoplay code for MP that uses an array was never updated in the Revolution python, and just need to have this python function to fire the function that sets AIAutoplay as well (may need to expose this function to python, but that's trivial)
  • Fix the accept and Lead Rebels Revolution option, currently this isn't working (may be related to above error with switching leader)
  • Reproduce and fix cause of access violation error in CvInitCore::getCiv
  • Get boolean leader traits to be removed properly with the CvPlayer::clearTraitBonuses function (currently integer values are subtracted, which clears them properly, but booleans do not). The problem is this is a bit complex because some leader traits also can be applied to the player from civics and buildings, so just wiping them may cause unintended problems. Probably will be somewhat trivial to code, just been focused on other more pressing critical bugs

That looks like everything left that I am aware of. To be honest though most of those I feel like I can tackle, the recent bugs you've help fix were the ones that were bothering me simply cause I didn't know where to start, and of course the aforementioned crash I was getting is also something I don't understand (but need to reproduce it again at this point).
 
For python stuff I will not be able to help.
  • Get boolean leader traits to be removed properly with the CvPlayer::clearTraitBonuses function (currently integer values are subtracted, which clears them properly, but booleans do not). The problem is this is a bit complex because some leader traits also can be applied to the player from civics and buildings, so just wiping them may cause unintended problems. Probably will be somewhat trivial to code, just been focused on other more pressing critical bugs
boolean stuff .. NOT good. The Civ4 way to do this is to use a counter, like
Code:
bool CvPlayer::isNoForeignTrade() const
{
	return (getNoForeignTradeCount() > 0);
}
so when you remove the effect of one civic, you can simply reduce the counter by one. I see this is not how RevDCM did it. Not good.
 
Cool, I'll change that. That's certainly the smarter way to go, and I can go through the code and do that.

OK, I just remembered that change player wasn't working correctly, and this is another one where I'm completely lost. The errors you get are python exceptions about key Error, and seem to be caused by BUG somehow. I'm uploading a LoR save (also just updated the LoR SVN with your recent bug fixes), to see the bug, simply press ctrl + shift + L and change your player to the Germans.
 
Back
Top Bottom