CvDiplomacyAI::LogWarState(CvString &, PlayerTypes)
- Defined in
- CvDiplomacyAI.cpp, line 27574
- Class
- CvDiplomacyAI
- Hook name
CivHooks::CvDiplomacyAI_LogWarState
Hooks
static bool BeforeCvDiplomacyAI_LogWarState(CvDiplomacyAI* self, CvString& strString, PlayerTypes ePlayer);static void AfterCvDiplomacyAI_LogWarState(CvDiplomacyAI* self, CvString& strString, PlayerTypes ePlayer);static void ReplaceCvDiplomacyAI_LogWarState(void (*original)(CvDiplomacyAI*, CvString&, PlayerTypes), CvDiplomacyAI* self, CvString& strString, PlayerTypes ePlayer);CivRegisterBefore<CivHooks::CvDiplomacyAI_LogWarState>(host, &BeforeCvDiplomacyAI_LogWarState);CivRegisterAfter<CivHooks::CvDiplomacyAI_LogWarState>(host, &AfterCvDiplomacyAI_LogWarState);CivRegisterReplace<CivHooks::CvDiplomacyAI_LogWarState>(host, &ReplaceCvDiplomacyAI_LogWarState);
Code
27573/// Log War State27574void CvDiplomacyAI::LogWarState(CvString& strString, PlayerTypes ePlayer)27575{27576 CvString strTemp;2757727578 bool bShowOperationProgress = false;2757927580 // Log progress towards Sneak Attack Operation launch if we're not yet at war27581 if(GetWarGoal(ePlayer) == WAR_GOAL_PREPARE)27582 {27583 CvAIOperation* pOperation = GetPlayer()->GetMilitaryAI()->GetSneakAttackOperation(ePlayer);2758427585 if(pOperation)27586 {27587 bShowOperationProgress = true;27588 int iOperationPercentMustered = pOperation->PercentFromMusterPointToTarget();2758927590 if(iOperationPercentMustered > 0)27591 {27592 strTemp.Format("PREP PRGS %2d", iOperationPercentMustered);27593 }27594 else27595 {27596 strTemp.Format("PREP Gathering");27597 }27598 }27599 }27600 // Preparing a demand?27601 if(GetWarGoal(ePlayer) == WAR_GOAL_DEMAND)27602 {27603 CvAIOperation* pOperation = GetPlayer()->GetMilitaryAI()->GetShowOfForceOperation(ePlayer);2760427605 if(pOperation)27606 {27607 bShowOperationProgress = true;27608 int iOperationPercentMustered = pOperation->PercentFromMusterPointToTarget();2760927610 if(iOperationPercentMustered > 0)27611 {27612 strTemp.Format("DMND PRGS %2d", iOperationPercentMustered);27613 }27614 else27615 {27616 strTemp.Format("DMND Gathering");27617 }27618 }27619 }2762027621 if(!bShowOperationProgress)27622 {27623 // War State27624 switch(GetWarState(ePlayer))27625 {27626 case WAR_STATE_CALM:27627 strTemp.Format("WST Calm");27628 break;27629 case WAR_STATE_NEARLY_WON:27630 strTemp.Format("WST Nearly Won");27631 break;27632 case WAR_STATE_OFFENSIVE:27633 strTemp.Format("WST Offensive");27634 break;27635 case WAR_STATE_STALEMATE:27636 strTemp.Format("WST Stalemate");27637 break;27638 case WAR_STATE_DEFENSIVE:27639 strTemp.Format("WST DEFENSIVE");27640 break;27641 case WAR_STATE_NEARLY_DEFEATED:27642 strTemp.Format("WST **NEARLY DEFEATED**");27643 break;27644 default:27645 if(IsAtWar(ePlayer))27646 {27647 strTemp.Format("XXX");27648 }27649 else27650 {27651 strTemp.Format("");27652 }27653 break;27654 }27655 }2765627657 strString += ", " + strTemp;27658}
Calls
- CvAIOperation::PercentFromMusterPointToTarget()
- CvDiplomacyAI::GetPlayer()
- CvDiplomacyAI::GetWarGoal(PlayerTypes) const
- CvDiplomacyAI::GetWarState(PlayerTypes) const
- CvDiplomacyAI::IsAtWar(PlayerTypes)
- CvMilitaryAI::GetShowOfForceOperation(PlayerTypes)
- CvMilitaryAI::GetSneakAttackOperation(PlayerTypes)
- CvPlayer::GetMilitaryAI() const
CvString::CvStringCvString::Formatstd::basic_string::operator+=std::operator+