| 1435 | } |
| 1436 | |
| 1437 | void GameMode::refreshSkillButtonState(const std::string& skillButtonName, const std::string& castButtonName, |
| 1438 | const std::string& skillProgressBarName, SkillType resType) |
| 1439 | { |
| 1440 | // Determine the widget name and button accordingly to the SkillType given |
| 1441 | Seat* localPlayerSeat = mGameMap->getLocalPlayer()->getSeat(); |
| 1442 | bool isDone = localPlayerSeat->isSkillDone(resType); |
| 1443 | bool isAllowed = true; |
| 1444 | uint32_t queueNumber = 0; |
| 1445 | if(!isDone) |
| 1446 | { |
| 1447 | const std::vector<SkillType>& skillNotAllowed = localPlayerSeat->getSkillNotAllowed(); |
| 1448 | if(std::find(skillNotAllowed.begin(), skillNotAllowed.end(), resType) != skillNotAllowed.end()) |
| 1449 | { |
| 1450 | // Skill is not allowed |
| 1451 | isAllowed = false; |
| 1452 | } |
| 1453 | else |
| 1454 | { |
| 1455 | // If we are currently changing the skill window, we display the temporary |
| 1456 | // modified pending list |
| 1457 | if(mIsSkillWindowOpen) |
| 1458 | { |
| 1459 | uint32_t cpt = 1; |
| 1460 | for (SkillType pendingRes : mSkillPending) |
| 1461 | { |
| 1462 | if (pendingRes == resType) |
| 1463 | { |
| 1464 | queueNumber = cpt; |
| 1465 | break; |
| 1466 | } |
| 1467 | ++cpt; |
| 1468 | } |
| 1469 | } |
| 1470 | else |
| 1471 | { |
| 1472 | queueNumber = localPlayerSeat->isSkillPending(resType); |
| 1473 | } |
| 1474 | } |
| 1475 | } |
| 1476 | |
| 1477 | const std::string okIcon = "OpenDungeonsIcons/CheckIcon"; |
| 1478 | const std::string pendingIcon = "OpenDungeonsIcons/HourglassIcon"; |
| 1479 | const std::string abortIcon = "OpenDungeonsIcons/AbortIcon"; |
| 1480 | const std::string workIcon = "OpenDungeonsIcons/CogIcon"; |
| 1481 | |
| 1482 | float curSkillProgress; |
| 1483 | SkillType curResType; |
| 1484 | if(!localPlayerSeat->getCurrentSkillProgress(curResType, curSkillProgress)) |
| 1485 | { |
| 1486 | curResType = SkillType::nullSkillType; |
| 1487 | } |
| 1488 | |
| 1489 | // We show/hide the icons depending on available skills |
| 1490 | CEGUI::Window* guiSheet = mRootWindow; |
| 1491 | CEGUI::Window* skillsWindow = guiSheet->getChild("SkillTreeWindow/Skills"); |
| 1492 | |
| 1493 | CEGUI::Window* skillButton = skillsWindow->getChild(skillButtonName); |
| 1494 | CEGUI::ProgressBar* skillProgressBar = |
nothing calls this directly
no test coverage detected