2017-06-24 15:51:07 +02:00
|
|
|
/*
|
|
|
|
* CCallbackBase.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
|
|
|
|
*
|
|
|
|
*/
|
2017-07-01 20:05:10 +02:00
|
|
|
#include "StdInc.h"
|
2017-06-24 15:51:07 +02:00
|
|
|
#include "CCallbackBase.h"
|
2017-07-20 06:08:49 +02:00
|
|
|
#include "IBattleState.h"
|
2017-06-24 15:51:07 +02:00
|
|
|
|
2022-07-26 15:07:42 +02:00
|
|
|
VCMI_LIB_NAMESPACE_BEGIN
|
|
|
|
|
2017-06-24 15:51:07 +02:00
|
|
|
bool CCallbackBase::duringBattle() const
|
|
|
|
{
|
|
|
|
return getBattle() != nullptr;
|
|
|
|
}
|
|
|
|
|
2017-07-20 06:08:49 +02:00
|
|
|
const IBattleInfo * CCallbackBase::getBattle() const
|
2017-06-24 15:51:07 +02:00
|
|
|
{
|
|
|
|
return battle;
|
|
|
|
}
|
|
|
|
|
2023-04-16 19:42:56 +02:00
|
|
|
CCallbackBase::CCallbackBase(std::optional<PlayerColor> Player):
|
2023-02-15 00:44:59 +02:00
|
|
|
player(std::move(Player))
|
|
|
|
{
|
|
|
|
}
|
2017-06-24 15:51:07 +02:00
|
|
|
|
2017-07-20 06:08:49 +02:00
|
|
|
void CCallbackBase::setBattle(const IBattleInfo * B)
|
2017-06-24 15:51:07 +02:00
|
|
|
{
|
|
|
|
battle = B;
|
|
|
|
}
|
|
|
|
|
2023-04-16 19:42:56 +02:00
|
|
|
std::optional<PlayerColor> CCallbackBase::getPlayerID() const
|
2017-06-24 15:51:07 +02:00
|
|
|
{
|
|
|
|
return player;
|
|
|
|
}
|
|
|
|
|
2022-07-26 15:07:42 +02:00
|
|
|
|
|
|
|
VCMI_LIB_NAMESPACE_END
|