mirror of
https://github.com/vcmi/vcmi.git
synced 2025-08-13 19:54:17 +02:00
Partial garrison support, battles are played out and the object gets flagged.
This commit is contained in:
@@ -3497,6 +3497,27 @@ void CGScholar::initObj()
|
||||
}
|
||||
}
|
||||
|
||||
void CGGarrison::onHeroVisit (const CGHeroInstance *h) const
|
||||
{
|
||||
if (h->tempOwner != tempOwner && army) {
|
||||
//TODO: Find a way to apply magic garrison effects in battle.
|
||||
cb->startBattleI(h, this, false, boost::bind(&CGGarrison::fightOver, this, h, _1));
|
||||
return;
|
||||
}
|
||||
|
||||
//New owner.
|
||||
if (h->tempOwner != tempOwner)
|
||||
cb->setOwner(id, h->tempOwner);
|
||||
|
||||
//TODO: Garrison visit screen.
|
||||
}
|
||||
|
||||
void CGGarrison::fightOver (const CGHeroInstance *h, BattleResult *result) const
|
||||
{
|
||||
if (result->winner == 0)
|
||||
onHeroVisit(h);
|
||||
}
|
||||
|
||||
void CGOnceVisitable::onHeroVisit( const CGHeroInstance * h ) const
|
||||
{
|
||||
int sound = 0;
|
||||
|
@@ -602,6 +602,9 @@ class DLL_EXPORT CGGarrison : public CArmedInstance
|
||||
public:
|
||||
ui8 removableUnits;
|
||||
|
||||
void onHeroVisit (const CGHeroInstance *h) const;
|
||||
void fightOver (const CGHeroInstance *h, BattleResult *result) const;
|
||||
|
||||
template <typename Handler> void serialize(Handler &h, const int version)
|
||||
{
|
||||
h & static_cast<CArmedInstance&>(*this);
|
||||
|
Reference in New Issue
Block a user