From 2bf8cdc9f525099348439c700af0466955f01b30 Mon Sep 17 00:00:00 2001 From: nordsoft Date: Fri, 13 Oct 2023 12:52:45 +0200 Subject: [PATCH] Hota-related bugs were fixed --- lib/mapObjects/CQuest.cpp | 16 ++++++++++------ lib/mapping/MapFormatH3M.cpp | 1 + lib/rewardable/Limiter.cpp | 2 +- 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/lib/mapObjects/CQuest.cpp b/lib/mapObjects/CQuest.cpp index 51d0d1ead..29f18e9da 100644 --- a/lib/mapObjects/CQuest.cpp +++ b/lib/mapObjects/CQuest.cpp @@ -60,7 +60,7 @@ static std::string visitedTxt(const bool visited) const std::string & CQuest::missionName(int mission) { - static const std::array names = { + static const std::array names = { "empty", "heroLevel", "primarySkill", @@ -71,7 +71,9 @@ const std::string & CQuest::missionName(int mission) "bringResources", "bringHero", "bringPlayer", - "keymaster" + "keymaster", + "hota", + "other" }; if(static_cast(mission) < names.size()) @@ -299,6 +301,7 @@ void CQuest::defineQuestName() { //standard quests questName = CQuest::missionName(0); + if(mission != Rewardable::Limiter{}) questName = CQuest::missionName(12); if(mission.heroLevel > 0) questName = CQuest::missionName(1); for(auto & s : mission.primary) if(s) questName = CQuest::missionName(2); if(!mission.spells.empty()) questName = CQuest::missionName(2); @@ -310,6 +313,7 @@ void CQuest::defineQuestName() if(mission.resources.nonZero()) questName = CQuest::missionName(7); if(!mission.heroes.empty()) questName = CQuest::missionName(8); if(!mission.players.empty()) questName = CQuest::missionName(9); + if(mission.daysPassed > 0 || !mission.heroClasses.empty()) questName = CQuest::missionName(11); } void CQuest::addKillTargetReplacements(MetaString &out) const @@ -425,10 +429,6 @@ void CGSeerHut::setObjToKill() quest->heroName = getHeroToKill(false)->getNameTranslated(); quest->heroPortrait = getHeroToKill(false)->getPortraitSource(); } - - quest->getCompletionText(configuration.onSelect); - for(auto & i : configuration.info) - quest->getCompletionText(i.message); } void CGSeerHut::init(CRandomGenerator & rand) @@ -470,6 +470,10 @@ void CGSeerHut::initObj(CRandomGenerator & rand) if(!quest->isCustomComplete) quest->completedText.appendTextID(TextIdentifier("core", "seerhut", "quest", quest-> questName, quest->missionState(2), quest->textOption).get()); } + + quest->getCompletionText(configuration.onSelect); + for(auto & i : configuration.info) + quest->getCompletionText(i.message); } void CGSeerHut::getRolloverText(MetaString &text, bool onHover) const diff --git a/lib/mapping/MapFormatH3M.cpp b/lib/mapping/MapFormatH3M.cpp index 112511213..f1b15605f 100644 --- a/lib/mapping/MapFormatH3M.cpp +++ b/lib/mapping/MapFormatH3M.cpp @@ -1830,6 +1830,7 @@ CGObjectInstance * CMapLoaderH3M::readSeerHut(const int3 & position, const Objec if(features.levelHOTA3) { uint32_t repeateableQuestsCount = reader->readUInt32(); + hut->quest->repeatedQuest = repeateableQuestsCount != 0; if(repeateableQuestsCount != 0) logGlobal->warn("Map '%s': Seer Hut at %s - %d repeatable quests are not implemented!", mapName, position.toString(), repeateableQuestsCount); diff --git a/lib/rewardable/Limiter.cpp b/lib/rewardable/Limiter.cpp index b23c50610..b5c5f9384 100644 --- a/lib/rewardable/Limiter.cpp +++ b/lib/rewardable/Limiter.cpp @@ -72,7 +72,7 @@ bool Rewardable::Limiter::heroAllowed(const CGHeroInstance * hero) const if(daysPassed != 0) { - if (IObjectInterface::cb->getDate(Date::DAY) < daysPassed) + if (IObjectInterface::cb->getDate(Date::DAY) <= daysPassed) return false; }