MCPcopy Create free account
hub / github.com/OpenDungeons/OpenDungeons / refreshGuiSkill

Method refreshGuiSkill

source/modes/GameMode.cpp:1563–1604  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1561}
1562
1563void GameMode::refreshGuiSkill(bool forceRefresh)
1564{
1565 Seat* localPlayerSeat = mGameMap->getLocalPlayer()->getSeat();
1566
1567 // If the percentage or the pending skill changed, we force refresh
1568 float curSkillProgress;
1569 SkillType curResType;
1570 if(localPlayerSeat->getCurrentSkillProgress(curResType, curSkillProgress) &&
1571 ((mCurrentSkillType != curResType) ||
1572 (mCurrentSkillProgress != curSkillProgress)))
1573 {
1574 forceRefresh = true;
1575 }
1576
1577 if(!forceRefresh && !localPlayerSeat->getGuiSkillNeedsRefresh())
1578 return;
1579
1580 if(mIsSkillWindowOpen && localPlayerSeat->getGuiSkillNeedsRefresh())
1581 {
1582 // We check if the temporary current pending list changed.
1583 for(auto it = mSkillPending.begin(); it != mSkillPending.end();)
1584 {
1585 SkillType resType = *it;
1586 if(!localPlayerSeat->isSkillDone(resType))
1587 {
1588 ++it;
1589 continue;
1590 }
1591
1592 it = mSkillPending.erase(it);
1593 }
1594 }
1595
1596 localPlayerSeat->guiSkillRefreshed();
1597
1598 // We show/hide each icon depending on available skills
1599 SkillManager::listAllSkills([this](const std::string& skillButtonName, const std::string& castButtonName,
1600 const std::string& skillProgressBarName, SkillType resType)
1601 {
1602 refreshSkillButtonState(skillButtonName, castButtonName, skillProgressBarName, resType);
1603 });
1604}
1605
1606void GameMode::refreshSpellButtonCoolDowns()
1607{

Callers 1

operator()Method · 0.45

Calls 6

getLocalPlayerMethod · 0.80
isSkillDoneMethod · 0.80
guiSkillRefreshedMethod · 0.80
getSeatMethod · 0.45

Tested by

no test coverage detected