Bug Reporting

just got this on military advisor (revolution mod merged with BUG mod)

attachment.php


any idea?


just got another error screen:

attachment.php
 
the second screen I get always when I'm going to select an air unit within the actual game: figher, airship, ... can't select them anymore and cant get any infos about them (info popup on the left side is missing).
 
Traceback (most recent call last):

File "CvEventInterface", line 25, in onEvent

File "CvCustomEventManager", line 182, in handleEvent

File "CvCustomEventManager", line 193, in _handleDefaultEvent

File "autologEventManager", line 756, in onChangeWar

RuntimeError: unidentifiable C++ exception
ERR: Python function onEvent failed, module CvEventInterface
Why does this error message show up?
 
Can't specify, when. This error appears sometimes in early gameplay, sometimes in late gameplay...
 
ok guys the bug with air combat units is in your clean bug 3.0 version too (no merges with other mods). therefore I guess, the military advisor bug is also from bug mod, not from revolution mod.

edit: missiles are effected too.
 
just got another error screen:

attachment.php
This seems to be the same bug as reported a few pages earlier:
I am using the SVN and my following report is based on the version I pulled a couple of days ago.

I got a python exception when hovering the mouse over an air unit's icon in the plot list. The cause of the exception is in CvMainInterface.py within the following code:

Code:
# strength 
		if (eUnitDomain == DomainTypes.DOMAIN_AIR):
			fCurrStrength 	= float(pUnit.airCurrCombatStr()*0.01)
			fMaxStrength 	= float(pUnit.airMaxCombatStr()*0.01)
		else:
			fCurrStrength 	= float(pUnit.baseCombatStr())*float(1.0-pUnit.getDamage()*0.01)
			fMaxStrength 	= float(pUnit.baseCombatStr())

The problem is that the function airCurrCombatStr should take an argument of type CyUnit rather than nothing. The argument is expected to be a defender unit (interceptor fighter) to weigh the strength of the current unit against. It is only used when performing an air unit mession. There is no need for calling a special function for air units as baseCombatStr can be used for them like land or sea units.

Sorry for not mentioning the exact line number as it is relative to my own version of the file which merge BUG modifications to other mods.
 
just got this on military advisor (revolution mod merged with BUG mod)

ok guys the bug with air combat units is in your clean bug 3.0 version too (no merges with other mods). therefore I guess, the military advisor bug is also from bug mod, not from revolution mod.

edit: missiles are effected too.
Do you have a save game that I can look at? The MA skips settlers and workers (non combat type) but it might also be incorrectly skipping (or including) other units.
 
A save would help with the MA. But Ruff, the second quote is regarding a problem with the PLE hovers on the main interface (air combat strength). The fix has been posted, I just haven't had a chance to go over it yet.
 
no, it was my own mod (not released yet).

the second bug can be easily reproduced. simply use bug mod 3.0. use world editor to add an airship and try to click this new airship ingame.
 
Regarding the error with the BUG Military Advisor, here's the code:

Code:
def getCanTrainUnits(self, iPlayer, iCheckingPlayer):
	pPlayer = gc.getPlayer(iPlayer)
	pCheckingPlayer = gc.getPlayer(iCheckingPlayer)
	civInfo = gc.getCivilizationInfo(pPlayer.getCivilizationType())

	iUnits = set()
	for i in range (gc.getNumUnitClassInfos()):
		iUnit = civInfo.getCivilizationUnits(i)
		pUnitInfo = gc.getUnitInfo(iUnit)
		[B]if pUnitInfo.getUnitCombatType() > 0: # ie, not settler, worker, missionary, etc[/B]
			for c in range(pPlayer.getNumCities()):
				pCity = pPlayer.getCity(c)
				if pCity and not pCity.isNone() and pCity.canTrain(iUnit, False, False):
					if pUnitInfo.getDomainType() == DomainTypes.DOMAIN_SEA and not pCity.isRevealed(pCheckingPlayer.getTeam(), False):
						# Skip water units if the checking player doesn't know about this city
						BugUtil.debug("%s can build %s, but %s cannot see the city" % (pCity.getName(), pUnitInfo.getDescription(), pCheckingPlayer.getName()))
						continue
					iUnits.add(iUnit)
					break

	return iUnits

The bold line is the problem, and the error is saying that pUnitInfo is the Python special value None which can only happen if iUnit above it got -1. I think this means that the civilization has no unit type for the given unit class. My understanding is that if you ask a civ for its unit for the class UNITCLASS_WARRIOR you will get UNIT_WARRIOR if it doesn't have a special warrior replacement. Perhaps that's not correct.

Regardless, Ruff, try just checking for None:

Code:
if [B]pUnitInfo is not None and [/B]pUnitInfo.getUnitCombatType() > 0:
    ...

I am surprised we haven't seen this error yet. Cybah, am I correct in assuming that you haven't modified CvBUGMilitaryAdvisor.py? Does your mod create a new civ? If so, is it set up correctly?
 
A save would help with the MA. But Ruff, the second quote is regarding a problem with the PLE hovers on the main interface (air combat strength). The fix has been posted, I just haven't had a chance to go over it yet.

I've already fixed it in my merge. I removed the if statement that checks whether the unit is an Air Unit or not. I left the code that used to be in the else portion so it is applied to all unit types. Air Units have their info pane displayed correctly and without issues.
 
The MA bug is almost certainly a Revolution's one. I think it is the same as the one JDog has fixed with the file attached to this post. You can try applying the fix and see if the issue with the MA will be eliminated as well.

It won't fix the MA, but the code I posted above should. It may, however, cause the Strategic Advantage column for Barbarian civs to be misleading. I haven't seen that mod, so I can only guess.
 
It is Revolution related and happens because in Revolution Barbarians can have units of types that are not defined for them like tanks. JDog posted a Revolution specific fix for this issue.

Yes, but I'm saying the fix he posted doesn't address the problem in the BUG MA. You should still see the problem.

You are correct about the cause, but it happens in BUG MA because the Revolutions mod must allow barbarians to act like normal civ rivals, meaning the MA is now displaying them as a rival and trying to find their strategic advantages. This requires looping over all unit classes.

Here's the real fix for you which we should add to BUG proper for other modders to avoid this trouble:

Code:
for i in range (gc.getNumUnitClassInfos()):
	iUnit = civInfo.getCivilizationUnits(i)
	[B]if iUnit == -1:
		iUnit = gc.getUnitClassInfo(i).getDefaultUnitIndex()[/B]
	pUnitInfo = gc.getUnitInfo(iUnit)
	if [B]pUnitInfo and[/B] pUnitInfo.getUnitCombatType() > 0: # ie, not settler, worker, missionary, etc
		...

This will use the default unit for a class if the civ doesn't specify one. Would you mind testing this out and reporting back? Thanks!
 
I am surprised we haven't seen this error yet. Cybah, am I correct in assuming that you haven't modified CvBUGMilitaryAdvisor.py? Does your mod create a new civ? If so, is it set up correctly?

I did'nt modify anything. There are no new civs (except the barbarian civ and 'minor civ' from revolution mod), only new leaderheads. I have to add: I did NOT play with revolution, minor civ or barbarian civ enabled. All those 3 components from revolution mod were disabled.


@Cybah

The MA bug is almost certainly a Revolution's one. I think it is the same as the one JDog has fixed with the file attached to this post. You can try applying the fix and see if the issue with the MA will be eliminated as well.

I already played with jdog's bugfix. Therefore this (other but comparable) bug was still there.




What about that air unit bug? You can't select any air combat unit or missile (maybe no domain air unit?) with BUG mod 3.0. this should really be fixed.




---

Just testing your bugfix...
 
PHP:
	def getCanTrainUnits(self, iPlayer, iCheckingPlayer):
		pPlayer = gc.getPlayer(iPlayer)
		pCheckingPlayer = gc.getPlayer(iCheckingPlayer)
		civInfo = gc.getCivilizationInfo(pPlayer.getCivilizationType())

		iUnits = set()
		for i in range (gc.getNumUnitClassInfos()):
			iUnit = civInfo.getCivilizationUnits(i)
			if iUnit == -1:
				iUnit = gc.getUnitClassInfo(i).getDefaultUnitIndex()
			pUnitInfo = gc.getUnitInfo(iUnit)
			if pUnitInfo and pUnitInfo.getUnitCombatType() > 0: # ie, not settler, worker, missionary, etc
				for c in range(pPlayer.getNumCities()):
				pCity = pPlayer.getCity(c)  <---
				if pCity and not pCity.isNone() and pCity.canTrain(iUnit, False, False):
					if pUnitInfo.getDomainType() == DomainTypes.DOMAIN_SEA and not pCity.isRevealed(pCheckingPlayer.getTeam(), False):
						# Skip water units if the checking player doesn't know about this city
						BugUtil.debug("%s can build %s, but %s cannot see the city" % (pCity.getName(), pUnitInfo.getDescription(), pCheckingPlayer.getName()))
						continue
					iUnits.add(iUnit)
					break

		return iUnits

is not working (civ won't start). where's the mistake?
It looks like your indentation after the city loop is wrong (see line with the '<---').

But first, I'm confused about what is causing the original python exception. What unit has a '-1' for combat type or doesn't have a pUnitInfo value?

Secondly, the above code does the following:

loop over all units (excluding non combat: worker, settler, missionary, spy, ...)
loop over all of the AI's cities
add up all the units that the AI can build (train) but exclude sea units if the city isn't revealed

There are a few other things in there but that is the kernel of the code.

This is wrong. What about a city that the human cannot see that is not connected to other cities but is connected to copper. The above would say that the player can train axes, but the human player should not be able to tell that. Copper would not appear on the F4 screens and the city with copper is hidden in fog.

I think the correct code should be ...

loop over all units (excluding non combat: worker, settler, missionary, spy, ...)
loop over all of the AI's cities (skipping cities that the player cannot see)
add up all the units that the AI can build (train)
 
you're too late, the only mistakes were some spaces. :D

still need a bugfix for that air unit issue.
 
Back
Top Bottom