xienwolf
Deity
Orcs spawn in groups, not sure if they collate themselves outside of the spawning though, or if they still do individual considerations and/or split the groups set upon spawning.
Orcs spawn in groups, not sure if they collate themselves outside of the spawning though, or if they still do individual considerations and/or split the groups set upon spawning.
I know what the problem with the warning is but I don't understand the 2 errors||=== CvGameCoreDLL, Final Release ===|
CvGameTextMgr.cpp|4079|warning C4101: 'iAbsHappiness' : unreferenced local variable|
CvPlayer.obj||error LNK2019: unresolved external symbol "public: void __thiscall CvPlayer::setLeaderAttitudeChange(enum LeaderHeadTypes,int)" (?setLeaderAttitudeChange@CvPlayer@@QAEXW4LeaderHeadTypes@@H@Z) referenced in function "public: void __thiscall CvPlayer::init(enum PlayerTypes)" (?init@CvPlayer@@QAEXW4PlayerTypes@@@Z)|
Final Release\CvGameCoreDLL.dll||fatal error LNK1120: 1 unresolved externals|
||=== Build finished: 2 errors, 1 warnings ===|
int CvPlayerAI::AI_getHatedCivicAttitude(PlayerTypes ePlayer)
{
int iAttitudeChange;
int iAttitude;
iAttitude = 0;
if (GC.getLeaderHeadInfo(getPersonalityType()).getHatedCivic() != NO_CIVIC)
{
if (isCivic((CivicTypes)(GC.getLeaderHeadInfo(getPersonalityType()).getHatedCivic())) && GET_PLAYER(ePlayer).isCivic((CivicTypes)(GC.getLeaderHeadInfo(getPersonalityType()).getHatedCivic())))
{
iAttitude += GC.getLeaderHeadInfo(getPersonalityType()).getHatedCivicAttitudeChange();
if (GC.getLeaderHeadInfo(getPersonalityType()).getHatedCivicAttitudeDivisor() != 0)
{
iAttitudeChange = (AI_getHatedCivicCounter(ePlayer) / GC.getLeaderHeadInfo(getPersonalityType()).getHatedCivicAttitudeDivisor());
iAttitude += range(iAttitudeChange, -(abs(GC.getLeaderHeadInfo(getPersonalityType()).getHatedCivicAttitudeChangeLimit())), abs(GC.getLeaderHeadInfo(getPersonalityType()).getHatedCivicAttitudeChangeLimit()));
}
}
}
return iAttitude;
}
Alternatively you can have a check early in CvUnitAI::AI_update or whatever it is that all units pass through at the start of the turn which tests how many units the player has compared to how many groups and attempts to keep that ratio at a reasonable number if possible. If the ratio is violated, then have it do the grouping code as the first step in their AI instead of almost the last step. It could potentially work well.
pStream->Write(aLeaderAttitudeChange.size());
for (std::map<LeaderHeadTypes, int>::iterator it = aLeaderAttitudeChange.begin(); it != aLeaderAttitudeChange.end(); ++it)
{
pStream->Write(it->first);
pStream->Write(it->second);
}
pStream->Read(aLeaderAttitudeChange.size());
for (std::map<LeaderHeadTypes, int>::iterator it = aLeaderAttitudeChange.begin(); it != aLeaderAttitudeChange.end(); ++it)
{
pStream->Read(it->first);
pStream->Read(it->second);
}
CvPlayer.cpp
CvPlayer.cpp(17732) : error C2664: 'void FDataStreamBase::Read(char *)' : cannot convert parameter 1 from 'std::_Tree<_Traits>::size_type' to 'char *'
with
[
_Traits=std::_Tmap_traits<LeaderHeadTypes,int,std::less<LeaderHeadTypes>,std::allocator<std:air<const LeaderHeadTypes,int>>,false>
]
Conversion from integral type to pointer type requires reinterpret_cast, C-style cast or function-style cast
CvPlayer.cpp(17735) : error C2664: 'void FDataStreamBase::Read(char *)' : cannot convert parameter 1 from 'const LeaderHeadTypes' to 'char *'
Conversion from integral type to pointer type requires reinterpret_cast, C-style cast or function-style cast
CvPlayer.cpp(17736) : error C2664: 'void FDataStreamBase::Read(char *)' : cannot convert parameter 1 from 'int' to 'char *'
Conversion from integral type to pointer type requires reinterpret_cast, C-style cast or function-style cast
Process terminated with status 2 (0 minutes, 6 seconds)
3 errors, 0 warnings
Yes, it was terribly different. Nothing I could have done myself, given my current skillsYeah I didn't get on fast enough to say it, but that message almost ALWAYS means that your ::read(stream) and ::write don't match properly. And itterators work best when they already exist, so they are a bit tricky to reverse engineer how to write them (as in, that Read bit you missed sure was different, wasn't it?)
InterestingJust as a heads up on my own progress toward making 051 a mod-modder's paradise, I have a few XML files with new fields I still have to write default statements for:
CvBuildingInfo
CvCivilizationInfo
CvHandicapInfo
CvGoodyInfo
CvImprovementInfo
CvBonusInfo
CvFeatureInfo
CvTerrainInfo
CvLeaderHeadInfo
CvProjectInfo
CvReligionInfo
CvTraitInfo
CvStateNameInfo
Once those are done, I JUST have to figure out why it is currently an instant crash upon attempting to load a savegame and I can start writing code for the toys that the rest of the team wanted to play with for this next release.
However, something else appeared. I added a new tag, HatedCivic, which works like FavoriteCivic, with a divisor and all. Problem: it seems that it is no longer considered when the leader which give the malus change its civics. Example:
I made it so Sabathiel hates Despotism (this is for debugging!) and gives it -2, max. -4 with a divisor of -5. Classical start, I have Despotism, so he gives me a penalty of -2. Note that, for now, he also has Despotism. Then, he switches to God King and I don't leave Despotism... the malus is gone.
I may understand incorrectly my code... What should I change in order to solve this issue?I guess it's the isCivic part of the second if. I thought it was only checking if the value of HatedCivic is actually a civic...Code:int CvPlayerAI::AI_getHatedCivicAttitude(PlayerTypes ePlayer) { int iAttitudeChange; int iAttitude; iAttitude = 0; if (GC.getLeaderHeadInfo(getPersonalityType()).getHatedCivic() != NO_CIVIC) { if (isCivic((CivicTypes)(GC.getLeaderHeadInfo(getPersonalityType()).getHatedCivic())) && GET_PLAYER(ePlayer).isCivic((CivicTypes)(GC.getLeaderHeadInfo(getPersonalityType()).getHatedCivic()))) { iAttitude += GC.getLeaderHeadInfo(getPersonalityType()).getHatedCivicAttitudeChange(); if (GC.getLeaderHeadInfo(getPersonalityType()).getHatedCivicAttitudeDivisor() != 0) { iAttitudeChange = (AI_getHatedCivicCounter(ePlayer) / GC.getLeaderHeadInfo(getPersonalityType()).getHatedCivicAttitudeDivisor()); iAttitude += range(iAttitudeChange, -(abs(GC.getLeaderHeadInfo(getPersonalityType()).getHatedCivicAttitudeChangeLimit())), abs(GC.getLeaderHeadInfo(getPersonalityType()).getHatedCivicAttitudeChangeLimit())); } } } return iAttitude; }
/*********************************************************************/
/** BETTER UNITAI Sephi ERAMOD **/
bool bDanger = (GET_PLAYER(getOwnerINLINE()).AI_getPlotDanger(plot(), 1) > 0);
if (bDanger)
{
CvCity* pLoopCity;
int iPathTurns;
int iBestValue=100;
int iLoop;
int iValue;
CvPlot* pBestPlot=NULL;
for (pLoopCity = GET_PLAYER(getOwnerINLINE()).firstCity(&iLoop); pLoopCity != NULL; pLoopCity = GET_PLAYER(getOwnerINLINE()).nextCity(&iLoop))
{
if (AI_plotValid(pLoopCity->plot()))
{
if (!(pLoopCity->plot()->isVisibleEnemyUnit(this)))
{
/*********************************************************************/
/** SPEED TWEAK Sephi ERAMOD **/
/** We only check for cities not that far away **/
int XDist=pLoopCity->plot()->getX_INLINE() - plot()->getX_INLINE();
int YDist=pLoopCity->plot()->getY_INLINE() - plot()->getY_INLINE();
if (((XDist*XDist)+(YDist*YDist))<100 || (GC.getDefineINT("USE_ERAMOD_SPEED_TWEAK")==0))
{
if (!atPlot(pLoopCity->plot()) && generatePath(pLoopCity->plot(), MOVE_SAFE_TERRITORY, true, &iPathTurns))
{
iValue = iPathTurns;
if (iValue < iBestValue)
{
iBestValue = iValue;
pBestPlot = getPathEndTurnPlot();
FAssert(!atPlot(pBestPlot));
}
}
}
/** SPEED TWEAK End **/
/*********************************************************************/
}
}
}
if (pBestPlot!=NULL)
{
getGroup()->pushMission(MISSION_MOVE_TO, pBestPlot->getX_INLINE(), pBestPlot->getY_INLINE(), MOVE_SAFE_TERRITORY);
return;
}
}
/** BETTER UNITAI End **/
/*********************************************************************/