Single Player bugs and crashes v35 plus (SVN) - After the 18th of August 2014

[8019]
Just noticed that hidden nationality units can attack adjacent ship when trying to enter transport ship at same tile.
 

Attachments

  • hiddennation_before.jpg
    hiddennation_before.jpg
    475 KB · Views: 110
  • hiddennation_after.jpg
    hiddennation_after.jpg
    496.9 KB · Views: 114
  • hiddennation_notrans.jpg
    hiddennation_notrans.jpg
    473.9 KB · Views: 71
Not all of them but many.
I fixed a few odd things and bugs in them like true and false should be True and False.

Except that true is a global defined as True and the same with false as False. Not that it matters really, it is just going to be a pain merging it with my working files since I was working on a number of files all over the place :(.
WoC has no way to fix this because the TECH_MOUNTAINEERING exists even if you don't have the Useable Mountains option on.

Well that explains why my 3am fix did not work.

It would be even simpler to use the GameOption tag to turn the Mountaineering tech off/on. No code required.

edit pity that does not seem to work either. I'll play around a bit more and see if I can come up with something. I wonder if the AndPreReqs on the tech file is not WoCed properly - unlikely. It is more likely I did something wrong.
 
I am having trouble using the TechYieldModifiers tag for Building Infos. I noticed no one has ever actually used it AT ALL before and the only mention of it are in the Schema Files and in some animal trainer files as <TechYieldModifiers/>.

Am I applying the tag wrong?
I attached a picture of the location of the tag in .cpp files.

Tag highlighted in red.
Hydro/Craft/Craft_BuildingInfos.xml
Code:
		<BuildingInfo>
			<BuildingClass>BUILDINGCLASS_SLAUGHTERHOUSE</BuildingClass>
			<Type>BUILDING_SLAUGHTERHOUSE</Type>
			<SpecialBuildingType>NONE</SpecialBuildingType>
			<Description>TXT_KEY_BUILDING_SLAUGHTERHOUSE</Description>
			<Civilopedia>TXT_KEY_BUILDING_SLAUGHTERHOUSE_PEDIA</Civilopedia>
			<Strategy>TXT_KEY_BUILDING_SLAUGHTERHOUSE_STRATEGY</Strategy>
			<Advisor>ADVISOR_ECONOMY</Advisor>
			<ArtDefineTag>ART_DEF_BUILDING_SLAUGHTERHOUSE</ArtDefineTag>
			<MovieDefineTag>NONE</MovieDefineTag>
			<HolyCity>NONE</HolyCity>
			<ReligionType>NONE</ReligionType>
			<StateReligion>NONE</StateReligion>
			<bStateReligion>0</bStateReligion>
			<PrereqReligion>NONE</PrereqReligion>
			<PrereqCorporation>NONE</PrereqCorporation>
			<FoundsCorporation>NONE</FoundsCorporation>
			<GlobalReligionCommerce>NONE</GlobalReligionCommerce>
			<GlobalCorporationCommerce>NONE</GlobalCorporationCommerce>
			<VictoryPrereq>NONE</VictoryPrereq>
			<FreeStartEra>NONE</FreeStartEra>
			<MaxStartEra>NONE</MaxStartEra>
			<ObsoleteTech>NONE</ObsoleteTech>
			<PrereqTech>TECH_COOKED_FOOD</PrereqTech>
			<TechTypes>
			<PrereqTech>TECH_SHELTER_BUILDING</PrereqTech>
			</TechTypes>
			<Bonus>NONE</Bonus>
			<PrereqBonuses>
				<Bonus>BONUS_CARCASS</Bonus>
				<Bonus>BONUS_PELTS</Bonus>
				<Bonus>BONUS_POULTRY</Bonus>
			</PrereqBonuses>
			<ProductionTraits/>
			<HappinessTraits/>
			<NoBonus>NONE</NoBonus>
			<PowerBonus>NONE</PowerBonus>
			<FreeBonus>NONE</FreeBonus>
			<iNumFreeBonuses>0</iNumFreeBonuses>
			<FreeBuilding>NONE</FreeBuilding>
			<FreePromotion>NONE</FreePromotion>
			<CivicOption>NONE</CivicOption>
			<GreatPeopleUnitClass>NONE</GreatPeopleUnitClass>
			<iGreatPeopleRateChange>0</iGreatPeopleRateChange>
			<iHurryAngerModifier>0</iHurryAngerModifier>
			<bBorderObstacle>0</bBorderObstacle>
			<bTeamShare>0</bTeamShare>
			<bWater>0</bWater>
			<bRiver>0</bRiver>
			<bPower>0</bPower>
			<bDirtyPower>0</bDirtyPower>
			<bAreaCleanPower>0</bAreaCleanPower>
			<DiploVoteType>NONE</DiploVoteType>
			<bForceTeamVoteEligible>0</bForceTeamVoteEligible>
			<bCapital>0</bCapital>
			<bGovernmentCenter>0</bGovernmentCenter>
			<bGoldenAge>0</bGoldenAge>
			<bAllowsNukes>0</bAllowsNukes>
			<bMapCentering>0</bMapCentering>
			<bNoUnhappiness>0</bNoUnhappiness>
			<bNoUnhealthyPopulation>0</bNoUnhealthyPopulation>
			<bBuildingOnlyHealthy>0</bBuildingOnlyHealthy>
			<bNeverCapture>0</bNeverCapture>
			<bNukeImmune>0</bNukeImmune>
			<bPrereqReligion>0</bPrereqReligion>
			<bCenterInCity>0</bCenterInCity>
			<iAIWeight>0</iAIWeight>
			<iCost>25</iCost>
			<iHurryCostModifier>100</iHurryCostModifier>
			<iAdvancedStartCost>-1</iAdvancedStartCost>
			<iAdvancedStartCostIncrease>0</iAdvancedStartCostIncrease>
			<iMinAreaSize>-1</iMinAreaSize>
			<iConquestProb>50</iConquestProb>
			<iCitiesPrereq>0</iCitiesPrereq>
			<iTeamsPrereq>0</iTeamsPrereq>
			<iLevelPrereq>0</iLevelPrereq>
			<iMinLatitude>0</iMinLatitude>
			<iMaxLatitude>90</iMaxLatitude>
			<iGreatPeopleRateModifier>0</iGreatPeopleRateModifier>
			<iGreatGeneralRateModifier>0</iGreatGeneralRateModifier>
			<iDomesticGreatGeneralRateModifier>0</iDomesticGreatGeneralRateModifier>
			<iGlobalGreatPeopleRateModifier>0</iGlobalGreatPeopleRateModifier>
			<iAnarchyModifier>0</iAnarchyModifier>
			<iGoldenAgeModifier>0</iGoldenAgeModifier>
			<iGlobalHurryModifier>0</iGlobalHurryModifier>
			<iExperience>0</iExperience>
			<iGlobalExperience>0</iGlobalExperience>
			<iFoodKept>0</iFoodKept>
			<iAirlift>0</iAirlift>
			<iAirModifier>0</iAirModifier>
			<iAirUnitCapacity>0</iAirUnitCapacity>
			<iNukeModifier>0</iNukeModifier>
			<iNukeExplosionRand>0</iNukeExplosionRand>
			<iFreeSpecialist>0</iFreeSpecialist>
			<iAreaFreeSpecialist>0</iAreaFreeSpecialist>
			<iGlobalFreeSpecialist>0</iGlobalFreeSpecialist>
			<iMaintenanceModifier>0</iMaintenanceModifier>
			<iWarWearinessModifier>0</iWarWearinessModifier>
			<iGlobalWarWearinessModifier>0</iGlobalWarWearinessModifier>
			<iEnemyWarWearinessModifier>0</iEnemyWarWearinessModifier>
			<iHealRateChange>0</iHealRateChange>
			<iHealth>0</iHealth>
			<iAreaHealth>0</iAreaHealth>
			<iGlobalHealth>0</iGlobalHealth>
			<iHappiness>0</iHappiness>
			<iAreaHappiness>0</iAreaHappiness>
			<iGlobalHappiness>0</iGlobalHappiness>
			<iStateReligionHappiness>0</iStateReligionHappiness>
			<iWorkerSpeedModifier>0</iWorkerSpeedModifier>
			<iMilitaryProductionModifier>0</iMilitaryProductionModifier>
			<iSpaceProductionModifier>0</iSpaceProductionModifier>
			<iGlobalSpaceProductionModifier>0</iGlobalSpaceProductionModifier>
			<iTradeRoutes>0</iTradeRoutes>
			<iCoastalTradeRoutes>0</iCoastalTradeRoutes>
			<iGlobalTradeRoutes>0</iGlobalTradeRoutes>
			<iTradeRouteModifier>0</iTradeRouteModifier>
			<iForeignTradeRouteModifier>0</iForeignTradeRouteModifier>
			<iGlobalPopulationChange>0</iGlobalPopulationChange>
			<iFreeTechs>0</iFreeTechs>
			<iDefense>0</iDefense>
			<iBombardDefense>0</iBombardDefense>
			<iAllCityDefense>0</iAllCityDefense>
			<iEspionageDefense>0</iEspionageDefense>
			<iAsset>0</iAsset>
			<iPower>0</iPower>
			<fVisibilityPriority>0.0</fVisibilityPriority>
			<SeaPlotYieldChanges/>
			<RiverPlotYieldChanges/>
			<GlobalSeaPlotYieldChanges/>
			<YieldChanges>
				<iYield>1</iYield>
				<iYield>0</iYield>
				<iYield>0</iYield>
			</YieldChanges>
			<CommerceChanges>
				<iCommerce>1</iCommerce>
				<iCommerce>0</iCommerce>
				<iCommerce>0</iCommerce>
				<iCommerce>0</iCommerce>
			</CommerceChanges>
			<ObsoleteSafeCommerceChanges>
				<iCommerce>0</iCommerce>
				<iCommerce>0</iCommerce>
				<iCommerce>0</iCommerce>
			</ObsoleteSafeCommerceChanges>
			<CommerceChangeDoubleTimes/>
			<CommerceModifiers/>
[B][COLOR="Red"]			<TechYieldModifiers>
				<TechYieldModifier>
					<PrereqTech>TECH_STANDARDIZATION</PrereqTech>
					<TechYield>
						<iYield>5</iYield>
						<iYield>0</iYield>
						<iYield>0</iYield>
					</TechYield>
				</TechYieldModifier>
			</TechYieldModifiers>[/COLOR][/B]
			<GlobalCommerceModifiers/>
			<SpecialistExtraCommerces/>
			<StateReligionCommerces/>
			<CommerceHappinesses/>
			<ReligionChanges/>
			<SpecialistCounts/>
			<FreeSpecialistCounts/>
			<CommerceFlexibles/>
			<CommerceChangeOriginalOwners/>
			<ConstructSound/>
			<BonusHealthChanges/>
			<BonusHappinessChanges/>
			<BonusProductionModifiers/>
			<UnitCombatFreeExperiences/>
			<DomainFreeExperiences/>
			<DomainProductionModifiers/>
			<BuildingHappinessChanges/>
			<PrereqOrBuildingClasses>
				<PrereqOrBuildingClass>
					<BuildingClassType>BUILDINGCLASS_STORAGE_PIT</BuildingClassType>
					<bPrereqBuildingClass>1</bPrereqBuildingClass>
				</PrereqOrBuildingClass>
				<PrereqOrBuildingClass>
					<BuildingClassType>BUILDINGCLASS_BARTER_POST</BuildingClassType>
					<bPrereqBuildingClass>1</bPrereqBuildingClass>
				</PrereqOrBuildingClass>
				<PrereqOrBuildingClass>
					<BuildingClassType>BUILDINGCLASS_VIKING_TRADING_POST</BuildingClassType>
					<bPrereqBuildingClass>1</bPrereqBuildingClass>
				</PrereqOrBuildingClass>
				<PrereqOrBuildingClass>
					<BuildingClassType>BUILDINGCLASS_SHOPPING_DISTRICT</BuildingClassType>
					<bPrereqBuildingClass>1</bPrereqBuildingClass>
				</PrereqOrBuildingClass>
			</PrereqOrBuildingClasses>
			<SpecialistYieldChanges/>
			<BonusYieldModifiers/>
			<ImprovementFreeSpecialists/>
			<Flavors/>
			<HotKey/>
			<bAltDown>0</bAltDown>
			<bShiftDown>0</bShiftDown>
			<bCtrlDown>0</bCtrlDown>
			<iHotKeyPriority>0</iHotKeyPriority>
		</BuildingInfo>
 

Attachments

  • Untitled.png
    Untitled.png
    53.7 KB · Views: 68
@albert
Actually, none of these odd stuff or bugs which you fix are bugs.
They are all valid expressions for python.
 
Re: Geology/Mountaineering

WoC is not going to work anyway because the techs, buildings etc are loaded before you get to the custom options screen. You would need to check the options and start a game then exit and start again for it change anything. I have not checked that this is the case for the advance economy techs etc as I never have them on so the techs are not there and clicking the option does not put them there.

We really need a parameter screen before everything that shows all the options and tells you that you need to restart to get those options active.
 
SVN 8014, bug may be in newer SVN's as well

At the moment i have an enemy naval unit stationed on top of a sea tunnel and fishing boat, when i try to attack said Naval unit it is unattackable, this is at the moment happening in 2 separate instances, as if the naval unit was on land.

If i try to attack it with a land unit moving into the sea tunnel it does not work either.
 
Except that true is a global defined as True and the same with false as False. Not that it matters really, it is just going to be a pain merging it with my working files since I was working on a number of files all over the place :(.

They where defined in CvUtil so it would be CvUtil.true and CvUtil.false not just true and false. But i think it only matters in newer Python versions.
It is just :crazyeye::confused: if you read True and true right next to each other in the same line.

@albert
Actually, none of these odd stuff or bugs which you fix are bugs.
They are all valid expressions for python.

I didn't post all the changes here because i made alot changes and a few of them where real bugs.

This is a example of odd stuff:
CyCity.getNumActiveBuilding returns a number so this is wrong
Code:
		if [B]ppCity.getNumActiveBuilding(gi_Topkapi) == true[/B]:
				gi_Topkapi_IsActive = true
it might not really matter but it is better now.


And here is what i call a bug:
Code:
pCity.changeFreeBonus([B]bonusinfo.GetType()[/B],1)
must be
Code:
pCity.changeFreeBonus(bonusinfo,1)

But you are the python expert so you are always right and i'am wrong.
 
Re: Geology/Mountaineering

WoC is not going to work anyway because the techs, buildings etc are loaded before you get to the custom options screen. You would need to check the options and start a game then exit and start again for it change anything. I have not checked that this is the case for the advance economy techs etc as I never have them on so the techs are not there and clicking the option does not put them there.

We really need a parameter screen before everything that shows all the options and tells you that you need to restart to get those options active.

It must be fixed in the dll because and it affects all the techs with GameOption prereqs. I already posted the changes for CvPlayer::canResearch and every other place with simmilar code must be changed in the same way.

But with that fix it could be possible that techs with only GameOption dependent prereq techs end up without any prereq tech.
 
You are right that getNumActiveBuilding will always return an integer.
But there is nothing wrong with
Code:
if X == True:
where X is any integer

In python, anything can be used to do a boolean comparison.

Any object can be tested for truth value, for use in an if or while condition or as operand of the Boolean operations below. The following values are considered false:

None

False

zero of any numeric type, for example, 0, 0L, 0.0, 0j.

any empty sequence, for example, '', (), [].

any empty mapping, for example, {}.

instances of user-defined classes, if the class defines a __nonzero__() or __len__() method, when that method returns the integer zero or bool value False. [1]

All other values are considered true &#8212; so objects of many types are always true.

In short, even
Code:
if 5 == True:
is a valid expression.

As for changeFreeBonus, the first input should be the Bonus ID.
Neither CyBonusInfo().getType() nor CyBonusInfo() should be used as the input.

P.S.
I do have experience with python modding, but there is no one who is always right.
People learn through experience.
 
It must be fixed in the dll because and it affects all the techs with GameOption prereqs. I already posted the changes for CvPlayer::canResearch and every other place with simmilar code must be changed in the same way.

But with that fix it could be possible that techs with only GameOption dependent prereq techs end up without any prereq tech.

The first Or tech prereq should never be ignored. It's And tech prereqs that could be. I haven't looked too deeply into your proposed solution yet. I'm not messing with anything in the code for a couple weeks here yet.
 
Ok, so I lied. I found I needed to do some coding today afterall.

So I added this portion in since AND prereqs are all that should be possible to ignore.
Code:
for (iI = 0; iI < GC.getNUM_AND_TECH_PREREQS(); iI++)
	{
		TechTypes ePrereq = (TechTypes)GC.getTechInfo(eTech).getPrereqAndTechs(iI);
		if (ePrereq != NO_TECH && canEverResearch(ePrereq))
This should make it possible to uncommountout the portion in Geology regarding the And Prereq of Mountaineering.

EDIT: Nope - doesn't work to resolve the problem with the tech tree in this situation. :(

Of course, if we want we can make a Useable Mountains option dependent replacement entry for the Geology tech that could sort out the issue.
 
Actually, whether it is OR or AND Prereq, neither can be simply ignored, without looking at the situation.

A single OR prereq functions similarly to a single AND prereq, since there is no choice.
It is either A or A...

The difference will be how they are placed on the tech screen.
Or prereq will have arrows leading to it.
And prereq will have icons on top top right of panel.

If I only want one single prereq, whether I want to use OR or AND, depends on how I want it to be displayed on the tech tree.

Divine Rights in BTS is an example with just 2 AND prereq and no OR prereq.
Of course, this would be similar to 1 AND prereq and 1 OR prereq.
Why it is done so as 2/0 rather than 1/1 is because it is gonna look ugly with arrows in that position in the tree.
 
SVN 8031

The following XML Error occurs when starting the game:

Tag: PROMOTION_TATTOO in Info class was incorrect
Current XML file is: modules\Hydro\Hydro_CIV4BuildingInfos.xml

The same goes for PROMOTION_BAMBOO_ARMOR.
 
You are right that getNumActiveBuilding will always return an integer.
But there is nothing wrong with
Code:
if X == True:
where X is any integer

In python, anything can be used to do a boolean comparison.



In short, even
Code:
if 5 == True:
is a valid expression.

As for changeFreeBonus, the first input should be the Bonus ID.
Neither CyBonusInfo().getType() nor CyBonusInfo() should be used as the input.

P.S.
I do have experience with python modding, but there is no one who is always right.
People learn through experience.

Compared with other languages Python isn't very strict about many things. But in a big project like C2C always using the same coding style makes it easier to work with the code.
 
reposting since it got lost

SVN 8014, bug may be in newer SVN's as well

At the moment i have an enemy naval unit stationed on top of a sea tunnel and fishing boat, when i try to attack said Naval unit it is unattackable, this is at the moment happening in 2 separate instances, as if the naval unit was on land.

If i try to attack it with a land unit moving into the sea tunnel it does not work either.
 
reposting since it got lost

SVN 8014, bug may be in newer SVN's as well

At the moment i have an enemy naval unit stationed on top of a sea tunnel and fishing boat, when i try to attack said Naval unit it is unattackable, this is at the moment happening in 2 separate instances, as if the naval unit was on land.

If i try to attack it with a land unit moving into the sea tunnel it does not work either.

Wasn't lost... just noted. Getting this tunnel thing right is truly infernal. Does it work to attack it with a helicopter?
 
Ahh, sorry about that, i did not have vertical flight units at the time so wasnt able to give it a shot, ill go to war on purpose tonight/tomorrow and have a crack at it for u
 
Rev 8037:

On entering the city advisor for the first time I get the following asserts:

Assert Failed

File: CvArtFileMgr.cpp
Line: 108
SVN-Rev: 8020
Expression: false
Message: ArtInfo: 'ART_DEF_MOVIE_LASCAUX' was not found

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

Assert Failed

File: CvArtFileMgr.cpp
Line: 108
SVN-Rev: 8020
Expression: false
Message: ArtInfo: 'ERROR' was not found

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

Assert Failed

File: CvArtFileMgr.cpp
Line: 108
SVN-Rev: 8020
Expression: false
Message: ArtInfo: 'ART_DEF_MOVIE_GREAT_ZIMBABWE' was not found

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

Assert Failed

File: CvArtFileMgr.cpp
Line: 108
SVN-Rev: 8020
Expression: false
Message: ArtInfo: 'ERROR' was not found

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

The same error with the following movies:
ART_DEF_MOVIE_BEAULIEU
ART_DEF_MOVIE_INDEPENDENCE_HALL
ART_DEF_MOVIE_NONSUCH
ART_DEF_MOVIE_FAME
ART_DEF_MOVIE_HOUSE_OF_WISDOM
ART_DEF_MOVIE_KENTUCKY_DERBY
ART_DEF_MOVIE_KRAK_DES_CHEVS
ART_DEF_MOVIE_MADISON_AVENUE
ART_DEF_MOVIE_PERE_LACHAISE
ART_DEF_MOVIE_WALK_OF_FAME
ART_DEF_MOVIE_WARHOL_FACTORY
ART_DEF_MOVIE_WESTMINSTER
ART_DEF_MOVIE_YASNAYA_POLYANA
ART_DEF_MOVIE_WIKIPEDIA
ART_DEF_MOVIE_ROUTE_66
 
Back
Top Bottom