diff --git a/AI/BattleAI/AttackPossibility.cpp b/AI/BattleAI/AttackPossibility.cpp index c22b7ccad..c55de09b2 100644 --- a/AI/BattleAI/AttackPossibility.cpp +++ b/AI/BattleAI/AttackPossibility.cpp @@ -58,7 +58,7 @@ void DamageCache::buildObstacleDamageCache(std::shared_ptr hb, return u->alive() && !u->isTurret() && u->getPosition().isValid(); }); - std::shared_ptr inner = std::make_shared(hb->env, hb); + auto inner = std::make_shared(hb->env, hb); for(auto stack : stacks) { diff --git a/AI/Nullkiller/AIGateway.cpp b/AI/Nullkiller/AIGateway.cpp index 99172b213..d8d5e8aed 100644 --- a/AI/Nullkiller/AIGateway.cpp +++ b/AI/Nullkiller/AIGateway.cpp @@ -649,12 +649,12 @@ void AIGateway::showBlockingDialog(const std::string & text, const std::vectordangerEvaluator->evaluateDanger(target, hero.get()); auto ratio = static_cast(danger) / hero->getTotalStrength(); - answer = 1; + answer = true; if(topObj->id != goalObjectID && nullkiller->dangerEvaluator->evaluateDanger(topObj) > 0) { // no if we do not aim to visit this object - answer = 0; + answer = false; } logAi->trace("Query hook: %s(%s) by %s danger ratio %f", target.toString(), topObj->getObjectName(), hero.name(), ratio); diff --git a/AI/Nullkiller/Pathfinding/AIPathfinderConfig.cpp b/AI/Nullkiller/Pathfinding/AIPathfinderConfig.cpp index 98bcddcec..7bb43fabb 100644 --- a/AI/Nullkiller/Pathfinding/AIPathfinderConfig.cpp +++ b/AI/Nullkiller/Pathfinding/AIPathfinderConfig.cpp @@ -13,7 +13,7 @@ #include "Rules/AIMovementAfterDestinationRule.h" #include "Rules/AIMovementToDestinationRule.h" #include "Rules/AIPreviousNodeRule.h" -#include "../Engine//Nullkiller.h" +#include "../Engine/Nullkiller.h" #include "../../../lib/pathfinder/CPathfinder.h" diff --git a/AI/Nullkiller/Pathfinding/Actors.cpp b/AI/Nullkiller/Pathfinding/Actors.cpp index ae6b6446e..2c1a35ec0 100644 --- a/AI/Nullkiller/Pathfinding/Actors.cpp +++ b/AI/Nullkiller/Pathfinding/Actors.cpp @@ -182,7 +182,7 @@ ExchangeResult HeroActor::tryExchangeNoLock(const ChainActor * specialActor, con return &actor == specialActor; }); - result.actor = &(dynamic_cast(result.actor)->specialActors[index]); + result.actor = &(dynamic_cast(result.actor)->specialActors.at(index)); return result; } diff --git a/AI/Nullkiller/Pathfinding/Actors.h b/AI/Nullkiller/Pathfinding/Actors.h index 4451bda24..1f653fbd3 100644 --- a/AI/Nullkiller/Pathfinding/Actors.h +++ b/AI/Nullkiller/Pathfinding/Actors.h @@ -113,7 +113,7 @@ public: static const int SPECIAL_ACTORS_COUNT = 7; private: - ChainActor specialActors[SPECIAL_ACTORS_COUNT]; + std::array specialActors; std::unique_ptr exchangeMap; void setupSpecialActors(); diff --git a/client/Client.h b/client/Client.h index f8c7eaf12..ce1276b06 100644 --- a/client/Client.h +++ b/client/Client.h @@ -158,7 +158,7 @@ public: friend class CBattleCallback; //handling players actions void changeSpells(const CGHeroInstance * hero, bool give, const std::set & spells) override {}; - void setResearchedSpells(const CGTownInstance * town, int level, const std::vector spells, bool accepted) override {}; + void setResearchedSpells(const CGTownInstance * town, int level, const std::vector & spells, bool accepted) override {}; bool removeObject(const CGObjectInstance * obj, const PlayerColor & initiator) override {return false;}; void createBoat(const int3 & visitablePosition, BoatId type, PlayerColor initiator) override {}; void setOwner(const CGObjectInstance * obj, PlayerColor owner) override {}; diff --git a/client/PlayerLocalState.cpp b/client/PlayerLocalState.cpp index 69e8b1b5e..28d83fff4 100644 --- a/client/PlayerLocalState.cpp +++ b/client/PlayerLocalState.cpp @@ -24,7 +24,7 @@ PlayerLocalState::PlayerLocalState(CPlayerInterface & owner) { } -const PlayerSpellbookSetting & PlayerLocalState::getSpellbookSettings() +const PlayerSpellbookSetting & PlayerLocalState::getSpellbookSettings() const { return spellbookSettings; } diff --git a/client/PlayerLocalState.h b/client/PlayerLocalState.h index 0cfda1f7a..3372b6052 100644 --- a/client/PlayerLocalState.h +++ b/client/PlayerLocalState.h @@ -55,7 +55,7 @@ public: void setHeroAsleep(const CGHeroInstance * hero); void setHeroAwaken(const CGHeroInstance * hero); - const PlayerSpellbookSetting & getSpellbookSettings(); + const PlayerSpellbookSetting & getSpellbookSettings() const; void setSpellbookSettings(const PlayerSpellbookSetting & newSettings); const std::vector & getOwnedTowns(); diff --git a/client/media/CVideoHandler.cpp b/client/media/CVideoHandler.cpp index b13c2dfc0..b028e8c57 100644 --- a/client/media/CVideoHandler.cpp +++ b/client/media/CVideoHandler.cpp @@ -545,7 +545,7 @@ std::pair, si64> CAudioInstance::extractAudio(const Vide frameSamplesBuffer.resize(std::max(frameSamplesBuffer.size(), bytesToRead)); uint8_t * frameSamplesPtr = frameSamplesBuffer.data(); - int result = swr_convert(swr_ctx, &frameSamplesPtr, frame->nb_samples, (const uint8_t **)frame->data, frame->nb_samples); + int result = swr_convert(swr_ctx, &frameSamplesPtr, frame->nb_samples, const_cast(frame->data), frame->nb_samples); if (result < 0) throwFFmpegError(result); diff --git a/client/render/AssetGenerator.cpp b/client/render/AssetGenerator.cpp index 3d0d346e2..d887528e0 100644 --- a/client/render/AssetGenerator.cpp +++ b/client/render/AssetGenerator.cpp @@ -158,7 +158,7 @@ void AssetGenerator::createPlayerColoredBackground(const PlayerColor & player) assert(player.isValidPlayer()); if (!player.isValidPlayer()) { - logGlobal->error("Unable to colorize to invalid player color %d!", static_cast(player.getNum())); + logGlobal->error("Unable to colorize to invalid player color %d!", player.getNum()); return; } diff --git a/client/renderSDL/CTrueTypeFont.cpp b/client/renderSDL/CTrueTypeFont.cpp index dcf3661d6..ddff8347e 100644 --- a/client/renderSDL/CTrueTypeFont.cpp +++ b/client/renderSDL/CTrueTypeFont.cpp @@ -64,9 +64,9 @@ int CTrueTypeFont::getFontStyle(const JsonNode &config) const CTrueTypeFont::CTrueTypeFont(const JsonNode & fontConfig): data(loadData(fontConfig)), font(loadFont(fontConfig), TTF_CloseFont), - dropShadow(!fontConfig["noShadow"].Bool()), + blended(true), outline(fontConfig["outline"].Bool()), - blended(true) + dropShadow(!fontConfig["noShadow"].Bool()) { assert(font); @@ -95,14 +95,14 @@ size_t CTrueTypeFont::getLineHeightScaled() const return TTF_FontHeight(font.get()); } -size_t CTrueTypeFont::getGlyphWidthScaled(const char *data) const +size_t CTrueTypeFont::getGlyphWidthScaled(const char *text) const { - return getStringWidthScaled(std::string(data, TextOperations::getUnicodeCharacterSize(*data))); + return getStringWidthScaled(std::string(text, TextOperations::getUnicodeCharacterSize(*text))); } -bool CTrueTypeFont::canRepresentCharacter(const char * data) const +bool CTrueTypeFont::canRepresentCharacter(const char * text) const { - uint32_t codepoint = TextOperations::getUnicodeCodepoint(data, TextOperations::getUnicodeCharacterSize(*data)); + uint32_t codepoint = TextOperations::getUnicodeCodepoint(text, TextOperations::getUnicodeCharacterSize(*text)); #if SDL_TTF_VERSION_ATLEAST(2, 0, 18) return TTF_GlyphIsProvided32(font.get(), codepoint); #elif SDL_TTF_VERSION_ATLEAST(2, 0, 12) @@ -114,10 +114,10 @@ bool CTrueTypeFont::canRepresentCharacter(const char * data) const #endif } -size_t CTrueTypeFont::getStringWidthScaled(const std::string & data) const +size_t CTrueTypeFont::getStringWidthScaled(const std::string & text) const { int width; - TTF_SizeUTF8(font.get(), data.c_str(), &width, nullptr); + TTF_SizeUTF8(font.get(), text.c_str(), &width, nullptr); return width; } diff --git a/client/widgets/TextControls.cpp b/client/widgets/TextControls.cpp index 8975fd469..2fa440955 100644 --- a/client/widgets/TextControls.cpp +++ b/client/widgets/TextControls.cpp @@ -309,7 +309,7 @@ void CMultiLineLabel::splitText(const std::string & Txt, bool redrawAfter) lines.clear(); const auto & fontPtr = GH.renderHandler().loadFont(font); - int lineHeight = static_cast(fontPtr->getLineHeight()); + int lineHeight = fontPtr->getLineHeight(); lines = CMessage::breakText(Txt, pos.w, font); @@ -330,16 +330,16 @@ Rect CMultiLineLabel::getTextLocation() return pos; const auto & fontPtr = GH.renderHandler().loadFont(font); - Point textSize(pos.w, fontPtr->getLineHeight() * (int)lines.size()); - Point textOffset(pos.w - textSize.x, pos.h - textSize.y); + Point textSizeComputed(pos.w, fontPtr->getLineHeight() * lines.size()); //FIXME: how is this different from textSize member? + Point textOffset(pos.w - textSizeComputed.x, pos.h - textSizeComputed.y); switch(alignment) { - case ETextAlignment::TOPLEFT: return Rect(pos.topLeft(), textSize); - case ETextAlignment::TOPCENTER: return Rect(pos.topLeft(), textSize); - case ETextAlignment::CENTER: return Rect(pos.topLeft() + textOffset / 2, textSize); - case ETextAlignment::CENTERRIGHT: return Rect(pos.topLeft() + Point(textOffset.x, textOffset.y / 2), textSize); - case ETextAlignment::BOTTOMRIGHT: return Rect(pos.topLeft() + textOffset, textSize); + case ETextAlignment::TOPLEFT: return Rect(pos.topLeft(), textSizeComputed); + case ETextAlignment::TOPCENTER: return Rect(pos.topLeft(), textSizeComputed); + case ETextAlignment::CENTER: return Rect(pos.topLeft() + textOffset / 2, textSizeComputed); + case ETextAlignment::CENTERRIGHT: return Rect(pos.topLeft() + Point(textOffset.x, textOffset.y / 2), textSizeComputed); + case ETextAlignment::BOTTOMRIGHT: return Rect(pos.topLeft() + textOffset, textSizeComputed); } assert(0); return Rect(); diff --git a/client/windows/CCastleInterface.cpp b/client/windows/CCastleInterface.cpp index aea486688..28984167b 100644 --- a/client/windows/CCastleInterface.cpp +++ b/client/windows/CCastleInterface.cpp @@ -2007,10 +2007,10 @@ void CMageGuildScreen::updateSpells(ObjectInstanceID tID) const CGTownInstance * town = LOCPLINT->cb->getTown(townId); - for(size_t i=0; igetTown()->mageLevel; i++) + for(uint32_t i=0; igetTown()->mageLevel; i++) { - size_t spellCount = town->spellsAtLevel((int)i+1,false); //spell at level with -1 hmmm? - for(size_t j=0; jspellsAtLevel(i+1,false); //spell at level with -1 hmmm? + for(uint32_t j=0; jmageGuildLevel() && town->spells[i].size()>j) spells.push_back(std::make_shared(positions[i][j], town->spells[i][j].toSpell(), townId)); @@ -2063,30 +2063,26 @@ void CMageGuildScreen::Scroll::clickPressed(const Point & cursorPosition) resComps.push_back(std::make_shared(ComponentType::RESOURCE, i->resType, i->resVal, CComponent::ESize::medium)); } - auto showSpellResearchDialog = [this, resComps, town, cost, newSpell](){ - std::vector>> pom; - for(int i = 0; i < 3; i++) - pom.emplace_back(AnimationPath::builtin("settingsWindow/button80"), nullptr); + std::vector>> pom; + for(int i = 0; i < 3; i++) + pom.emplace_back(AnimationPath::builtin("settingsWindow/button80"), nullptr); - auto text = CGI->generaltexth->translate(LOCPLINT->cb->getResourceAmount().canAfford(cost) ? "vcmi.spellResearch.pay" : "vcmi.spellResearch.canNotAfford"); - boost::replace_first(text, "%SPELL1", spell->id.toSpell()->getNameTranslated()); - boost::replace_first(text, "%SPELL2", newSpell.toSpell()->getNameTranslated()); - auto temp = std::make_shared(text, LOCPLINT->playerID, resComps, pom); + auto text = CGI->generaltexth->translate(LOCPLINT->cb->getResourceAmount().canAfford(cost) ? "vcmi.spellResearch.pay" : "vcmi.spellResearch.canNotAfford"); + boost::replace_first(text, "%SPELL1", spell->id.toSpell()->getNameTranslated()); + boost::replace_first(text, "%SPELL2", newSpell.toSpell()->getNameTranslated()); + auto temp = std::make_shared(text, LOCPLINT->playerID, resComps, pom); - temp->buttons[0]->setOverlay(std::make_shared(ImagePath::builtin("spellResearch/accept"))); - temp->buttons[0]->addCallback([this, town](){ LOCPLINT->cb->spellResearch(town, spell->id, true); }); - temp->buttons[0]->addPopupCallback([](){ CRClickPopup::createAndPush(CGI->generaltexth->translate("vcmi.spellResearch.research")); }); - temp->buttons[0]->setEnabled(LOCPLINT->cb->getResourceAmount().canAfford(cost)); - temp->buttons[1]->setOverlay(std::make_shared(ImagePath::builtin("spellResearch/reroll"))); - temp->buttons[1]->addCallback([this, town](){ LOCPLINT->cb->spellResearch(town, spell->id, false); }); - temp->buttons[1]->addPopupCallback([](){ CRClickPopup::createAndPush(CGI->generaltexth->translate("vcmi.spellResearch.skip")); }); - temp->buttons[2]->setOverlay(std::make_shared(ImagePath::builtin("spellResearch/close"))); - temp->buttons[2]->addPopupCallback([](){ CRClickPopup::createAndPush(CGI->generaltexth->translate("vcmi.spellResearch.abort")); }); + temp->buttons[0]->setOverlay(std::make_shared(ImagePath::builtin("spellResearch/accept"))); + temp->buttons[0]->addCallback([this, town](){ LOCPLINT->cb->spellResearch(town, spell->id, true); }); + temp->buttons[0]->addPopupCallback([](){ CRClickPopup::createAndPush(CGI->generaltexth->translate("vcmi.spellResearch.research")); }); + temp->buttons[0]->setEnabled(LOCPLINT->cb->getResourceAmount().canAfford(cost)); + temp->buttons[1]->setOverlay(std::make_shared(ImagePath::builtin("spellResearch/reroll"))); + temp->buttons[1]->addCallback([this, town](){ LOCPLINT->cb->spellResearch(town, spell->id, false); }); + temp->buttons[1]->addPopupCallback([](){ CRClickPopup::createAndPush(CGI->generaltexth->translate("vcmi.spellResearch.skip")); }); + temp->buttons[2]->setOverlay(std::make_shared(ImagePath::builtin("spellResearch/close"))); + temp->buttons[2]->addPopupCallback([](){ CRClickPopup::createAndPush(CGI->generaltexth->translate("vcmi.spellResearch.abort")); }); - GH.windows().pushWindow(temp); - }; - - showSpellResearchDialog(); + GH.windows().pushWindow(temp); } else LOCPLINT->showInfoDialog(spell->getDescriptionTranslated(0), std::make_shared(ComponentType::SPELL, spell->id)); diff --git a/client/windows/GUIClasses.cpp b/client/windows/GUIClasses.cpp index 46406d4d4..e8d89dfc4 100644 --- a/client/windows/GUIClasses.cpp +++ b/client/windows/GUIClasses.cpp @@ -1611,7 +1611,7 @@ void CObjectListWindow::keyPressed(EShortcut key) changeSelection(sel); } -VideoWindow::VideoWindow(VideoPath video, ImagePath rim, bool showBackground, float scaleFactor, std::function closeCb) +VideoWindow::VideoWindow(const VideoPath & video, const ImagePath & rim, bool showBackground, float scaleFactor, const std::function & closeCb) : CWindowObject(BORDERED | SHADOW_DISABLED | NEEDS_ANIMATED_BACKGROUND), closeCb(closeCb) { OBJECT_CONSTRUCTION; diff --git a/client/windows/GUIClasses.h b/client/windows/GUIClasses.h index 5e58ad6d2..883c812db 100644 --- a/client/windows/GUIClasses.h +++ b/client/windows/GUIClasses.h @@ -513,7 +513,7 @@ class VideoWindow : public CWindowObject void exit(bool skipped); public: - VideoWindow(VideoPath video, ImagePath rim, bool showBackground, float scaleFactor, std::function closeCb); + VideoWindow(const VideoPath & video, const ImagePath & rim, bool showBackground, float scaleFactor, const std::function & closeCb); void clickPressed(const Point & cursorPosition) override; void keyPressed(EShortcut key) override; diff --git a/client/windows/InfoWindows.cpp b/client/windows/InfoWindows.cpp index cabeeef13..2719c08d5 100644 --- a/client/windows/InfoWindows.cpp +++ b/client/windows/InfoWindows.cpp @@ -187,11 +187,6 @@ bool CRClickPopup::isPopupWindow() const return true; } -void CRClickPopup::close() -{ - WindowBase::close(); -} - void CRClickPopup::createAndPush(const std::string & txt, const CInfoWindow::TCompsInfo & comps) { PlayerColor player = LOCPLINT ? LOCPLINT->playerID : PlayerColor(1); //if no player, then use blue diff --git a/client/windows/InfoWindows.h b/client/windows/InfoWindows.h index a06416934..81b661339 100644 --- a/client/windows/InfoWindows.h +++ b/client/windows/InfoWindows.h @@ -64,7 +64,6 @@ public: class CRClickPopup : public WindowBase { public: - void close() override; bool isPopupWindow() const override; static std::shared_ptr createCustomInfoWindow(Point position, const CGObjectInstance * specific); diff --git a/lib/CPlayerState.cpp b/lib/CPlayerState.cpp index 2660377c6..069be91c1 100644 --- a/lib/CPlayerState.cpp +++ b/lib/CPlayerState.cpp @@ -22,9 +22,9 @@ VCMI_LIB_NAMESPACE_BEGIN PlayerState::PlayerState() : color(-1) - , playerLocalSettings(std::make_unique()) , human(false) , cheated(false) + , playerLocalSettings(std::make_unique()) , enteredWinningCheatCode(false) , enteredLosingCheatCode(false) , status(EPlayerStatus::INGAME) diff --git a/lib/IGameCallback.h b/lib/IGameCallback.h index fc1f104c3..1de95812d 100644 --- a/lib/IGameCallback.h +++ b/lib/IGameCallback.h @@ -94,7 +94,7 @@ public: virtual void showInfoDialog(InfoWindow * iw) = 0; virtual void changeSpells(const CGHeroInstance * hero, bool give, const std::set &spells)=0; - virtual void setResearchedSpells(const CGTownInstance * town, int level, const std::vector spells, bool accepted)=0; + virtual void setResearchedSpells(const CGTownInstance * town, int level, const std::vector & spells, bool accepted)=0; virtual bool removeObject(const CGObjectInstance * obj, const PlayerColor & initiator) = 0; virtual void createBoat(const int3 & visitablePosition, BoatId type, PlayerColor initiator) = 0; virtual void setOwner(const CGObjectInstance * objid, PlayerColor owner)=0; diff --git a/lib/json/JsonValidator.cpp b/lib/json/JsonValidator.cpp index 0114f113d..3cb89846f 100644 --- a/lib/json/JsonValidator.cpp +++ b/lib/json/JsonValidator.cpp @@ -74,7 +74,7 @@ static int getLevenshteinDistance(const std::string & s, const std::string & t) /// Searches for keys similar to 'target' in 'candidates' map /// Returns closest match or empty string if no suitable candidates are found -static std::string findClosestMatch(JsonMap candidates, std::string target) +static std::string findClosestMatch(const JsonMap & candidates, const std::string & target) { // Maximum distance at which we can consider strings to be similar // If strings have more different symbols than this number then it is not a typo, but a completely different word diff --git a/lib/modding/ContentTypeHandler.cpp b/lib/modding/ContentTypeHandler.cpp index 0a9acb0f4..efe2feeda 100644 --- a/lib/modding/ContentTypeHandler.cpp +++ b/lib/modding/ContentTypeHandler.cpp @@ -197,8 +197,8 @@ void ContentTypeHandler::afterLoadFinalization() std::set conflictingMods; std::set resolvedConflicts; - for (auto const & conflictModData : conflictModData.Struct()) - conflictingMods.insert(conflictModData.first); + for (auto const & conflictModEntry: conflictModData.Struct()) + conflictingMods.insert(conflictModEntry.first); for (auto const & modID : conflictingMods) resolvedConflicts.merge(VLC->modh->getModDependencies(modID)); diff --git a/lib/texts/TextLocalizationContainer.cpp b/lib/texts/TextLocalizationContainer.cpp index f45898cf7..1e446defc 100644 --- a/lib/texts/TextLocalizationContainer.cpp +++ b/lib/texts/TextLocalizationContainer.cpp @@ -152,11 +152,9 @@ void TextLocalizationContainer::exportAllTexts(std::map spells, bool accepted) +void CGameHandler::setResearchedSpells(const CGTownInstance * town, int level, const std::vector & spells, bool accepted) { SetResearchedSpells cs; cs.tid = town->id; diff --git a/server/CGameHandler.h b/server/CGameHandler.h index 4448cbd22..9d896f758 100644 --- a/server/CGameHandler.h +++ b/server/CGameHandler.h @@ -107,7 +107,7 @@ public: //from IGameCallback //do sth void changeSpells(const CGHeroInstance * hero, bool give, const std::set &spells) override; - void setResearchedSpells(const CGTownInstance * town, int level, const std::vector spells, bool accepted) override; + void setResearchedSpells(const CGTownInstance * town, int level, const std::vector & spells, bool accepted) override; bool removeObject(const CGObjectInstance * obj, const PlayerColor & initiator) override; void setOwner(const CGObjectInstance * obj, PlayerColor owner) override; void giveExperience(const CGHeroInstance * hero, TExpType val) override; diff --git a/server/CVCMIServer.cpp b/server/CVCMIServer.cpp index c0753d2a1..7eda3a733 100644 --- a/server/CVCMIServer.cpp +++ b/server/CVCMIServer.cpp @@ -299,17 +299,12 @@ void CVCMIServer::onDisconnected(const std::shared_ptr & con std::shared_ptr c = findConnection(connection); // player may have already disconnected via clientDisconnected call - if (c) + if (c && gh && getState() == EServerState::GAMEPLAY) { - //clientDisconnected(c); - - if(gh && getState() == EServerState::GAMEPLAY) - { - LobbyClientDisconnected lcd; - lcd.c = c; - lcd.clientId = c->connectionID; - handleReceivedPack(lcd); - } + LobbyClientDisconnected lcd; + lcd.c = c; + lcd.clientId = c->connectionID; + handleReceivedPack(lcd); } } diff --git a/server/queries/VisitQueries.cpp b/server/queries/VisitQueries.cpp index 36ff95291..f5f34fbb3 100644 --- a/server/queries/VisitQueries.cpp +++ b/server/queries/VisitQueries.cpp @@ -50,7 +50,6 @@ void MapObjectVisitQuery::onRemoval(PlayerColor color) { gh->objectVisitEnded(visitingHero, players.front()); - //TODO or should it be destructor? //Can object visit affect 2 players and what would be desired behavior? if(removeObjectAfterVisit) gh->removeObject(visitedObject, color); @@ -78,7 +77,7 @@ void TownBuildingVisitQuery::onAdded(PlayerColor color) while (!visitedBuilding.empty() && owner->topQuery(color).get() == this) { visitingHero = visitedBuilding.back().hero; - auto * building = visitedTown->rewardableBuildings.at(visitedBuilding.back().building); + const auto * building = visitedTown->rewardableBuildings.at(visitedBuilding.back().building); building->onHeroVisit(visitingHero); visitedBuilding.pop_back(); } diff --git a/test/mock/mock_IGameCallback.h b/test/mock/mock_IGameCallback.h index af5dd1171..3ae574345 100644 --- a/test/mock/mock_IGameCallback.h +++ b/test/mock/mock_IGameCallback.h @@ -44,7 +44,7 @@ public: void showInfoDialog(InfoWindow * iw) override {} void changeSpells(const CGHeroInstance * hero, bool give, const std::set &spells) override {} - void setResearchedSpells(const CGTownInstance * town, int level, const std::vector spells, bool accepted) override {} + void setResearchedSpells(const CGTownInstance * town, int level, const std::vector & spells, bool accepted) override {} bool removeObject(const CGObjectInstance * obj, const PlayerColor & initiator) override {return false;} void createBoat(const int3 & visitablePosition, BoatId type, PlayerColor initiator) override {} void setOwner(const CGObjectInstance * objid, PlayerColor owner) override {}