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