| 1374 | } |
| 1375 | |
| 1376 | void Seat::setNextSkill(SkillType skilledType) |
| 1377 | { |
| 1378 | if(!mGameMap->isServerGameMap()) |
| 1379 | return; |
| 1380 | |
| 1381 | mCurrentSkill = nullptr; |
| 1382 | if(mSkillPending.empty()) |
| 1383 | { |
| 1384 | mCurrentSkillType = SkillType::nullSkillType; |
| 1385 | |
| 1386 | // Notify the player that no skill is in the queue if there are still available skills |
| 1387 | if(SkillManager::isAllSkillsDoneForSeat(this)) |
| 1388 | return; |
| 1389 | |
| 1390 | if(getPlayer() == nullptr) |
| 1391 | return; |
| 1392 | if(!getPlayer()->getIsHuman()) |
| 1393 | return; |
| 1394 | if(getPlayer()->getHasLost()) |
| 1395 | return; |
| 1396 | if(getNbRooms(RoomType::library) <= 0) |
| 1397 | return; |
| 1398 | |
| 1399 | getPlayer()->notifyNoSkillInQueue(); |
| 1400 | return; |
| 1401 | } |
| 1402 | |
| 1403 | // We search for the first pending skill we don't own a corresponding SkillEntity |
| 1404 | SkillType skillType = SkillType::nullSkillType; |
| 1405 | for(SkillType pending : mSkillPending) |
| 1406 | { |
| 1407 | if(pending == skilledType) |
| 1408 | continue; |
| 1409 | |
| 1410 | skillType = pending; |
| 1411 | |
| 1412 | if(skillType != SkillType::nullSkillType) |
| 1413 | break; |
| 1414 | } |
| 1415 | |
| 1416 | if(skillType == SkillType::nullSkillType) |
| 1417 | { |
| 1418 | mCurrentSkillType = SkillType::nullSkillType; |
| 1419 | return; |
| 1420 | } |
| 1421 | |
| 1422 | // We have found a fitting skill. We retrieve the corresponding Skill |
| 1423 | // object and start working on that |
| 1424 | mCurrentSkill = SkillManager::getSkill(skillType); |
| 1425 | if(mCurrentSkill == nullptr) |
| 1426 | { |
| 1427 | mCurrentSkillType = SkillType::nullSkillType; |
| 1428 | return; |
| 1429 | } |
| 1430 | |
| 1431 | mCurrentSkillType = mCurrentSkill->getType(); |
| 1432 | mCurrentSkillProgress = static_cast<float>(mSkillPoints) / static_cast<float>(mCurrentSkill->getNeededSkillPoints()); |
| 1433 | } |
nothing calls this directly
no test coverage detected