CEmptyAI.cpp 2.2 KB

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