CEmptyAI.cpp 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  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::saveGame(BinarySerializer & h, const int version)
  14. {
  15. }
  16. void CEmptyAI::loadGame(BinaryDeserializer & h, const int version)
  17. {
  18. }
  19. void CEmptyAI::init(std::shared_ptr<Environment> ENV, std::shared_ptr<CCallback> CB)
  20. {
  21. cb = CB;
  22. env = ENV;
  23. human=false;
  24. playerID = *cb->getMyColor();
  25. }
  26. void CEmptyAI::yourTurn()
  27. {
  28. cb->endTurn();
  29. }
  30. void CEmptyAI::heroGotLevel(const CGHeroInstance *hero, PrimarySkill::PrimarySkill pskill, std::vector<SecondarySkill> &skills, QueryID queryID)
  31. {
  32. cb->selectionMade(CRandomGenerator::getDefault().nextInt((int)skills.size() - 1), queryID);
  33. }
  34. void CEmptyAI::commanderGotLevel(const CCommanderInstance * commander, std::vector<ui32> skills, QueryID queryID)
  35. {
  36. cb->selectionMade(CRandomGenerator::getDefault().nextInt((int)skills.size() - 1), queryID);
  37. }
  38. void CEmptyAI::showBlockingDialog(const std::string &text, const std::vector<Component> &components, QueryID askID, const int soundID, bool selection, bool cancel)
  39. {
  40. cb->selectionMade(0, askID);
  41. }
  42. void CEmptyAI::showTeleportDialog(TeleportChannelID channel, TTeleportExitsList exits, bool impassable, QueryID askID)
  43. {
  44. cb->selectionMade(0, askID);
  45. }
  46. void CEmptyAI::showGarrisonDialog(const CArmedInstance *up, const CGHeroInstance *down, bool removableUnits, QueryID queryID)
  47. {
  48. cb->selectionMade(0, queryID);
  49. }
  50. void CEmptyAI::showMapObjectSelectDialog(QueryID askID, const Component & icon, const MetaString & title, const MetaString & description, const std::vector<ObjectInstanceID> & objects)
  51. {
  52. cb->selectionMade(0, askID);
  53. }