CEmptyAI.cpp 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. /*
  2. * CEmptyAI.cpp, part of VCMI engine
  3. *
  4. * Authors: listed in file AUTHORS in main folder
  5. *
  6. * License: GNU General Public License v2.0 or later
  7. * Full text of license available in license.txt file, in main folder
  8. *
  9. */
  10. #include "StdInc.h"
  11. #include "CEmptyAI.h"
  12. #include "../../lib/CRandomGenerator.h"
  13. void CEmptyAI::init(std::shared_ptr<CCallback> CB)
  14. {
  15. cb = CB;
  16. human=false;
  17. playerID = *cb->getMyColor();
  18. }
  19. void CEmptyAI::yourTurn()
  20. {
  21. cb->endTurn();
  22. }
  23. void CEmptyAI::heroGotLevel(const CGHeroInstance *hero, PrimarySkill::PrimarySkill pskill, std::vector<SecondarySkill> &skills, QueryID queryID)
  24. {
  25. cb->selectionMade(CRandomGenerator::getDefault().nextInt((int)skills.size() - 1), queryID);
  26. }
  27. void CEmptyAI::commanderGotLevel(const CCommanderInstance * commander, std::vector<ui32> skills, QueryID queryID)
  28. {
  29. cb->selectionMade(CRandomGenerator::getDefault().nextInt((int)skills.size() - 1), queryID);
  30. }
  31. void CEmptyAI::showBlockingDialog(const std::string &text, const std::vector<Component> &components, QueryID askID, const int soundID, bool selection, bool cancel)
  32. {
  33. cb->selectionMade(0, askID);
  34. }
  35. void CEmptyAI::showTeleportDialog(TeleportChannelID channel, TTeleportExitsList exits, bool impassable, QueryID askID)
  36. {
  37. cb->selectionMade(0, askID);
  38. }
  39. void CEmptyAI::showGarrisonDialog(const CArmedInstance *up, const CGHeroInstance *down, bool removableUnits, QueryID queryID)
  40. {
  41. cb->selectionMade(0, queryID);
  42. }
  43. void CEmptyAI::showMapObjectSelectDialog(QueryID askID, const Component & icon, const MetaString & title, const MetaString & description, const std::vector<ObjectInstanceID> & objects)
  44. {
  45. cb->selectionMade(0, askID);
  46. }