From e2b49bbf79f9557dc7900402b12e02a167db973d Mon Sep 17 00:00:00 2001 From: Laserlicht <13953785+Laserlicht@users.noreply.github.com> Date: Mon, 30 Sep 2024 02:46:45 +0200 Subject: [PATCH] fix condition --- client/windows/CCastleInterface.cpp | 2 +- server/CGameHandler.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/client/windows/CCastleInterface.cpp b/client/windows/CCastleInterface.cpp index 95c01ce58..abb4fa036 100644 --- a/client/windows/CCastleInterface.cpp +++ b/client/windows/CCastleInterface.cpp @@ -2042,7 +2042,7 @@ void CMageGuildScreen::Scroll::clickPressed(const Point & cursorPosition) level = i; int today = LOCPLINT->cb->getDate(Date::DAY); - if(town->spellResearchActionsPerDay.find(today) == town->spellResearchActionsPerDay.end() || town->spellResearchActionsPerDay.at(today) >= LOCPLINT->cb->getSettings().getValue(EGameSettings::TOWNS_SPELL_RESEARCH_PER_DAY).Vector()[level].Float()) + if(town->spellResearchActionsPerDay.find(today) != town->spellResearchActionsPerDay.end() && town->spellResearchActionsPerDay.at(today) >= LOCPLINT->cb->getSettings().getValue(EGameSettings::TOWNS_SPELL_RESEARCH_PER_DAY).Vector()[level].Float()) { LOCPLINT->showInfoDialog(CGI->generaltexth->translate("vcmi.spellResearch.comeAgain")); return; diff --git a/server/CGameHandler.cpp b/server/CGameHandler.cpp index 44fe7e06d..8d1046398 100644 --- a/server/CGameHandler.cpp +++ b/server/CGameHandler.cpp @@ -2261,7 +2261,7 @@ bool CGameHandler::spellResearch(ObjectInstanceID tid, SpellID spellAtSlot, bool auto spells = t->spells.at(level); int today = getDate(Date::DAY); - bool researchLimitExceeded = t->spellResearchActionsPerDay.find(today) == t->spellResearchActionsPerDay.end() || t->spellResearchActionsPerDay.at(today) >= getSettings().getValue(EGameSettings::TOWNS_SPELL_RESEARCH_PER_DAY).Vector()[level].Float(); + bool researchLimitExceeded = t->spellResearchActionsPerDay.find(today) != t->spellResearchActionsPerDay.end() && t->spellResearchActionsPerDay.at(today) >= getSettings().getValue(EGameSettings::TOWNS_SPELL_RESEARCH_PER_DAY).Vector()[level].Float(); if(researchLimitExceeded && complain("Already researched today!")) return false;