mirror of
https://github.com/vcmi/vcmi.git
synced 2025-11-27 22:49:25 +02:00
[Refactoring] use virtual method for object specific actions when new map object is created
* --TODO * fixes CID 1366291, CID 1366297
This commit is contained in:
@@ -25,6 +25,7 @@
|
||||
#include "../GameConstants.h"
|
||||
#include "../StringConstants.h"
|
||||
#include "../spells/CSpellHandler.h"
|
||||
#include "../mapping/CMap.h"
|
||||
|
||||
|
||||
std::map <PlayerColor, std::set <ui8> > CGKeys::playerKeyMap;
|
||||
@@ -599,6 +600,11 @@ void IQuestObject::getVisitText (MetaString &text, std::vector<Component> &compo
|
||||
quest->getVisitText (text,components, isCustom, FirstVisit, h);
|
||||
}
|
||||
|
||||
void IQuestObject::afterAddToMapCommon(CMap * map)
|
||||
{
|
||||
map->addNewQuestInstance(quest);
|
||||
}
|
||||
|
||||
void CGSeerHut::getCompletionText(MetaString &text, std::vector<Component> &components, bool isCustom, const CGHeroInstance * h) const
|
||||
{
|
||||
quest->getCompletionText (text, components, isCustom, h);
|
||||
@@ -849,6 +855,11 @@ void CGSeerHut::blockingDialogAnswered(const CGHeroInstance *hero, ui32 answer)
|
||||
finishQuest(hero, answer);
|
||||
}
|
||||
|
||||
void CGSeerHut::afterAddToMap(CMap* map)
|
||||
{
|
||||
IQuestObject::afterAddToMapCommon(map);
|
||||
}
|
||||
|
||||
void CGSeerHut::serializeJsonOptions(JsonSerializeFormat & handler)
|
||||
{
|
||||
static const std::map<ERewardType, std::string> REWARD_MAP =
|
||||
@@ -1128,6 +1139,11 @@ void CGBorderGuard::blockingDialogAnswered(const CGHeroInstance *hero, ui32 answ
|
||||
cb->removeObject(this);
|
||||
}
|
||||
|
||||
void CGBorderGuard::afterAddToMap(CMap * map)
|
||||
{
|
||||
IQuestObject::afterAddToMapCommon(map);
|
||||
}
|
||||
|
||||
void CGBorderGate::onHeroVisit(const CGHeroInstance * h) const //TODO: passability
|
||||
{
|
||||
if (!wasMyColorVisited (h->getOwner()) )
|
||||
|
||||
Reference in New Issue
Block a user