2
0

CEmptyAI.cpp 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. #include "StdInc.h"
  2. #include "CEmptyAI.h"
  3. #include "../../lib/CRandomGenerator.h"
  4. void CEmptyAI::init(std::shared_ptr<CCallback> CB)
  5. {
  6. cb = CB;
  7. human=false;
  8. playerID = *cb->getMyColor();
  9. }
  10. void CEmptyAI::yourTurn()
  11. {
  12. cb->endTurn();
  13. }
  14. void CEmptyAI::heroGotLevel(const CGHeroInstance *hero, PrimarySkill::PrimarySkill pskill, std::vector<SecondarySkill> &skills, QueryID queryID)
  15. {
  16. cb->selectionMade(CRandomGenerator::getDefault().nextInt(skills.size() - 1), queryID);
  17. }
  18. void CEmptyAI::commanderGotLevel(const CCommanderInstance * commander, std::vector<ui32> skills, QueryID queryID)
  19. {
  20. cb->selectionMade(CRandomGenerator::getDefault().nextInt(skills.size() - 1), queryID);
  21. }
  22. void CEmptyAI::showBlockingDialog(const std::string &text, const std::vector<Component> &components, QueryID askID, const int soundID, bool selection, bool cancel)
  23. {
  24. cb->selectionMade(0, askID);
  25. }
  26. void CEmptyAI::showTeleportDialog(TeleportChannelID channel, TTeleportExitsList exits, bool impassable, QueryID askID)
  27. {
  28. cb->selectionMade(0, askID);
  29. }
  30. void CEmptyAI::showGarrisonDialog(const CArmedInstance *up, const CGHeroInstance *down, bool removableUnits, QueryID queryID)
  31. {
  32. cb->selectionMade(0, queryID);
  33. }