Skip to content

Commit

Permalink
Assert fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
axatin committed Jan 11, 2025
1 parent 7b812c1 commit b3c2ab2
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 19 deletions.
2 changes: 1 addition & 1 deletion CvGameCoreDLL_Expansion2/CvBuilderTaskingAI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4359,7 +4359,7 @@ void CvBuilderTaskingAI::LogDirective(BuilderDirective directive, int iWeight, b
if(!m_bLogging)
return;

if (GC.getBuildInfo(directive.m_eBuild) == NULL)
if (directive.m_eBuild == NO_BUILD || GC.getBuildInfo(directive.m_eBuild) == NULL)
return;

CvString strLog;
Expand Down
8 changes: 4 additions & 4 deletions CvGameCoreDLL_Expansion2/CvDiplomacyAI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31838,9 +31838,6 @@ void CvDiplomacyAI::DoContactPlayer(PlayerTypes ePlayer)
DoMakeVassalageStatement(ePlayer, eStatement, pDeal);

DoLiberateMyVassalStatement(ePlayer, eStatement);

DoVassalTaxesRaisedStatement(ePlayer, eStatement);
DoVassalTaxesLoweredStatement(ePlayer, eStatement);
}

// OFFERS - all members but ePlayer passed by address
Expand Down Expand Up @@ -31894,6 +31891,9 @@ void CvDiplomacyAI::DoContactPlayer(PlayerTypes ePlayer)
DoHappySamePolicyTree(ePlayer, eStatement);
DoIdeologicalStatement(ePlayer, eStatement);
DoVictoryCompetitionStatement(ePlayer, eStatement);

DoVassalTaxesRaisedStatement(ePlayer, eStatement);
DoVassalTaxesLoweredStatement(ePlayer, eStatement);
}
}
}
Expand Down Expand Up @@ -54706,7 +54706,7 @@ void CvDiplomacyAI::DoVassalTaxesLoweredStatement(PlayerTypes ePlayer, DiploStat
if(GET_PLAYER(ePlayer).GetDiplomacyAI()->IsVassalTaxLowered(GetID()))
{
eStatement = DIPLO_STATEMENT_VASSAL_TAXES_LOWERED_AI_MASTER;

for(int iPlayerLoop = 0; iPlayerLoop < MAX_MAJOR_CIVS; iPlayerLoop++)
{
PlayerTypes eLoopPlayer = (PlayerTypes) iPlayerLoop;
Expand Down
2 changes: 1 addition & 1 deletion CvGameCoreDLL_Expansion2/CvEspionageClasses.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3297,7 +3297,7 @@ int CvPlayerEspionage::CalcNetworkPointsPerTurn(CvSpyState eSpyState, CvCity* pC
PlayerTypes eCityOwner = pCity->getOwner();

// Base Influence
iTemp = /*20*/ GD_INT_GET(ESPIONAGE_NP_BASE);
iTemp = /*30*/ GD_INT_GET(ESPIONAGE_NP_BASE);
iNP += iTemp;
GC.getGame().BuildProdModHelpText(toolTipSink, "TXT_KEY_EO_NETWORK_POINTS_BASE_TT", iTemp);

Expand Down
2 changes: 1 addition & 1 deletion CvGameCoreDLL_Expansion2/CvPlayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35711,7 +35711,7 @@ void CvPlayer::SetProximityToPlayer(PlayerTypes ePlayer, PlayerProximityTypes eP
PRECONDITION(eProximity >= NO_PLAYER_PROXIMITY, "eIndex is expected to be non-negative (invalid Index)"); // NO_PLAYER_PROXIMITY is valid because some players may have no Cities (e.g. on the first turn)
PRECONDITION(eProximity < NUM_PLAYER_PROXIMITIES, "eIndex is expected to be within maximum bounds (invalid Index)");

if((GC.getLogging() && GC.getAILogging()))
if(GC.getLogging() && GC.getAILogging() && GET_PLAYER(ePlayer).isEverAlive())
{
if(eProximity != m_aiProximityToPlayer[ePlayer])
{
Expand Down
20 changes: 8 additions & 12 deletions CvGameCoreDLL_Expansion2/CvUnit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7473,22 +7473,18 @@ void CvUnit::LogWorkerEvent(BuildTypes eBuildType, bool bStartingConstruction)
ImprovementTypes eImprovement = (ImprovementTypes)GC.getBuildInfo(eBuildType)->getImprovement();
if(eImprovement != NO_IMPROVEMENT)
{
ResourceTypes eResource = plot()->getResourceType(getTeam());
CvResourceInfo* pkResourceInfo = GC.getResourceInfo(eResource);
if (pkResourceInfo)
ResourceTypes eResource = plot()->getResourceType(NO_TEAM);
if (eResource != NO_RESOURCE)
{
if (eResource != NO_RESOURCE)
{
strResource = pkResourceInfo->GetType();
strResource += ",";
}
else if (plot()->getResourceType(NO_TEAM) != NO_RESOURCE)
CvResourceInfo* pkResourceInfo = GC.getResourceInfo(eResource);
if (pkResourceInfo)
{
eResource = plot()->getResourceType(NO_TEAM);
strResource = pkResourceInfo->GetType();
strResource += ",";

strCanSee = "Can't see!,";
if (plot()->getResourceType(getTeam()) == NO_RESOURCE)
{
strCanSee = "Can't see!,";
}
}
}
}
Expand Down

0 comments on commit b3c2ab2

Please sign in to comment.