CvDiplomacyAI::DoWeAttackedYourMinorStatement(PlayerTypes, DiploStatementTypes &, int &)
- Defined in
- CvDiplomacyAI.cpp, line 14068
- Class
- CvDiplomacyAI
- Hook name
CivHooks::CvDiplomacyAI_DoWeAttackedYourMinorStatement
Hooks
static bool BeforeCvDiplomacyAI_DoWeAttackedYourMinorStatement(CvDiplomacyAI* self, PlayerTypes ePlayer, DiploStatementTypes& eStatement, int& iData1);static void AfterCvDiplomacyAI_DoWeAttackedYourMinorStatement(CvDiplomacyAI* self, PlayerTypes ePlayer, DiploStatementTypes& eStatement, int& iData1);static void ReplaceCvDiplomacyAI_DoWeAttackedYourMinorStatement(void (*original)(CvDiplomacyAI*, PlayerTypes, DiploStatementTypes&, int&), CvDiplomacyAI* self, PlayerTypes ePlayer, DiploStatementTypes& eStatement, int& iData1);CivRegisterBefore<CivHooks::CvDiplomacyAI_DoWeAttackedYourMinorStatement>(host, &BeforeCvDiplomacyAI_DoWeAttackedYourMinorStatement);CivRegisterAfter<CivHooks::CvDiplomacyAI_DoWeAttackedYourMinorStatement>(host, &AfterCvDiplomacyAI_DoWeAttackedYourMinorStatement);CivRegisterReplace<CivHooks::CvDiplomacyAI_DoWeAttackedYourMinorStatement>(host, &ReplaceCvDiplomacyAI_DoWeAttackedYourMinorStatement);
Code
14067/// Possible Contact Statement - Have we attacked a minor that is protected by someone?14068void CvDiplomacyAI::DoWeAttackedYourMinorStatement(PlayerTypes ePlayer, DiploStatementTypes& eStatement, int& iData1)14069{14070 CvAssertMsg(ePlayer >= 0, "DIPLOMACY_AI: Invalid Player Index. Please send Jon this with your last 5 autosaves and what changelist # you're playing.");14071 CvAssertMsg(ePlayer < MAX_MAJOR_CIVS, "DIPLOMACY_AI: Invalid Player Index. Please send Jon this with your last 5 autosaves and what changelist # you're playing.");1407214073 if(eStatement == NO_DIPLO_STATEMENT_TYPE)14074 {14075 for(int iMinorCivLoop = MAX_MAJOR_CIVS; iMinorCivLoop < MAX_CIV_PLAYERS; iMinorCivLoop++)14076 {14077 PlayerTypes eMinor = (PlayerTypes) iMinorCivLoop;14078 if(GET_PLAYER(eMinor).isAlive() && GET_PLAYER(eMinor).GetMinorCivAI()->IsProtectedByMajor(ePlayer))14079 {14080 if(IsAtWar(eMinor))14081 {14082 // Did we deal them damage last turn?14083 if(GetOtherPlayerWarValueLost(eMinor, GetPlayer()->GetID()) > GetOtherPlayerLastRoundWarValueLost(eMinor, GetPlayer()->GetID()))14084 {14085 // Has this message not yet been sent during this war?14086 if(!HasSentAttackProtectedMinorTaunt(ePlayer, eMinor))14087 {14088 DiploStatementTypes eTempStatement = DIPLO_STATEMENT_WE_ATTACKED_YOUR_MINOR;14089 int iTurnsBetweenStatements = 1;14090 if(GetNumTurnsSinceStatementSent(ePlayer, eTempStatement) >= iTurnsBetweenStatements)14091 {14092 CvAssert(eMinor >= MAX_MAJOR_CIVS);14093 CvAssert(eMinor < MAX_CIV_PLAYERS);1409414095 eStatement = eTempStatement;14096 iData1 = eMinor;14097 }14098 }14099 }14100 }14101 }14102 }14103 }14104}
Calls
- CvDiplomacyAI::GetNumTurnsSinceStatementSent(PlayerTypes, DiploStatementTypes)
- CvDiplomacyAI::GetOtherPlayerLastRoundWarValueLost(PlayerTypes, PlayerTypes) const
- CvDiplomacyAI::GetOtherPlayerWarValueLost(PlayerTypes, PlayerTypes) const
- CvDiplomacyAI::GetPlayer()
- CvDiplomacyAI::HasSentAttackProtectedMinorTaunt(PlayerTypes, PlayerTypes)
- CvDiplomacyAI::IsAtWar(PlayerTypes)
- CvMinorCivAI::IsProtectedByMajor(PlayerTypes) const
- CvPlayer::GetID() const
- CvPlayer::GetMinorCivAI() const
- CvPlayer::isAlive() const
- CvPlayerAI::getPlayer(PlayerTypes)