Manco Capac
Friday,13 June,I Collapse
- Joined
- Mar 1, 2010
- Messages
- 8,051
While reading CvPlayerAI::AI_baseBonusVal() which is a substep to understand worker behaviour when it comes to evaluate the most toppish in value for bonus resources, I was kinda stopped by a weird condition structure.
That !isLimitedUnitClass(), which is defined in CvGameCoreUtils.cpp:
So a limitedUnitClass is either a worldclassunit (a unit that can be built once in the whole world like a world wonder) or a teamunit (certain number of units permitted for a team) or a playerunit class (limited number of units for a player, which is a subset of a possible team).
!isLimitedUnitClass() is the...uh...contrary...okay.
What is the opposite first and then what is the use of that condition seriously?
Except for modding purposes, I think there is not a single worldunitclass or teamunitclass or playerunitclass. They are all -1.
I'm lost.

Code:
if (bIsWater && !isLimitedUnitClass((UnitClassTypes)(kLoopUnit.getUnitClassType())))
{
iTempValue *= std::min(iCoastalCityCount * 2, iCityCount); // double coastal cities, cap at total cities
iTempValue /= std::max(1, iCityCount);
}
That !isLimitedUnitClass(), which is defined in CvGameCoreUtils.cpp:
Code:
bool isLimitedUnitClass(UnitClassTypes eUnitClass)
{
return (isWorldUnitClass(eUnitClass) || isTeamUnitClass(eUnitClass) || isNationalUnitClass(eUnitClass));
}
So a limitedUnitClass is either a worldclassunit (a unit that can be built once in the whole world like a world wonder) or a teamunit (certain number of units permitted for a team) or a playerunit class (limited number of units for a player, which is a subset of a possible team).
!isLimitedUnitClass() is the...uh...contrary...okay.
What is the opposite first and then what is the use of that condition seriously?
Except for modding purposes, I think there is not a single worldunitclass or teamunitclass or playerunitclass. They are all -1.
I'm lost.

