Skip to content

Commit

Permalink
Extra checks against undefined behavior
Browse files Browse the repository at this point in the history
  • Loading branch information
RecursiveVision committed Dec 7, 2024
1 parent 3b42d67 commit 6fff480
Show file tree
Hide file tree
Showing 5 changed files with 426 additions and 241 deletions.
3 changes: 2 additions & 1 deletion CvGameCoreDLL_Expansion2/CvBarbarians.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1280,7 +1280,8 @@ void CvBarbarians::SpawnBarbarianUnits(CvPlot* pPlot, int iNumUnits, BarbSpawnRe
if (eUnit != NO_UNIT)
{
// And spawn it!
CvUnit* pUnit = GET_PLAYER(BARBARIAN_PLAYER).initUnit(eUnit, pSpawnPlot->getX(), pSpawnPlot->getY(), eUnitAI);
CvUnitEntry* pkUnitInfo = GC.getUnitInfo(eUnit);
CvUnit* pUnit = GET_PLAYER(BARBARIAN_PLAYER).initUnit(eUnit, pSpawnPlot->getX(), pSpawnPlot->getY(), pkUnitInfo->GetDefaultUnitAIType());
if (pUnit)
{
iNumUnitsSpawned++;
Expand Down
2 changes: 1 addition & 1 deletion CvGameCoreDLL_Expansion2/CvDealAI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2856,7 +2856,7 @@ int CvDealAI::GetThirdPartyPeaceValue(bool bFromMe, PlayerTypes eOtherPlayer, Te

CivApproachTypes eAskingMajorCivApproach = pDiploAI->GetSurfaceApproach(eOtherPlayer);

// Modify for our feelings towards the asking player
// Modify for our feelings towards the player we'd be asking
switch (eAskingMajorCivApproach)
{
case CIV_APPROACH_WAR:
Expand Down
Loading

0 comments on commit 6fff480

Please sign in to comment.