2023-07-11 14:16:02 +02:00
|
|
|
/*
|
|
|
|
* HeroPoolProcessor.h, 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
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
VCMI_LIB_NAMESPACE_BEGIN
|
|
|
|
|
|
|
|
enum class TavernHeroSlot;
|
|
|
|
class PlayerColor;
|
|
|
|
class CGHeroInstance;
|
|
|
|
class HeroTypeID;
|
|
|
|
class CGObjectInstance;
|
2023-07-11 16:51:14 +02:00
|
|
|
class FactionID;
|
|
|
|
class CRandomGenerator;
|
|
|
|
class CHeroClass;
|
2023-07-11 14:16:02 +02:00
|
|
|
|
|
|
|
VCMI_LIB_NAMESPACE_END
|
|
|
|
|
|
|
|
class CGameHandler;
|
|
|
|
|
|
|
|
class HeroPoolProcessor : boost::noncopyable
|
|
|
|
{
|
|
|
|
CGameHandler * gameHandler;
|
|
|
|
|
2023-07-11 18:23:14 +02:00
|
|
|
/// per-player random generators
|
|
|
|
std::map<PlayerColor, CRandomGenerator> playerSeed;
|
|
|
|
|
2023-07-11 14:16:02 +02:00
|
|
|
void clearHeroFromSlot(const PlayerColor & color, TavernHeroSlot slot);
|
2023-07-11 16:51:14 +02:00
|
|
|
void selectNewHeroForSlot(const PlayerColor & color, TavernHeroSlot slot, bool needNativeHero, bool giveStartingArmy);
|
|
|
|
|
2023-07-11 17:49:19 +02:00
|
|
|
std::set<const CHeroClass *> findAvailableClassesFor(const PlayerColor & player) const;
|
|
|
|
std::set<CGHeroInstance *> findAvailableHeroesFor(const PlayerColor & player, const CHeroClass * heroClass) const;
|
|
|
|
|
2023-07-11 18:23:14 +02:00
|
|
|
const CHeroClass * pickClassFor(bool isNative, const PlayerColor & player);
|
|
|
|
|
|
|
|
CGHeroInstance * pickHeroFor(bool isNative, const PlayerColor & player);
|
2023-07-11 17:49:19 +02:00
|
|
|
|
2023-07-11 18:23:14 +02:00
|
|
|
CRandomGenerator & getRandomGenerator(const PlayerColor & player);
|
2023-07-11 14:16:02 +02:00
|
|
|
public:
|
|
|
|
HeroPoolProcessor();
|
|
|
|
HeroPoolProcessor(CGameHandler * gameHandler);
|
|
|
|
|
|
|
|
void onHeroSurrendered(const PlayerColor & color, const CGHeroInstance * hero);
|
|
|
|
void onHeroEscaped(const PlayerColor & color, const CGHeroInstance * hero);
|
|
|
|
|
|
|
|
void onNewWeek(const PlayerColor & color);
|
|
|
|
|
|
|
|
bool hireHero(const CGObjectInstance *obj, const HeroTypeID & hid, const PlayerColor & player);
|
|
|
|
|
|
|
|
template <typename Handler> void serialize(Handler &h, const int version)
|
|
|
|
{
|
|
|
|
h & gameHandler;
|
2023-07-11 18:23:14 +02:00
|
|
|
h & playerSeed;
|
2023-07-11 14:16:02 +02:00
|
|
|
}
|
|
|
|
};
|