2017-07-13 11:26:03 +03:00
|
|
|
/*
|
|
|
|
* CEmptyAI.cpp, part of VCMI engine
|
|
|
|
*
|
|
|
|
* Authors: listed in file AUTHORS in main folder
|
|
|
|
*
|
|
|
|
* License: GNU General Public License v2.0 or later
|
|
|
|
* Full text of license available in license.txt file, in main folder
|
|
|
|
*
|
|
|
|
*/
|
2011-12-13 21:23:17 +00:00
|
|
|
#include "StdInc.h"
|
2007-10-16 22:41:45 +00:00
|
|
|
#include "CEmptyAI.h"
|
2011-12-13 21:23:17 +00:00
|
|
|
|
2014-04-18 18:45:47 +02:00
|
|
|
#include "../../lib/CRandomGenerator.h"
|
2014-04-10 19:11:09 +02:00
|
|
|
|
2015-12-29 05:43:33 +03:00
|
|
|
void CEmptyAI::init(std::shared_ptr<CCallback> CB)
|
2007-10-21 16:45:13 +00:00
|
|
|
{
|
|
|
|
cb = CB;
|
|
|
|
human=false;
|
2013-02-11 17:23:55 +00:00
|
|
|
playerID = *cb->getMyColor();
|
2007-10-21 16:45:13 +00:00
|
|
|
}
|
2007-10-16 22:41:45 +00:00
|
|
|
void CEmptyAI::yourTurn()
|
|
|
|
{
|
2008-07-27 17:07:37 +00:00
|
|
|
cb->endTurn();
|
2007-10-16 22:41:45 +00:00
|
|
|
}
|
2012-07-15 15:34:00 +00:00
|
|
|
|
2013-05-27 14:20:46 +00:00
|
|
|
void CEmptyAI::heroGotLevel(const CGHeroInstance *hero, PrimarySkill::PrimarySkill pskill, std::vector<SecondarySkill> &skills, QueryID queryID)
|
2007-10-16 22:41:45 +00:00
|
|
|
{
|
2014-04-10 19:11:09 +02:00
|
|
|
cb->selectionMade(CRandomGenerator::getDefault().nextInt(skills.size() - 1), queryID);
|
2007-10-16 22:41:45 +00:00
|
|
|
}
|
2012-06-01 15:59:26 +00:00
|
|
|
|
2013-05-27 14:20:46 +00:00
|
|
|
void CEmptyAI::commanderGotLevel(const CCommanderInstance * commander, std::vector<ui32> skills, QueryID queryID)
|
2007-10-16 22:41:45 +00:00
|
|
|
{
|
2014-04-10 19:11:09 +02:00
|
|
|
cb->selectionMade(CRandomGenerator::getDefault().nextInt(skills.size() - 1), queryID);
|
2007-10-16 22:41:45 +00:00
|
|
|
}
|
2012-06-01 15:59:26 +00:00
|
|
|
|
2013-05-27 14:20:46 +00:00
|
|
|
void CEmptyAI::showBlockingDialog(const std::string &text, const std::vector<Component> &components, QueryID askID, const int soundID, bool selection, bool cancel)
|
2007-10-16 22:41:45 +00:00
|
|
|
{
|
2012-06-01 15:59:26 +00:00
|
|
|
cb->selectionMade(0, askID);
|
2008-08-13 00:44:31 +00:00
|
|
|
}
|
2012-06-01 15:59:26 +00:00
|
|
|
|
2015-11-28 02:41:30 +03:00
|
|
|
void CEmptyAI::showTeleportDialog(TeleportChannelID channel, TTeleportExitsList exits, bool impassable, QueryID askID)
|
2015-03-08 16:52:50 +03:00
|
|
|
{
|
|
|
|
cb->selectionMade(0, askID);
|
|
|
|
}
|
|
|
|
|
2013-05-27 14:20:46 +00:00
|
|
|
void CEmptyAI::showGarrisonDialog(const CArmedInstance *up, const CGHeroInstance *down, bool removableUnits, QueryID queryID)
|
2008-08-13 00:44:31 +00:00
|
|
|
{
|
2012-07-15 15:34:00 +00:00
|
|
|
cb->selectionMade(0, queryID);
|
2013-04-11 15:58:01 +00:00
|
|
|
}
|
2017-06-06 07:53:51 +03:00
|
|
|
|
|
|
|
void CEmptyAI::showMapObjectSelectDialog(QueryID askID, const Component & icon, const MetaString & title, const MetaString & description, const std::vector<ObjectInstanceID> & objects)
|
|
|
|
{
|
|
|
|
cb->selectionMade(0, askID);
|
|
|
|
}
|