diff --git a/BotE Game/trunk/Source/GUI/CombatMenuView.cpp b/BotE Game/trunk/Source/GUI/CombatMenuView.cpp index 45176d6c..0b7e7c1f 100644 --- a/BotE Game/trunk/Source/GUI/CombatMenuView.cpp +++ b/BotE Game/trunk/Source/GUI/CombatMenuView.cpp @@ -188,10 +188,7 @@ void CCombatMenuView::OnDraw(CDC* dc) // grobe prozentuale Kampfchance und beteiligte Rassen berechnen const boost::shared_ptr& pAnomaly = pDoc->GetSystem(pDoc->m_ptCurrentCombatSector.x, pDoc->m_ptCurrentCombatSector.y).GetAnomaly(); - m_dWinningChance = CCombat::GetWinningChance(*pMajor, m_Ships, *pDoc->GetRaceCtrl(), m_sFriends, m_sEnemies, pAnomaly.get(), false); - - m_dWinningChance = min(0.99, m_dWinningChance); - m_dWinningChance = max(0.01, m_dWinningChance); + m_dWinningChance = CCombat::GetWinningChance(*pMajor, m_Ships, *pDoc->GetRaceCtrl(), m_sFriends, m_sEnemies, pAnomaly.get(), false, true); if (m_sFriends.find(m_pPlayersRace) != m_sFriends.end()) { diff --git a/BotE Game/trunk/Source/GUI/GalaxyMenuView.cpp b/BotE Game/trunk/Source/GUI/GalaxyMenuView.cpp index c401a980..04fad026 100644 --- a/BotE Game/trunk/Source/GUI/GalaxyMenuView.cpp +++ b/BotE Game/trunk/Source/GUI/GalaxyMenuView.cpp @@ -1782,9 +1782,7 @@ CString CGalaxyMenuView::CreateTooltip(void) std::set dummy1; std::set dummy2; double chance = CCombat::GetWinningChance(*pMajor, involved_ships, - *pDoc->GetRaceCtrl(), dummy1, dummy2, pSector->GetAnomaly().get(), true); - chance = min(0.99, chance); - chance = max(0.01, chance); + *pDoc->GetRaceCtrl(), dummy1, dummy2, pSector->GetAnomaly().get(), true, true); sTip += CHTMLStringBuilder::GetHTMLStringNewLine(); sTip += CHTMLStringBuilder::GetHTMLStringHorzLine(); diff --git a/BotE Game/trunk/Source/Gamedata/AI/CombatAI.cpp b/BotE Game/trunk/Source/Gamedata/AI/CombatAI.cpp index 820eaf07..c71706f3 100644 --- a/BotE Game/trunk/Source/Gamedata/AI/CombatAI.cpp +++ b/BotE Game/trunk/Source/Gamedata/AI/CombatAI.cpp @@ -113,7 +113,7 @@ void CCombatAI::ApplyCombatOrders(const CArray& vInvolvedShips, const C // Ist die Beziehung nicht ausreichend, dann die Schiffstärken im Sektor beachten und Gewinnchance ermitteln set sFriends; set sEnemies; - double dWinningChance = CCombat::GetWinningChance(pRace1.get(), vInvolvedShips, pmRaces, sFriends, sEnemies, pAnomaly); + double dWinningChance = CCombat::GetWinningChance(pRace1.get(), vInvolvedShips, pmRaces, sFriends, sEnemies, pAnomaly, false); if (dWinningChance > 0.75) mCombatOrders[*it] = COMBAT_ORDER::AUTOCOMBAT; diff --git a/BotE Game/trunk/Source/Gamedata/Ships/Combat.cpp b/BotE Game/trunk/Source/Gamedata/Ships/Combat.cpp index 5a9823cd..9a54e235 100644 --- a/BotE Game/trunk/Source/Gamedata/Ships/Combat.cpp +++ b/BotE Game/trunk/Source/Gamedata/Ships/Combat.cpp @@ -583,7 +583,7 @@ bool CCombat::CheckShipStayInCombat(int i) // Funktion zum Berechnen der groben prozentualen Siegchance einer Rasse. Die Siegchance liegt zwischen 0 und 1. -double CCombat::GetWinningChance(const CRace& OurRace, const std::vector>& vInvolvedShips, const CRaceController& races, std::set& friends, std::set& enemies, const CAnomaly* const pAnomaly, bool include_fleet) +double CCombat::GetWinningChance(const CRace& OurRace, const std::vector>& vInvolvedShips, const CRaceController& races, std::set& friends, std::set& enemies, const CAnomaly* const pAnomaly, bool include_fleet, bool limit) { double dWinningChance = 0.5; double dOurStrenght = 0.0; @@ -649,10 +649,16 @@ double CCombat::GetWinningChance(const CRace& OurRace, const std::vector 0.0) dWinningChance = dOurStrenght / dEnemyStrenght / 2.0; + if(limit) + { + dWinningChance = min(0.99, dWinningChance); + dWinningChance = max(0.01, dWinningChance); + } + return dWinningChance; } -double CCombat::GetWinningChance(const CRace* pOurRace, const CArray& vInvolvedShips, const CRaceController* pmRaces, std::set& sFriends, std::set& sEnemies, const CAnomaly* pAnomaly) +double CCombat::GetWinningChance(const CRace* pOurRace, const CArray& vInvolvedShips, const CRaceController* pmRaces, std::set& sFriends, std::set& sEnemies, const CAnomaly* pAnomaly, bool limit) { AssertBotE(pOurRace); AssertBotE(pmRaces); @@ -662,7 +668,7 @@ double CCombat::GetWinningChance(const CRace* pOurRace, const CArray& v for (int i = 0; i < vInvolvedShips.GetSize(); i++) ships.push_back(vInvolvedShips.GetAt(i)->shared_from_this()); - return GetWinningChance(*pOurRace, ships, *pmRaces, sFriends, sEnemies, pAnomaly, false); + return GetWinningChance(*pOurRace, ships, *pmRaces, sFriends, sEnemies, pAnomaly, false, limit); } // Funktion überprüft, ob die Rassen in einem Kampf sich gegeneinander aus diplomatischen Gründen diff --git a/BotE Game/trunk/Source/Gamedata/Ships/Combat.h b/BotE Game/trunk/Source/Gamedata/Ships/Combat.h index 329cb423..7e58bb07 100644 --- a/BotE Game/trunk/Source/Gamedata/Ships/Combat.h +++ b/BotE Game/trunk/Source/Gamedata/Ships/Combat.h @@ -72,8 +72,8 @@ class CCombat : public CObject /** * Funktion zum Berechnen der groben prozentualen Siegchance einer Rasse. Die Siegchance liegt zwischen 0 und 1. */ - static double GetWinningChance(const CRace& OurRace, const std::vector>& vInvolvedShips, const CRaceController& races, std::set& friends, std::set& enemies, const CAnomaly* const pAnomaly, bool include_fleet); - static double GetWinningChance(const CRace* pOurRace, const CArray& vInvolvedShips, const CRaceController* pmRaces, std::set& sFriends, std::set& sEnemies, const CAnomaly* pAnomaly); + static double GetWinningChance(const CRace& OurRace, const std::vector>& vInvolvedShips, const CRaceController& races, std::set& friends, std::set& enemies, const CAnomaly* const pAnomaly, bool include_fleet, bool limit); + static double GetWinningChance(const CRace* pOurRace, const CArray& vInvolvedShips, const CRaceController* pmRaces, std::set& sFriends, std::set& sEnemies, const CAnomaly* pAnomaly, bool limit); /** * Funktion überprüft, ob die Rassen in einem Kampf sich gegeneinander aus diplomatischen Gründen