CEmptyAI.cpp 1.3 KB

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