Bug Reports and Discussion

I forgot to add several files. Try the current revision.

Thanks!

With the latest revision (r1539) I get the following error while compiling the DLL:

Code:
CvUnit.cpp
CvUnit.cpp(732) : error C2065: 'bHero' : undeclared identifier

After checking with annotate, it seems that the error is caused by new lines included in r1536.
 
[to_xp]Gekko;12672692 said:
my culture brought acheron's city to a revolt and he got bumped out of the city. not sure if it's intended but it would be nice if he lost held when that happens :D

OK. I'll see if I can finagle something along those lines.

[to_xp]Gekko;12674716 said:
there have been reports a while ago of some resources ( usually reagents ) not spawning when the blessings of amatheon gameoption is enabled.

Unable to replicate.

[to_xp]Gekko;12674995 said:
a couple things still to fix in the latest rvn:

godking info popup says "commerce" instead of "gold"

Rally worldspell spawns demagogs from enclaves

[to_xp]Gekko;12688339 said:
River of Blood worldspell doesn't work on size 2 cities

These should all be fixed now.


The Stigmata promo does not seem to grant the respective strenght bonus right now.

Just looking at the code everything seems fine. How can you tell its not working?

[to_xp]Gekko;12694276 said:
lizardman druid ( clan druid UU ) doesn't get entangle.

Entered as a bug though I will probably leave it as-is since I dont see an easy solution.


[to_xp]Gekko;12702271 said:
when you get attacked by HN units, the text in the upper part of the screen still tells you "your forces are under attack by ... " , telling you the nationality of the attacker.

Unable to replicate.

Centaur archers can get flanking 3, seems like a bug since that brings them to 95% withdrawal.

I count 85%. But how are they any different from regular Horse Archers? Both have access to the same promotions.


When playing with Puppet States and Revolutions, the AI sometimes will ignore a 10 turn peace treaty. For example, the AI will sometimes declare war on the very next turn following agreeing to a treaty.

OK. A savegame showing this behavior would be really helpful.
 
lizardmen druid is easy to fix, just add a duplicate of entangle that looks for the correct unit. I think you could use bgraphicalonly tag to make it not appear in the pedia, but it's not really an issue anyway since there's already 2 snowfall ( one for auric, one for highpriest/archmage )

disregard my post about centaur archers, I forgot flanking III is only blocked if it would bring you to 95% via defensive or horselord.

the HN message issue might be exclusive to extramodmod, sorry for reporting it here.
 
Nevermind about stigmata. I only play the game from time to time now and I got confused.
The armageddon was 100 and I decided to give Mardero the stigmata promo. Mardero had combat V so he was at 28 str. With stigamata I expected then a 50% boost from his base str descriminated directly on the odds.
But when you hold right click to check the odds of a potential fight the stigmata bonus is not descriminated like other bonus/penalties and Mardero was still just 28 str.

Although the bonus is not clearly shown on the advanced odds, I remembered and realize now that stigmata is a penalty against all opponents just like shock, cover, etc creates a penalty for a specific opposing unit.
So a fresh warrior fighting Mardero without stigmata (or shock) will be at 3 str, but if fighting a stigmata promoted Mardero when the AC is 100 he'll be at 2 str. I expected more, but if that is the way it works, then it's fine.
 
not really a bug, but: Rally worldspell applies religions to demagogs as if they were built in the city. however, demagogs that pop during normal crusade mode don't get religions.
 
If I build "City of a Thousand Slums" in a coastal city, I cannot make use of any water squares which are 3 tiles away from the city and would not normally be usable by a correctly placed coastal city in it's 2 tile range.

I've attached a screenshot which I have activated all possible tiles in my coastal city. The three starred squares cannot be used by my city at all, even though they are in 3 tile range (one is 2 on the diagonal) and the wonder should activate them.

The wonder does allow me to use water tiles that are 3 tiles away, but are also within 2 tile range of a coast - these would be in 2 tile range and usable by a correctly placed city.

I guess this is a limitation of the original game engine as these tiles could never be used in the original game. So I wonder if this is even possible to fix in FFH? :)
 

Attachments

  • ffh_bug1.jpg
    ffh_bug1.jpg
    306.4 KB · Views: 76
If I recall correctly, Civ IV simply does not assign any yields to any tiles that could normally never be worked. You should still be able to work those tiles if you increase their yields using python.

It should be easy to have the completion of that wonder trigger a bit of python that adds yields to any water tile that within a 3 tile radius that does not already have any yields. I suppose that similar code could run whenever a Sprawling trait leader founds a city.

It may be better to address the issue in C++ though.
 
I discovered that if an event changes the attitude between two players, using CvPlayerAI::AI_changeMemoryCount(), the scoreboard, and also the attitude "mode", like pleased etc. updates to late.

To debug an event that requires a pleased calabim player, and reduces the attitude from that player by 4 if a specific option is clicked, I set it two occur every turn (iWeight=-1).

Before I changed it, the event worked via python, using CyPlayer.AI_changeAttitudeExtra(). This way the scoreboard updated immediatly, and the event didn't occur the next turn, since the Calabim were no longer pleased.

After I changed it to work via XML, using changeMemoryCount(), the scoreboard not only didn't update (the tooltip was alright, but the emoticon remained "pleased"), but the event also triggered the next time, what means that the attitude "mode" updated not before the event triggered the next turn. This could be relevant also for f.e. AI calculations.

I added
Code:
GET_PLAYER(getID()).AI_invalidateAttitudeCache(eIndex1);
found in AI_changeAttitudeExtra(), at the end of AI_changeMemoryCount(), which solves the issue.
 
Another bug in CvUnit::canGift():
Code:
if (m_pUnitInfo->getPrereqAlignment() != NO_ALIGNMENT)
{
	if (m_pUnitInfo->getStateReligion() != GET_PLAYER(pPlot->getOwner()).getAlignment())
	{
		return false;
	}
}

getStateReligion() is obviously wrong here.

Also, the value of a civic is increased if you have units that would abandon you; this seems not to be the case with religion changes
 
All of the fixes for the issues reported in this post have been tested to work in my own mod. Let me know if you need the source code changes in any other format.

When casting the Wild Hunt, the Doviello get wolves by units like for example ships, with IMO is not correct. They also get wolves by units that are currently aboard a ship, which can lead to the wolves being stuck in a sea tile. The following change to the spell prevents both issues:

Code:
diff -r 246140a43a54 python/entrypoints/CvSpellInterface.py
--- a/python/entrypoints/CvSpellInterface.py	Wed Aug 28 20:40:47 2013 +0200
+++ b/python/entrypoints/CvSpellInterface.py	Wed Aug 28 20:51:13 2013 +0200
@@ -3835,7 +3835,8 @@
 	pPlayer = gc.getPlayer(caster.getOwner())
 	py = PyPlayer(caster.getOwner())
 	for pUnit in py.getUnitList():
-		if pUnit.baseCombatStr() > 0:
+		pPlot = pUnit.plot()
+		if pUnit.baseCombatStr() > 0 and pUnit.isAlive() and not pPlot.isWater() and not pPlot.isPeak():
 			newUnit = pPlayer.initUnit(iWolf, pUnit.getX(), pUnit.getY(), UnitAITypes.UNITAI_ATTACK, DirectionTypes.DIRECTION_SOUTH)
 			if pUnit.baseCombatStr() > 3:
 				i = (pUnit.baseCombatStr() - 2) / 2

EDIT: More issues.

While being vassals, the Infernals can use Hyborem's Whisper to steal one of the cities of their master. Since the master civilization has no way to impede this or to relatiate (the Infernals are still their vassal) it should IMO not be allowed. The following changes to getAshenVeilCities fix this.

Code:
diff -r 7691371ad4f8 python/CustomFunctions.py
--- a/python/CustomFunctions.py	Wed Aug 28 20:55:18 2013 +0200
+++ b/python/CustomFunctions.py	Thu Aug 29 18:54:01 2013 +0200
@@ -1066,6 +1066,9 @@
 			if pTargetPlayer.getTeam() == pCasterPlayer.getTeam():
 				continue
 
+			if (gc.getTeam(pCasterPlayer.getTeam()).isVassal(pTargetPlayer.getTeam())):
+				continue
+
 			iBaseModifier = 100
 			if pTargetPlayer.getStateReligion() == iVeil:
 				iBaseModifier -= 20

If the Illian player is in a team with other players, the total war caused by the Draw can be circumvented because the other players in the Illian team are not in total war.

Code:
diff -r de208a86e2bf python/CvEventManager.py
--- a/python/CvEventManager.py	Thu Aug 29 18:58:14 2013 +0200
+++ b/python/CvEventManager.py	Thu Aug 29 19:31:33 2013 +0200
@@ -1145,9 +1145,12 @@
 			pPlayer.initUnit(gc.getInfoTypeForString('UNIT_DRIFA'), pCity.getX(), pCity.getY(), UnitAITypes.NO_UNITAI, DirectionTypes.DIRECTION_SOUTH)
 
 		if iProjectType == gc.getInfoTypeForString('PROJECT_THE_DRAW'):
-			pPlayer.changeNoDiplomacyWithEnemies(1)
 			iTeam = pPlayer.getTeam()
 			eTeam = gc.getTeam(iTeam)
+			for iLoopPlayer in range(gc.getMAX_PLAYERS()):
+				pLoopPlayer = gc.getPlayer(iLoopPlayer)
+				if pLoopPlayer.isAlive() and pLoopPlayer.getTeam() == iTeam:
+					pLoopPlayer.changeNoDiplomacyWithEnemies(1)
 			for iLoopTeam in range(gc.getMAX_TEAMS()):
 				if iLoopTeam != iTeam:
 					if iLoopTeam != gc.getPlayer(gc.getBARBARIAN_PLAYER()).getTeam():

The following code prevents Pillar of Fire and Crush from targetting hidden plots. It also prevents invisible units from being taken into account when choosing the target plot (but they will still suffer damage if they are in the tile). Each change section is for reqCrush, spellCrush, reqPillarOfFire and spellPillarOfFire.

Code:
diff -r c81a2ca199cc python/entrypoints/CvSpellInterface.py
--- a/python/entrypoints/CvSpellInterface.py	Thu Aug 29 20:11:06 2013 +0200
+++ b/python/entrypoints/CvSpellInterface.py	Thu Aug 29 20:34:59 2013 +0200
@@ -911,16 +911,18 @@
 	for iiX in range(iX-2, iX+3, 1):
 		for iiY in range(iY-2, iY+3, 1):
 			pPlot = CyMap().plot(iiX,iiY)
-			bEnemy = False
-			bNeutral = False
-			for i in range(pPlot.getNumUnits()):
-				pUnit = pPlot.getUnit(i)
-				if eTeam.isAtWar(pUnit.getTeam()):
-					bEnemy = True
-				else:
-					bNeutral = True
-			if (bEnemy and bNeutral == False):
-				return True
+			if pPlot.isVisible(iTeam, False):
+				bEnemy = False
+				bNeutral = False
+				for i in range(pPlot.getNumUnits()):
+					pUnit = pPlot.getUnit(i)
+					if not pUnit.isInvisible(iTeam, False):
+						if eTeam.isAtWar(pUnit.getTeam()):
+							bEnemy = True
+						else:
+							bNeutral = True
+				if (bEnemy and not bNeutral):
+					return True
 	return False
 
 def spellCrush(caster):
@@ -936,19 +938,21 @@
 			bNeutral = False
 			iValue = 0
 			pPlot = CyMap().plot(iiX,iiY)
-			for i in range(pPlot.getNumUnits()):
-				pUnit = pPlot.getUnit(i)
-				if eTeam.isAtWar(pUnit.getTeam()):
-					iValue = iValue + 10
-				else:
-					bNeutral = True
-			if (iValue > iBestValue and bNeutral == False):
-				iBestValue = iValue
-				pBestPlot = pPlot
+			if pPlot.isVisible(iTeam, False):
+				for i in range(pPlot.getNumUnits()):
+					pUnit = pPlot.getUnit(i)
+					if not pUnit.isInvisible(iTeam, False):
+						if eTeam.isAtWar(pUnit.getTeam()):
+							iValue = iValue + 10
+						else:
+							bNeutral = True
+				if (iValue > iBestValue and not bNeutral):
+					iBestValue = iValue
+					pBestPlot = pPlot
 	if pBestPlot != -1:
 
 def reqDeclareNationality(caster):
@@ -1979,16 +1983,18 @@
 	for iiX in range(iX-2, iX+3, 1):
 		for iiY in range(iY-2, iY+3, 1):
 			pPlot = CyMap().plot(iiX,iiY)
-			bEnemy = false
-			bNeutral = false
-			for i in range(pPlot.getNumUnits()):
-				pUnit = pPlot.getUnit(i)
-				if eTeam.isAtWar(pUnit.getTeam()):
-					bEnemy = true
-				else:
-					bNeutral = true
-			if (bEnemy and bNeutral == false):
-				return true
+			if pPlot.isVisible(iTeam, False):
+				bEnemy = False
+				bNeutral = False
+				for i in range(pPlot.getNumUnits()):
+					pUnit = pPlot.getUnit(i)
+					if not pUnit.isInvisible(iTeam, False):
+						if eTeam.isAtWar(pUnit.getTeam()):
+							bEnemy = True
+						else:
+							bNeutral = True
+				if (bEnemy and not bNeutral):
+					return True
 	return false
 
 def spellPillarofFire(caster):
@@ -2004,15 +2010,17 @@
 			bNeutral = False
 			iValue = 0
 			pPlot = CyMap().plot(iiX,iiY)
-			for i in range(pPlot.getNumUnits()):
-				pUnit = pPlot.getUnit(i)
-				if eTeam.isAtWar(pUnit.getTeam()):
-					iValue += 5 * pUnit.baseCombatStr()
-				else:
-					bNeutral = True
-			if (iValue > iBestValue and bNeutral == False):
-				iBestValue = iValue
-				pBestPlot = pPlot
+			if pPlot.isVisible(iTeam, False):
+				for i in range(pPlot.getNumUnits()):
+					pUnit = pPlot.getUnit(i)
+					if not pUnit.isInvisible(iTeam, False):
+						if eTeam.isAtWar(pUnit.getTeam()):
+							iValue += 5 * pUnit.baseCombatStr()
+						else:
+							bNeutral = True
+				if (iValue > iBestValue and not bNeutral):
+					iBestValue = iValue
+					pBestPlot = pPlot
 	if pBestPlot != -1:
 		for i in range(pBestPlot.getNumUnits()):
 			pUnit = pBestPlot.getUnit(i)
 
Crusade spawning demagogs from enclaves is fixed, but Rally worldspell isn't yet ( cvspellinterface.py ) . the Crusade code also includes a nicely commented fix by Denev which should probably be applied to Rally as well ( i.e. don't spawn units on the same tile as an enemy unit )
 
In my current game (with my modmod) I captured a Mud Golem along with the Luchuirp's last city.

I just noticed that this Mud Golem does not have the Golem race anymore, but is now a Dwarf.

I think this minor issue is related to the code that is supposed to stop a captured worker or slave from being given the default race of the new owner.
 
[to_xp]Gekko;12751915 said:
Crusade spawning demagogs from enclaves is fixed, but Rally worldspell isn't yet ( cvspellinterface.py ) . the Crusade code also includes a nicely commented fix by Denev which should probably be applied to Rally as well ( i.e. don't spawn units on the same tile as an enemy unit )

OK. Will be added in 2.51

All of the fixes for the issues reported in this post have been tested to work in my own mod. Let me know if you need the source code changes in any other format.

Thanks for the code! I ended up doing Pillar of Fire (and Crush) like this.

Code:
def reqPillarofFire(caster):
	iX = caster.getX()
	iY = caster.getY()
	iPlayer = caster.getOwner()
	pPlayer = gc.getPlayer(iPlayer)
	iTeam = pPlayer.getTeam()
	eTeam = gc.getTeam(iTeam)
	for iiX in range(iX-2, iX+3, 1):
		for iiY in range(iY-2, iY+3, 1):
			pPlot = CyMap().plot(iiX,iiY)
			if pPlot.isVisibleEnemyUnit(iPlayer):
				bNeutral = False
				for i in range(pPlot.getNumUnits()):
					pUnit = pPlot.getUnit(i)
					if not eTeam.isAtWar(pUnit.getTeam()):
						bNeutral = True
				if not bNeutral:
					return True
	return false
 
I found a potential terraformer AI bug. While debugging a game with ExtraModMod/BarbsPlus, I got an assertion error CvSelectionGroupAI.cpp, line 217 (AI_update()).
BBAI log is attached. It seems the terraformer didn't end his move properly.

EDIT: The problem probably lies in the python code, since the python function returns 1, making the C++ code assume it was successful. The terraformer has not casted after the execution of the python code, though.

EDIT2: The units gets MISSION_MOVE_TO, but if I understood correctly the path generation is not successful, so the unit is send to a plot it can't reach.
The bug I'm trying to solve myself at the moment is an infinite loop related to path generation, so it may be an error specific to Extramodmod/Barbsplus. I'll update you if I manage to solve it or get more information.

EDIT3: Found the bug I was searching for. A unit group was formed and splitted over and over (see beginning of attached log file). I solved it by inserting this check in CvUnitAI::AI_group():
Code:
// lfgr fix: copied this check from AI_counterMove(), else it is possible that a group is created and then splitted indefinitely
	// "Should never have group lead by counter unit"
	if( getGroup()->getHeadUnitAI() == UNITAI_COUNTER && getGroup()->getNumUnits() == 1 )
	{
		if( plot()->isCity() && plot()->getOwnerINLINE() == getOwnerINLINE() )
		{
			return false;
		}
	}
// lfgr fix end

While this bug may be made possible by "unrelated" changes in BarbsPlus (It was a barbarian assassin, and barbarian spawning is modified heavily), I guess its not specific to BarbsPlus.

The terraformer bug (if it's a bug) is likely to be not related to any changes in BarbsPlus (the group bug was not in the path generation as I thought).
 

Attachments

Using the dotmapper from BUG one can easily locate unique improvements by hovering over areas of the map, until you can see the sign.
You can also find the elevation of most tiles, but I doubt most people care about a game enough for that.
I consider both of these a bug.
 
Back
Top Bottom