diff --git a/config/objects/creatureBanks.json b/config/objects/creatureBanks.json index 6cba397be..e1ad6f6e9 100644 --- a/config/objects/creatureBanks.json +++ b/config/objects/creatureBanks.json @@ -526,7 +526,7 @@ "combat_value": 154, "reward" : { "value": 3200, - "creatures": [ { "amount": 4, "type": "vyvern" } ] + "creatures": [ { "amount": 4, "type": "wyvern" } ] } }, { @@ -541,7 +541,7 @@ "combat_value": 230, "reward" : { "value": 4800, - "creatures": [ { "amount": 6, "type": "vyvern" } ] + "creatures": [ { "amount": 6, "type": "wyvern" } ] } }, { @@ -556,7 +556,7 @@ "combat_value": 307, "reward" : { "value": 6400, - "creatures": [ { "amount": 8, "type": "vyvern" } ] + "creatures": [ { "amount": 8, "type": "wyvern" } ] } }, { @@ -571,7 +571,7 @@ "combat_value": 461, "reward" : { "value": 9600, - "creatures": [ { "amount": 12, "type": "vyvern" } ] + "creatures": [ { "amount": 12, "type": "wyvern" } ] } } ] diff --git a/lib/CGameState.cpp b/lib/CGameState.cpp index a5fe9923b..0a41eec3c 100644 --- a/lib/CGameState.cpp +++ b/lib/CGameState.cpp @@ -256,7 +256,7 @@ DLL_LINKAGE void MetaString::toString(std::string &dst) const boost::replace_first(dst, "%+d", '+' + boost::lexical_cast(numbers[nums++])); break; default: - logGlobal->errorStream() << "MetaString processing error!"; + logGlobal->errorStream() << "MetaString processing error! Received message of type " << int(elem); break; } } @@ -313,7 +313,7 @@ DLL_LINKAGE std::string MetaString::buildList () const lista.replace (lista.find("%d"), 2, boost::lexical_cast(numbers[nums++])); break; default: - logGlobal->errorStream() << "MetaString processing error!"; + logGlobal->errorStream() << "MetaString processing error! Received message of type " << int(message[i]); } } diff --git a/lib/mapObjects/CGHeroInstance.cpp b/lib/mapObjects/CGHeroInstance.cpp index 10464505b..96a98826c 100644 --- a/lib/mapObjects/CGHeroInstance.cpp +++ b/lib/mapObjects/CGHeroInstance.cpp @@ -473,9 +473,12 @@ void CGHeroInstance::initObj() skillsInfo.resetMagicSchoolCounter(); skillsInfo.resetWisdomCounter(); - auto customApp = VLC->objtypeh->getHandlerFor(ID, type->heroClass->id)->getOverride(cb->gameState()->getTile(visitablePos())->terType, this); - if (customApp) - appearance = customApp.get(); + if (ID != Obj::PRISON) + { + auto customApp = VLC->objtypeh->getHandlerFor(ID, type->heroClass->id)->getOverride(cb->gameState()->getTile(visitablePos())->terType, this); + if (customApp) + appearance = customApp.get(); + } for(const auto &spec : type->spec) //TODO: unfity with bonus system { diff --git a/lib/mapObjects/CRewardableObject.cpp b/lib/mapObjects/CRewardableObject.cpp index 4b8561e48..482d82bfa 100644 --- a/lib/mapObjects/CRewardableObject.cpp +++ b/lib/mapObjects/CRewardableObject.cpp @@ -78,6 +78,7 @@ std::vector CRewardableObject::getAvailableRewards(const CGHeroInstance * if (visit.numOfGrants < visit.limiter.numOfGrants && visit.limiter.heroAllowed(hero)) { + logGlobal->debugStream() << "Reward " << i << " is allowed"; ret.push_back(i); } } @@ -88,7 +89,7 @@ void CRewardableObject::onHeroVisit(const CGHeroInstance *h) const { auto grantRewardWithMessage = [&](int index) -> void { - grantReward(index, h); + logGlobal->debugStream() << "Granting reward " << index << ". Message says: " << info[index].message.toString(); // show message only if it is not empty if (!info[index].message.toString().empty()) { @@ -99,6 +100,8 @@ void CRewardableObject::onHeroVisit(const CGHeroInstance *h) const info[index].reward.loadComponents(iw.components); cb->showInfoDialog(&iw); } + // grant reward afterwards. Note that it may remove object + grantReward(index, h); }; auto selectRewardsMessage = [&](std::vector rewards) -> void { @@ -114,6 +117,7 @@ void CRewardableObject::onHeroVisit(const CGHeroInstance *h) const if (!wasVisited(h)) { auto rewards = getAvailableRewards(h); + logGlobal->debugStream() << "Visiting object with " << rewards.size() << " possible rewards"; switch (rewards.size()) { case 0: // no available rewards, e.g. empty flotsam @@ -155,6 +159,7 @@ void CRewardableObject::onHeroVisit(const CGHeroInstance *h) const } else { + logGlobal->debugStream() << "Revisiting already visited object"; InfoWindow iw; iw.player = h->tempOwner; iw.soundID = soundID; diff --git a/lib/registerTypes/RegisterTypes.h b/lib/registerTypes/RegisterTypes.h index 8bf37da4d..8f44d5446 100644 --- a/lib/registerTypes/RegisterTypes.h +++ b/lib/registerTypes/RegisterTypes.h @@ -97,6 +97,7 @@ void registerTypesMapObjectTypes(Serializer &s) REGISTER_GENERIC_HANDLER(CGBorderGuard); REGISTER_GENERIC_HANDLER(CGCreature); REGISTER_GENERIC_HANDLER(CGDenOfthieves); + REGISTER_GENERIC_HANDLER(CGDwelling); REGISTER_GENERIC_HANDLER(CGEvent); REGISTER_GENERIC_HANDLER(CGGarrison); REGISTER_GENERIC_HANDLER(CGHeroPlaceholder); @@ -122,6 +123,7 @@ void registerTypesMapObjectTypes(Serializer &s) REGISTER_GENERIC_HANDLER(CGSignBottle); REGISTER_GENERIC_HANDLER(CGSirens); REGISTER_GENERIC_HANDLER(CGTeleport); + REGISTER_GENERIC_HANDLER(CGTownInstance); REGISTER_GENERIC_HANDLER(CGUniversity); REGISTER_GENERIC_HANDLER(CGVisitableOPH); REGISTER_GENERIC_HANDLER(CGVisitableOPW);