瀏覽代碼

Replace redundant types with `auto` for the lvalues of template factory functions for smart pointers

grep -r --include \*.h --include \*.cpp "= std::" * | grep -v auto | grep -Po ".*[^ ]+ [^ ]+ [^ ]*[ ]*=.*;" | grep -v "auto\|int\|char\|bool\|float|\double\|for\|if\|googletest\|fuzzylite\|size_t\|using\|return" | grep -v double | grep -v si64 | grep -v si32 | grep -v ui32 | grep \< | grep -v float | tr -d '\t' | grep -v assert > redundant_types.txt

import re

with open("redundant_types.txt") as f:
    for line in f:
        line = line.strip()
        path = line.split(":", 1)[0]
        original_code = ":".join(line.split(":")[1:]).strip()

        print()
        print(path)
        print(original_code)
        prefix = "auto "
        if original_code.startswith("static"):
            static = True
        else:
            static = False

        cpp_type = " ".join(original_code.split("=")[0].strip().split(" ")[0:-1])
        print(cpp_type)

        if static:
            new_code = "static auto "+ " ".join(original_code.split(" ")[2:])
        else:
            new_code = "auto "+ " ".join(original_code.split(" ")[1:])
        print(new_code)

        if True:
            with open(path, "r") as f:
                filedata = f.read()

            filedata = filedata.replace(original_code, new_code)

            with open(path, "w") as f:
                f.write(filedata)
Alexander Wilms 1 年之前
父節點
當前提交
73019c204d
共有 56 個文件被更改,包括 99 次插入99 次删除
  1. 2 2
      AI/BattleAI/StackWithBonuses.cpp
  2. 1 1
      AI/StupidAI/StupidAI.cpp
  3. 1 1
      client/CPlayerInterface.cpp
  4. 1 1
      client/CPlayerInterface.h
  5. 1 1
      client/Client.cpp
  6. 1 1
      client/battle/BattleWindow.cpp
  7. 1 1
      client/lobby/OptionsTab.cpp
  8. 1 1
      client/lobby/SelectionTab.cpp
  9. 1 1
      client/mainmenu/CHighScoreScreen.cpp
  10. 1 1
      client/mainmenu/CHighScoreScreen.h
  11. 2 2
      client/widgets/CreatureCostBox.cpp
  12. 3 3
      client/windows/CMapOverview.cpp
  13. 1 1
      client/windows/GUIClasses.cpp
  14. 1 1
      lib/BattleFieldHandler.cpp
  15. 1 1
      lib/CCreatureSet.cpp
  16. 1 1
      lib/CGameInfoCallback.cpp
  17. 3 3
      lib/CHeroHandler.cpp
  18. 1 1
      lib/CTownHandler.cpp
  19. 1 1
      lib/IGameCallback.h
  20. 8 8
      lib/JsonNode.cpp
  21. 1 1
      lib/LoadProgress.cpp
  22. 2 2
      lib/ScriptHandler.cpp
  23. 2 2
      lib/battle/BattleHex.h
  24. 2 2
      lib/battle/BattleInfo.cpp
  25. 1 1
      lib/battle/CBattleInfoCallback.cpp
  26. 1 1
      lib/battle/CBattleInfoEssentials.h
  27. 3 3
      lib/bonuses/BonusParams.h
  28. 4 4
      lib/bonuses/Updaters.cpp
  29. 1 1
      lib/events/ApplyDamage.cpp
  30. 1 1
      lib/events/GameResumed.cpp
  31. 1 1
      lib/events/ObjectVisitEnded.cpp
  32. 1 1
      lib/events/ObjectVisitStarted.cpp
  33. 1 1
      lib/events/PlayerGotTurn.cpp
  34. 1 1
      lib/events/TurnStarted.cpp
  35. 1 1
      lib/filesystem/Filesystem.cpp
  36. 1 1
      lib/mapObjectConstructors/CObjectClassesHandler.cpp
  37. 1 1
      lib/mapObjects/CGHeroInstance.h
  38. 2 2
      lib/mapping/MapFormatJson.cpp
  39. 1 1
      lib/rmg/threadpool/ThreadPool.h
  40. 1 1
      lib/spells/ISpellMechanics.cpp
  41. 7 7
      lib/spells/TargetCondition.cpp
  42. 1 1
      lib/spells/effects/Registry.cpp
  43. 1 1
      mapeditor/Animation.cpp
  44. 2 2
      mapeditor/graphics.cpp
  45. 1 1
      mapeditor/resourceExtractor/ResourceConverter.cpp
  46. 5 5
      scripting/erm/ERMInterpreter.cpp
  47. 2 2
      scripting/lua/api/Registry.cpp
  48. 1 1
      server/CVCMIServer.cpp
  49. 3 3
      test/entity/CCreatureTest.cpp
  50. 4 4
      test/erm/ERM_MA.cpp
  51. 1 1
      test/events/EventBusTest.cpp
  52. 1 1
      test/map/CMapFormatTest.cpp
  53. 1 1
      test/rmg/CRmgTemplateTest.cpp
  54. 3 3
      test/spells/effects/CatapultTest.cpp
  55. 3 3
      test/spells/effects/DamageTest.cpp
  56. 1 1
      test/spells/effects/HealTest.cpp

+ 2 - 2
AI/BattleAI/StackWithBonuses.cpp

@@ -134,7 +134,7 @@ SlotID StackWithBonuses::unitSlot() const
 TConstBonusListPtr StackWithBonuses::getAllBonuses(const CSelector & selector, const CSelector & limit,
 	const CBonusSystemNode * root, const std::string & cachingStr) const
 {
-	TBonusListPtr ret = std::make_shared<BonusList>();
+	auto ret = std::make_shared<BonusList>();
 	TConstBonusListPtr originalList = origBearer->getAllBonuses(selector, limit, root, cachingStr);
 
 	vstd::copy_if(*originalList, std::back_inserter(*ret), [this](const std::shared_ptr<Bonus> & b)
@@ -356,7 +356,7 @@ void HypotheticBattle::addUnit(uint32_t id, const JsonNode & data)
 {
 	battle::UnitInfo info;
 	info.load(id, data);
-	std::shared_ptr<StackWithBonuses> newUnit = std::make_shared<StackWithBonuses>(this, info);
+	auto newUnit = std::make_shared<StackWithBonuses>(this, info);
 	stackStates[newUnit->unitId()] = newUnit;
 }
 

+ 1 - 1
AI/StupidAI/StupidAI.cpp

@@ -155,7 +155,7 @@ void CStupidAI::activeStack(const BattleID & battleID, const CStack * stack)
 			{
 				if(CStack::isMeleeAttackPossible(stack, s, hex))
 				{
-					std::vector<EnemyInfo>::iterator i = std::find(enemiesReachable.begin(), enemiesReachable.end(), s);
+					auto i = std::find(enemiesReachable.begin(), enemiesReachable.end(), s);
 					if(i == enemiesReachable.end())
 					{
 						enemiesReachable.push_back(s);

+ 1 - 1
client/CPlayerInterface.cpp

@@ -1093,7 +1093,7 @@ void CPlayerInterface::showMapObjectSelectDialog(QueryID askID, const Component
 	std::shared_ptr<CIntObject> localIcon = localIconC.image;
 	localIconC.removeChild(localIcon.get(), false);
 
-	std::shared_ptr<CObjectListWindow> wnd = std::make_shared<CObjectListWindow>(tempList, localIcon, localTitle, localDescription, selectCallback);
+	auto wnd = std::make_shared<CObjectListWindow>(tempList, localIcon, localTitle, localDescription, selectCallback);
 	wnd->onExit = cancelCallback;
 	GH.windows().pushWindow(wnd);
 }

+ 1 - 1
client/CPlayerInterface.h

@@ -192,7 +192,7 @@ public: // public interface for use by client via LOCPLINT access
 	void showInfoDialog(const std::string &text, std::shared_ptr<CComponent> component);
 	void showInfoDialog(const std::string &text, const std::vector<std::shared_ptr<CComponent>> & components = std::vector<std::shared_ptr<CComponent>>(), int soundID = 0);
 	void showInfoDialogAndWait(std::vector<Component> & components, const MetaString & text);
-	void showYesNoDialog(const std::string &text, CFunctionList<void()> onYes, CFunctionList<void()> onNo, const std::vector<std::shared_ptr<CComponent>> & components = std::vector<std::shared_ptr<CComponent>>());
+	auto showYesNoDialog(const std::string &text, CFunctionList<void()> onYes, CFunctionList<void()> onNo, const std::vector<std::shared_ptr<CComponent>> & components = std::vector<std::shared_ptr<CComponent>>());
 
 	void moveHero(const CGHeroInstance *h, const CGPath& path);
 

+ 1 - 1
client/Client.cpp

@@ -675,7 +675,7 @@ std::shared_ptr<const CPathsInfo> CClient::getPathsInfo(const CGHeroInstance * h
 
 	if(iter == std::end(pathCache))
 	{
-		std::shared_ptr<CPathsInfo> paths = std::make_shared<CPathsInfo>(getMapSize(), h);
+		auto paths = std::make_shared<CPathsInfo>(getMapSize(), h);
 
 		gs->calculatePaths(h, *paths.get());
 

+ 1 - 1
client/battle/BattleWindow.cpp

@@ -420,7 +420,7 @@ void BattleWindow::bFleef()
 
 	if ( owner.getBattle()->battleCanFlee() )
 	{
-		CFunctionList<void()> ony = std::bind(&BattleWindow::reallyFlee,this);
+		auto ony = std::bind(&BattleWindow::reallyFlee,this);
 		owner.curInt->showYesNoDialog(CGI->generaltexth->allTexts[28], ony, nullptr); //Are you sure you want to retreat?
 	}
 	else

+ 1 - 1
client/lobby/OptionsTab.cpp

@@ -481,7 +481,7 @@ void OptionsTab::SelectionWindow::setSelection()
 
 void OptionsTab::SelectionWindow::reopen()
 {
-	std::shared_ptr<SelectionWindow> window = std::shared_ptr<SelectionWindow>(new SelectionWindow(color, type));
+	auto window = std::shared_ptr<SelectionWindow>(new SelectionWindow(color, type));
 	close();
 	GH.windows().pushWindow(window);
 }

+ 1 - 1
client/lobby/SelectionTab.cpp

@@ -448,7 +448,7 @@ void SelectionTab::filter(int size, bool selectFirst)
 				}			
 			}
 
-			std::shared_ptr<ElementInfo> folder = std::make_shared<ElementInfo>();
+			auto folder = std::make_shared<ElementInfo>();
 			folder->isFolder = true;
 			folder->folderName = folderName;
 			auto itemIt = boost::range::find_if(curItems, [folder](std::shared_ptr<ElementInfo> e) { return e->folderName == folder->folderName; });

+ 1 - 1
client/mainmenu/CHighScoreScreen.cpp

@@ -118,7 +118,7 @@ void CHighScoreScreen::addHighScores()
 {
 	OBJ_CONSTRUCTION_CAPTURING_ALL_NO_DISPOSE;
 
-	background = std::make_shared<CPicture>(ImagePath::builtin(highscorepage == HighScorePage::SCENARIO ? "HISCORE" : "HISCORE2"));
+	auto = std::make_shared<CPicture>(ImagePath::builtin(highscorepage == HighScorePage::SCENARIO ? "HISCORE" : "HISCORE2"));
 
 	texts.clear();
 	images.clear();

+ 1 - 1
client/mainmenu/CHighScoreScreen.h

@@ -35,7 +35,7 @@ public:
 class HighScoreCalculation
 {
 public:
-	std::vector<HighScoreParameter> parameters = std::vector<HighScoreParameter>();
+	auto parameters = std::vector<HighScoreParameter>();
 	bool isCampaign = false;
 
 	auto calculate();

+ 2 - 2
client/widgets/CreatureCostBox.cpp

@@ -38,8 +38,8 @@ void CreatureCostBox::createItems(TResources res)
 	TResources::nziterator iter(res);
 	while(iter.valid())
 	{
-		ImagePtr image = std::make_shared<CAnimImage>(AnimationPath::builtin("RESOURCE"), iter->resType);
-		LabelPtr text = std::make_shared<CLabel>(15, 43, FONT_SMALL, ETextAlignment::CENTER, Colors::WHITE, "0");
+		auto image = std::make_shared<CAnimImage>(AnimationPath::builtin("RESOURCE"), iter->resType);
+		auto text = std::make_shared<CLabel>(15, 43, FONT_SMALL, ETextAlignment::CENTER, Colors::WHITE, "0");
 
 		resources.insert(std::make_pair(iter->resType, std::make_pair(text, image)));
 		iter++;

+ 3 - 3
client/windows/CMapOverview.cpp

@@ -98,7 +98,7 @@ Canvas CMapOverviewWidget::createMinimapForLayer(std::unique_ptr<CMap> & map, in
 
 std::vector<Canvas> CMapOverviewWidget::createMinimaps(ResourcePath resource) const
 {
-	std::vector<Canvas> ret = std::vector<Canvas>();
+	auto ret = std::vector<Canvas>();
 
 	CMapService mapService;
 	std::unique_ptr<CMap> map;
@@ -117,7 +117,7 @@ std::vector<Canvas> CMapOverviewWidget::createMinimaps(ResourcePath resource) co
 
 std::vector<Canvas> CMapOverviewWidget::createMinimaps(std::unique_ptr<CMap> & map) const
 {
-	std::vector<Canvas> ret = std::vector<Canvas>();
+	auto ret = std::vector<Canvas>();
 
 	for(int i = 0; i < (map->twoLevel ? 2 : 1); i++)
 		ret.push_back(createMinimapForLayer(map, i));
@@ -164,7 +164,7 @@ CMapOverviewWidget::CMapOverviewWidget(CMapOverview& parent):
 			CLoadFile lf(*CResourceHandler::get()->getResourceName(ResourcePath(p.resource.getName(), EResType::SAVEGAME)), MINIMAL_SERIALIZATION_VERSION);
 			lf.checkMagicBytes(SAVEGAME_MAGIC);
 
-			std::unique_ptr<CMapHeader> mapHeader = std::make_unique<CMapHeader>();
+			auto mapHeader = std::make_unique<CMapHeader>();
 			StartInfo * startInfo;
 			lf >> *(mapHeader) >> startInfo;
 

+ 1 - 1
client/windows/GUIClasses.cpp

@@ -785,7 +785,7 @@ CExchangeWindow::CExchangeWindow(ObjectInstanceID hero1, ObjectInstanceID hero2,
 
 		auto moveArmy = [this](const bool leftToRight) -> void
 		{
-			std::optional<SlotID> slotId = std::nullopt;
+			auto slotId = std::nullopt;
 			if(auto slot = getSelectedSlotID())
 				slotId = slot->getSlot();
 			controller.moveArmy(leftToRight, slotId);

+ 1 - 1
lib/BattleFieldHandler.cpp

@@ -49,7 +49,7 @@ std::vector<JsonNode> BattleFieldHandler::loadLegacyData()
 
 const std::vector<std::string> & BattleFieldHandler::getTypeNames() const
 {
-	static const  std::vector<std::string> types = std::vector<std::string> { "battlefield" };
+	static auto  std::vector<std::string> types = std::vector<std::string> { "battlefield" };
 
 	return types;
 }

+ 1 - 1
lib/CCreatureSet.cpp

@@ -141,7 +141,7 @@ bool CCreatureSet::isCreatureBalanced(const CCreature * c, TQuantity ignoreAmoun
 {
 	assert(c && c->valid());
 	TQuantity max = 0;
-	TQuantity min = std::numeric_limits<TQuantity>::max();
+	auto min = std::numeric_limits<TQuantity>::max();
 
 	for(const auto & elem : stacks)
 	{

+ 1 - 1
lib/CGameInfoCallback.cpp

@@ -741,7 +741,7 @@ int CPlayerSpecificInfoCallback::howManyTowns() const
 std::vector < const CGTownInstance *> CPlayerSpecificInfoCallback::getTownsInfo(bool onlyOur) const
 {
 	//boost::shared_lock<boost::shared_mutex> lock(*gs->mx);
-	std::vector < const CGTownInstance *> ret = std::vector < const CGTownInstance *>();
+	auto < const CGTownInstance *> ret = std::vector < const CGTownInstance *>();
 	for(const auto & i : gs->players)
 	{
 		for(const auto & town : i.second.towns)

+ 3 - 3
lib/CHeroHandler.cpp

@@ -536,7 +536,7 @@ static std::vector<std::shared_ptr<Bonus>> createCreatureSpecialty(CreatureID ba
 		int stepSize = specCreature.getLevel() ? specCreature.getLevel() : 5;
 
 		{
-			std::shared_ptr<Bonus> bonus = std::make_shared<Bonus>();
+			auto bonus = std::make_shared<Bonus>();
 			bonus->limiter.reset(new CCreatureTypeLimiter(specCreature, false));
 			bonus->type = BonusType::STACKS_SPEED;
 			bonus->val = 1;
@@ -544,7 +544,7 @@ static std::vector<std::shared_ptr<Bonus>> createCreatureSpecialty(CreatureID ba
 		}
 
 		{
-			std::shared_ptr<Bonus> bonus = std::make_shared<Bonus>();
+			auto bonus = std::make_shared<Bonus>();
 			bonus->type = BonusType::PRIMARY_SKILL;
 			bonus->subtype = BonusSubtypeID(PrimarySkill::ATTACK);
 			bonus->val = 0;
@@ -554,7 +554,7 @@ static std::vector<std::shared_ptr<Bonus>> createCreatureSpecialty(CreatureID ba
 		}
 
 		{
-			std::shared_ptr<Bonus> bonus = std::make_shared<Bonus>();
+			auto bonus = std::make_shared<Bonus>();
 			bonus->type = BonusType::PRIMARY_SKILL;
 			bonus->subtype = BonusSubtypeID(PrimarySkill::DEFENSE);
 			bonus->val = 0;

+ 1 - 1
lib/CTownHandler.cpp

@@ -534,7 +534,7 @@ R CTownHandler::getMappedValue(const JsonNode & node, const R defval, const std:
 void CTownHandler::addBonusesForVanilaBuilding(CBuilding * building) const
 {
 	std::shared_ptr<Bonus> b;
-	static TPropagatorPtr playerPropagator = std::make_shared<CPropagatorNodeType>(CBonusSystemNode::ENodeTypes::PLAYER);
+	static auto playerPropagator = std::make_shared<CPropagatorNodeType>(CBonusSystemNode::ENodeTypes::PLAYER);
 
 	if(building->bid == BuildingID::TAVERN)
 	{

+ 1 - 1
lib/IGameCallback.h

@@ -62,7 +62,7 @@ public:
 
 	//gives 3 treasures, 3 minors, 1 major -> used by Black Market and Artifact Merchant
 	void pickAllowedArtsSet(std::vector<const CArtifact *> & out, CRandomGenerator & rand);
-	void getAllowedSpells(std::vector<SpellID> &out, std::optional<ui16> level = std::nullopt);
+	auto getAllowedSpells(std::vector<SpellID> &out, std::optional<ui16> level = std::nullopt);
 
 	template<typename Saver>
 	void saveCommonState(Saver &out) const; //stores GS and VLC

+ 8 - 8
lib/JsonNode.cpp

@@ -818,7 +818,7 @@ std::shared_ptr<ILimiter> JsonUtils::parseLimiter(const JsonNode & limiter)
 			const JsonVector & parameters = limiter["parameters"].Vector();
 			if(limiterType == "CREATURE_TYPE_LIMITER")
 			{
-				std::shared_ptr<CCreatureTypeLimiter> creatureLimiter = std::make_shared<CCreatureTypeLimiter>();
+				auto creatureLimiter = std::make_shared<CCreatureTypeLimiter>();
 				VLC->identifiers()->requestIdentifier("creature", parameters[0], [=](si32 creature)
 				{
 					creatureLimiter->setCreature(CreatureID(creature));
@@ -846,7 +846,7 @@ std::shared_ptr<ILimiter> JsonUtils::parseLimiter(const JsonNode & limiter)
 				}
 				else
 				{
-					std::shared_ptr<HasAnotherBonusLimiter> bonusLimiter = std::make_shared<HasAnotherBonusLimiter>();
+					auto bonusLimiter = std::make_shared<HasAnotherBonusLimiter>();
 					bonusLimiter->type = it->second;
 					auto findSource = [&](const JsonNode & parameter)
 					{
@@ -890,7 +890,7 @@ std::shared_ptr<ILimiter> JsonUtils::parseLimiter(const JsonNode & limiter)
 			}
 			else if(limiterType == "FACTION_LIMITER" || limiterType == "CREATURE_FACTION_LIMITER") //Second name is deprecated, 1.2 compat
 			{
-				std::shared_ptr<FactionLimiter> factionLimiter = std::make_shared<FactionLimiter>();
+				auto factionLimiter = std::make_shared<FactionLimiter>();
 				VLC->identifiers()->requestIdentifier("faction", parameters[0], [=](si32 faction)
 				{
 					factionLimiter->faction = FactionID(faction);
@@ -910,7 +910,7 @@ std::shared_ptr<ILimiter> JsonUtils::parseLimiter(const JsonNode & limiter)
 			}
 			else if(limiterType == "CREATURE_TERRAIN_LIMITER")
 			{
-				std::shared_ptr<CreatureTerrainLimiter> terrainLimiter = std::make_shared<CreatureTerrainLimiter>();
+				auto terrainLimiter = std::make_shared<CreatureTerrainLimiter>();
 				if(!parameters.empty())
 				{
 					VLC->identifiers()->requestIdentifier("terrain", parameters[0], [=](si32 terrain)
@@ -1007,7 +1007,7 @@ static TUpdaterPtr parseUpdater(const JsonNode & updaterJson)
 	case JsonNode::JsonType::DATA_STRUCT:
 		if(updaterJson["type"].String() == "GROWS_WITH_LEVEL")
 		{
-			std::shared_ptr<GrowsWithLevelUpdater> updater = std::make_shared<GrowsWithLevelUpdater>();
+			auto updater = std::make_shared<GrowsWithLevelUpdater>();
 			const JsonVector param = updaterJson["parameters"].Vector();
 			updater->valPer20 = static_cast<int>(param[0].Integer());
 			if(param.size() > 1)
@@ -1016,7 +1016,7 @@ static TUpdaterPtr parseUpdater(const JsonNode & updaterJson)
 		}
 		else if (updaterJson["type"].String() == "ARMY_MOVEMENT")
 		{
-			std::shared_ptr<ArmyMovementUpdater> updater = std::make_shared<ArmyMovementUpdater>();
+			auto updater = std::make_shared<ArmyMovementUpdater>();
 			if(updaterJson["parameters"].isVector())
 			{
 				const auto & param = updaterJson["parameters"].Vector();
@@ -1204,8 +1204,8 @@ CSelector JsonUtils::parseSelector(const JsonNode & ability)
 		ret = ret.And(Selector::subtype()(subtype));
 	}
 	value = &ability["sourceType"];
-	std::optional<BonusSource> src = std::nullopt; //Fixes for GCC false maybe-uninitialized
-	std::optional<BonusSourceID> id = std::nullopt;
+	auto src = std::nullopt; //Fixes for GCC false maybe-uninitialized
+	auto id = std::nullopt;
 	if(value->isString())
 	{
 		auto it = bonusSourceMap.find(value->String());

+ 1 - 1
lib/LoadProgress.cpp

@@ -54,7 +54,7 @@ void Progress::reset(int s)
 
 void Progress::finish()
 {
-	_progress = _target = std::numeric_limits<Type>::max();
+	auto = _target = std::numeric_limits<Type>::max();
 	_step = std::numeric_limits<Type>::min();
 	_maxSteps = std::numeric_limits<Type>::min();
 }

+ 2 - 2
lib/ScriptHandler.cpp

@@ -225,7 +225,7 @@ std::vector<JsonNode> ScriptHandler::loadLegacyData()
 ScriptPtr ScriptHandler::loadFromJson(vstd::CLoggerBase * logger, const std::string & scope,
 	const JsonNode & json, const std::string & identifier) const
 {
-	ScriptPtr ret = std::make_shared<ScriptImpl>(this);
+	auto ret = std::make_shared<ScriptImpl>(this);
 
 	JsonDeserializer handler(nullptr, json);
 	ret->identifier = identifier;
@@ -279,7 +279,7 @@ void ScriptHandler::loadState(const JsonNode & state)
 
 		const JsonNode & scriptData = keyValue.second;
 
-		ScriptPtr script = std::make_shared<ScriptImpl>(this);
+		auto script = std::make_shared<ScriptImpl>(this);
 
 		JsonDeserializer handler(nullptr, scriptData);
 		script->serializeJsonState(handler);

+ 2 - 2
lib/battle/BattleHex.h

@@ -44,8 +44,8 @@ struct DLL_LINKAGE BattleHex //TODO: decide if this should be changed to class f
 	static constexpr si16 HERO_DEFENDER = GameConstants::BFIELD_WIDTH - 1;
 
 	// helpers for rendering
-	static constexpr si16 HEX_BEFORE_ALL = std::numeric_limits<si16>::min();
-	static constexpr si16 HEX_AFTER_ALL = std::numeric_limits<si16>::max();
+	static auto si16 HEX_BEFORE_ALL = std::numeric_limits<si16>::min();
+	static auto si16 HEX_AFTER_ALL = std::numeric_limits<si16>::max();
 
 	static constexpr si16 DESTRUCTIBLE_WALL_1 = 29;
 	static constexpr si16 DESTRUCTIBLE_WALL_2 = 78;

+ 2 - 2
lib/battle/BattleInfo.cpp

@@ -957,14 +957,14 @@ void BattleInfo::setWallState(EWallPart partOfWall, EWallState state)
 
 void BattleInfo::addObstacle(const ObstacleChanges & changes)
 {
-	std::shared_ptr<SpellCreatedObstacle> obstacle = std::make_shared<SpellCreatedObstacle>();
+	auto obstacle = std::make_shared<SpellCreatedObstacle>();
 	obstacle->fromInfo(changes);
 	obstacles.push_back(obstacle);
 }
 
 void BattleInfo::updateObstacle(const ObstacleChanges& changes)
 {
-	std::shared_ptr<SpellCreatedObstacle> changedObstacle = std::make_shared<SpellCreatedObstacle>();
+	auto changedObstacle = std::make_shared<SpellCreatedObstacle>();
 	changedObstacle->fromInfo(changes);
 
 	for(auto & obstacle : obstacles)

+ 1 - 1
lib/battle/CBattleInfoCallback.cpp

@@ -796,7 +796,7 @@ DamageEstimation CBattleInfoCallback::battleEstimateDamage(const BattleAttackInf
 
 std::vector<std::shared_ptr<const CObstacleInstance>> CBattleInfoCallback::battleGetAllObstaclesOnPos(BattleHex tile, bool onlyBlocking) const
 {
-	std::vector<std::shared_ptr<const CObstacleInstance>> obstacles = std::vector<std::shared_ptr<const CObstacleInstance>>();
+	auto CObstacleInstance>> obstacles = std::vector<std::shared_ptr<const CObstacleInstance>>();
 	RETURN_IF_NOT_BATTLE(obstacles);
 	for(auto & obs : battleGetAllObstacles())
 	{

+ 1 - 1
lib/battle/CBattleInfoEssentials.h

@@ -52,7 +52,7 @@ public:
 	BattleField battleGetBattlefieldType() const override;
 	int32_t battleGetEnchanterCounter(ui8 side) const;
 
-	std::vector<std::shared_ptr<const CObstacleInstance> > battleGetAllObstacles(std::optional<BattlePerspective::BattlePerspective> perspective = std::nullopt) const; //returns all obstacles on the battlefield
+	auto CObstacleInstance> > battleGetAllObstacles(std::optional<BattlePerspective::BattlePerspective> perspective = std::nullopt) const; //returns all obstacles on the battlefield
 
 	std::shared_ptr<const CObstacleInstance> battleGetObstacleByID(uint32_t ID) const;
 

+ 3 - 3
lib/bonuses/BonusParams.h

@@ -19,10 +19,10 @@ VCMI_LIB_NAMESPACE_BEGIN
 struct DLL_LINKAGE BonusParams {
 	bool isConverted;
 	BonusType type = BonusType::NONE;
-	std::optional<BonusSubtypeID> subtype = std::nullopt;
-	std::optional<BonusValueType> valueType = std::nullopt;
+	auto subtype = std::nullopt;
+	auto valueType = std::nullopt;
 	std::optional<si32> val = std::nullopt;
-	std::optional<BonusSource> targetType = std::nullopt;
+	auto targetType = std::nullopt;
 
 	BonusParams(bool isConverted = true) : isConverted(isConverted) {};
 	BonusParams(std::string deprecatedTypeStr, std::string deprecatedSubtypeStr = "", int deprecatedSubtype = 0);

+ 4 - 4
lib/bonuses/Updaters.cpp

@@ -54,7 +54,7 @@ std::shared_ptr<Bonus> GrowsWithLevelUpdater::createUpdatedBonus(const std::shar
 		//rounding follows format for HMM3 creature specialty bonus
 		int newVal = (valPer20 * steps + 19) / 20;
 		//return copy of bonus with updated val
-		std::shared_ptr<Bonus> newBonus = std::make_shared<Bonus>(*b);
+		auto newBonus = std::make_shared<Bonus>(*b);
 		newBonus->val = newVal;
 		return newBonus;
 	}
@@ -83,7 +83,7 @@ std::shared_ptr<Bonus> TimesHeroLevelUpdater::createUpdatedBonus(const std::shar
 	if(context.getNodeType() == CBonusSystemNode::HERO)
 	{
 		int level = dynamic_cast<const CGHeroInstance &>(context).level;
-		std::shared_ptr<Bonus> newBonus = std::make_shared<Bonus>(*b);
+		auto newBonus = std::make_shared<Bonus>(*b);
 		newBonus->val *= level;
 		return newBonus;
 	}
@@ -155,7 +155,7 @@ std::shared_ptr<Bonus> TimesStackLevelUpdater::createUpdatedBonus(const std::sha
 	if(context.getNodeType() == CBonusSystemNode::STACK_INSTANCE)
 	{
 		int level = dynamic_cast<const CStackInstance &>(context).getLevel();
-		std::shared_ptr<Bonus> newBonus = std::make_shared<Bonus>(*b);
+		auto newBonus = std::make_shared<Bonus>(*b);
 		newBonus->val *= level;
 		return newBonus;
 	}
@@ -167,7 +167,7 @@ std::shared_ptr<Bonus> TimesStackLevelUpdater::createUpdatedBonus(const std::sha
 		if(stack.base == nullptr)
 		{
 			int level = stack.unitType()->getLevel();
-			std::shared_ptr<Bonus> newBonus = std::make_shared<Bonus>(*b);
+			auto newBonus = std::make_shared<Bonus>(*b);
 			newBonus->val *= level;
 			return newBonus;
 		}

+ 1 - 1
lib/events/ApplyDamage.cpp

@@ -21,7 +21,7 @@ namespace events
 
 SubscriptionRegistry<ApplyDamage> * ApplyDamage::getRegistry()
 {
-	static std::unique_ptr<SubscriptionRegistry<ApplyDamage>> Instance = std::make_unique<SubscriptionRegistry<ApplyDamage>>();
+	static auto Instance = std::make_unique<SubscriptionRegistry<ApplyDamage>>();
 	return Instance.get();
 }
 

+ 1 - 1
lib/events/GameResumed.cpp

@@ -20,7 +20,7 @@ namespace events
 
 SubscriptionRegistry<GameResumed> * GameResumed::getRegistry()
 {
-	static std::unique_ptr<SubscriptionRegistry<GameResumed>> Instance = std::make_unique<SubscriptionRegistry<GameResumed>>();
+	static auto Instance = std::make_unique<SubscriptionRegistry<GameResumed>>();
 	return Instance.get();
 }
 

+ 1 - 1
lib/events/ObjectVisitEnded.cpp

@@ -21,7 +21,7 @@ namespace events
 
 SubscriptionRegistry<ObjectVisitEnded> * ObjectVisitEnded::getRegistry()
 {
-	static std::unique_ptr<Sub> Instance = std::make_unique<Sub>();
+	static auto Instance = std::make_unique<Sub>();
 	return Instance.get();
 }
 

+ 1 - 1
lib/events/ObjectVisitStarted.cpp

@@ -21,7 +21,7 @@ namespace events
 
 SubscriptionRegistry<ObjectVisitStarted> * ObjectVisitStarted::getRegistry()
 {
-	static std::unique_ptr<Sub> Instance = std::make_unique<Sub>();
+	static auto Instance = std::make_unique<Sub>();
 	return Instance.get();
 }
 

+ 1 - 1
lib/events/PlayerGotTurn.cpp

@@ -20,7 +20,7 @@ namespace events
 
 SubscriptionRegistry<PlayerGotTurn> * PlayerGotTurn::getRegistry()
 {
-	static std::unique_ptr<SubscriptionRegistry<PlayerGotTurn>> Instance = std::make_unique<SubscriptionRegistry<PlayerGotTurn>>();
+	static auto Instance = std::make_unique<SubscriptionRegistry<PlayerGotTurn>>();
 	return Instance.get();
 }
 

+ 1 - 1
lib/events/TurnStarted.cpp

@@ -20,7 +20,7 @@ namespace events
 
 SubscriptionRegistry<TurnStarted> * TurnStarted::getRegistry()
 {
-	static std::unique_ptr<SubscriptionRegistry<TurnStarted>> Instance = std::make_unique<SubscriptionRegistry<TurnStarted>>();
+	static auto Instance = std::make_unique<SubscriptionRegistry<TurnStarted>>();
 	return Instance.get();
 }
 

+ 1 - 1
lib/filesystem/Filesystem.cpp

@@ -24,7 +24,7 @@
 
 VCMI_LIB_NAMESPACE_BEGIN
 
-std::map<std::string, ISimpleResourceLoader*> CResourceHandler::knownLoaders = std::map<std::string, ISimpleResourceLoader*>();
+auto ISimpleResourceLoader*> CResourceHandler::knownLoaders = std::map<std::string, ISimpleResourceLoader*>();
 CResourceHandler CResourceHandler::globalResourceHandler;
 
 CFilesystemGenerator::CFilesystemGenerator(std::string prefix, bool extractArchives):

+ 1 - 1
lib/mapObjectConstructors/CObjectClassesHandler.cpp

@@ -42,7 +42,7 @@ VCMI_LIB_NAMESPACE_BEGIN
 
 CObjectClassesHandler::CObjectClassesHandler()
 {
-#define SET_HANDLER_CLASS(STRING, CLASSNAME) handlerConstructors[STRING] = std::make_shared<CLASSNAME>;
+auto SET_HANDLER_CLASS(STRING, CLASSNAME) handlerConstructors[STRING] = std::make_shared<CLASSNAME>;
 #define SET_HANDLER(STRING, TYPENAME) handlerConstructors[STRING] = std::make_shared<CDefaultObjectTypeHandler<TYPENAME>>
 
 	// list of all known handlers, hardcoded for now since the only way to add new objects is via C++ code

+ 1 - 1
lib/mapObjects/CGHeroInstance.h

@@ -89,7 +89,7 @@ public:
 
 	static constexpr si32 UNINITIALIZED_MANA = -1;
 	static constexpr ui32 UNINITIALIZED_MOVEMENT = -1;
-	static constexpr TExpType UNINITIALIZED_EXPERIENCE = std::numeric_limits<TExpType>::max();
+	static auto TExpType UNINITIALIZED_EXPERIENCE = std::numeric_limits<TExpType>::max();
 
 	//std::vector<const CArtifact*> artifacts; //hero's artifacts from bag
 	//std::map<ui16, const CArtifact*> artifWorn; //map<position,artifact_id>; positions: 0 - head; 1 - shoulders; 2 - neck; 3 - right hand; 4 - left hand; 5 - torso; 6 - right ring; 7 - left ring; 8 - feet; 9 - misc1; 10 - misc2; 11 - misc3; 12 - misc4; 13 - mach1; 14 - mach2; 15 - mach3; 16 - mach4; 17 - spellbook; 18 - misc5

+ 2 - 2
lib/mapping/MapFormatJson.cpp

@@ -780,7 +780,7 @@ CMapLoaderJson::CMapLoaderJson(CInputStream * stream)
 std::unique_ptr<CMap> CMapLoaderJson::loadMap()
 {
 	LOG_TRACE(logGlobal);
-	std::unique_ptr<CMap> result = std::make_unique<CMap>();
+	auto result = std::make_unique<CMap>();
 	map = result.get();
 	mapHeader = map;
 	readMap();
@@ -791,7 +791,7 @@ std::unique_ptr<CMapHeader> CMapLoaderJson::loadMapHeader()
 {
 	LOG_TRACE(logGlobal);
 	map = nullptr;
-	std::unique_ptr<CMapHeader> result = std::make_unique<CMapHeader>();
+	auto result = std::make_unique<CMapHeader>();
 	mapHeader = result.get();
 	readHeader(false);
 	return result;

+ 1 - 1
lib/rmg/threadpool/ThreadPool.h

@@ -179,7 +179,7 @@ auto ThreadPool::async(std::function<void()>&& f) const -> boost::future<void>
         }
     }
 
-    std::shared_ptr<TaskT> task = std::make_shared<TaskT>(f);
+    auto task = std::make_shared<TaskT>(f);
     boost::future<void> fut = task->get_future();
     tasks.emplace([task]() -> void
     {

+ 1 - 1
lib/spells/ISpellMechanics.cpp

@@ -48,7 +48,7 @@ namespace spells
 
 static std::shared_ptr<TargetCondition> makeCondition(const CSpell * s)
 {
-	std::shared_ptr<TargetCondition> res = std::make_shared<TargetCondition>();
+	auto res = std::make_shared<TargetCondition>();
 
 	JsonDeserializer deser(nullptr, s->targetCondition);
 	res->serializeJson(deser, TargetConditionItemFactory::getDefault());

+ 7 - 7
lib/spells/TargetCondition.cpp

@@ -318,19 +318,19 @@ class DefaultTargetConditionItemFactory : public TargetConditionItemFactory
 public:
 	Object createAbsoluteLevel() const override
 	{
-		static std::shared_ptr<TargetConditionItem> antimagicCondition = std::make_shared<AbsoluteLevelCondition>();
+		static auto antimagicCondition = std::make_shared<AbsoluteLevelCondition>();
         return antimagicCondition;
 	}
 
 	Object createAbsoluteSpell() const override
 	{
-		static std::shared_ptr<TargetConditionItem> alCondition = std::make_shared<AbsoluteSpellCondition>();
+		static auto alCondition = std::make_shared<AbsoluteSpellCondition>();
 		return alCondition;
 	}
 
 	Object createElemental() const override
 	{
-		static std::shared_ptr<TargetConditionItem> elementalCondition = std::make_shared<ElementalCondition>();
+		static auto elementalCondition = std::make_shared<ElementalCondition>();
 		return elementalCondition;
 	}
 
@@ -342,13 +342,13 @@ public:
 
 	Object createNormalLevel() const override
 	{
-		static std::shared_ptr<TargetConditionItem> nlCondition = std::make_shared<NormalLevelCondition>();
+		static auto nlCondition = std::make_shared<NormalLevelCondition>();
 		return nlCondition;
 	}
 
 	Object createNormalSpell() const override
 	{
-		static std::shared_ptr<TargetConditionItem> nsCondition = std::make_shared<NormalSpellCondition>();
+		static auto nsCondition = std::make_shared<NormalSpellCondition>();
 		return nsCondition;
 	}
 
@@ -424,13 +424,13 @@ public:
 
 	Object createReceptiveFeature() const override
 	{
-		static std::shared_ptr<TargetConditionItem> condition = std::make_shared<ReceptiveFeatureCondition>();
+		static auto condition = std::make_shared<ReceptiveFeatureCondition>();
 		return condition;
 	}
 
 	Object createImmunityNegation() const override
 	{
-		static std::shared_ptr<TargetConditionItem> condition = std::make_shared<ImmunityNegationCondition>();
+		static auto condition = std::make_shared<ImmunityNegationCondition>();
 		return condition;
 	}
 };

+ 1 - 1
lib/spells/effects/Registry.cpp

@@ -80,7 +80,7 @@ private:
 
 Registry * GlobalRegistry::get()
 {
-	static std::unique_ptr<Registry> Instance = std::make_unique<detail::RegistryImpl>();
+	static auto Instance = std::make_unique<detail::RegistryImpl>();
 	return Instance.get();
 }
 

+ 1 - 1
mapeditor/Animation.cpp

@@ -303,7 +303,7 @@ std::shared_ptr<QImage> DefFile::loadFrame(size_t frame, size_t group) const
 	const ui32 BaseOffset = currentOffset;
 
 	
-	std::shared_ptr<QImage> img = std::make_shared<QImage>(sprite.fullWidth, sprite.fullHeight, QImage::Format_Indexed8);
+	auto img = std::make_shared<QImage>(sprite.fullWidth, sprite.fullHeight, QImage::Format_Indexed8);
 	if(!img)
 		throw std::runtime_error("Image memory cannot be allocated");
 	

+ 2 - 2
mapeditor/graphics.cpp

@@ -184,7 +184,7 @@ std::shared_ptr<Animation> Graphics::loadHeroFlagAnimation(const std::string & n
 		{2,14}, {3,15}
 	};
 	
-	std::shared_ptr<Animation> anim = std::make_shared<Animation>(name);
+	auto anim = std::make_shared<Animation>(name);
 	anim->preload();
 	
 	for(const auto & rotation : rotations)
@@ -207,7 +207,7 @@ std::shared_ptr<Animation> Graphics::loadHeroAnimation(const std::string &name)
 		{2,14}, {3,15}
 	};
 	
-	std::shared_ptr<Animation> anim = std::make_shared<Animation>(name);
+	auto anim = std::make_shared<Animation>(name);
 	anim->preload();
 	
 	

+ 1 - 1
mapeditor/resourceExtractor/ResourceConverter.cpp

@@ -71,7 +71,7 @@ void ResourceConverter::splitDefFile(const std::string & fileName, const boost::
 {
 	if(CResourceHandler::get()->existsResource(ResourcePath("SPRITES/" + fileName)))
 	{
-		std::unique_ptr<Animation> anim = std::make_unique<Animation>(fileName);
+		auto anim = std::make_unique<Animation>(fileName);
 		anim->preload();
 		anim->exportBitmaps(pathToQString(sourceFolder));
 

+ 5 - 5
scripting/erm/ERMInterpreter.cpp

@@ -1377,7 +1377,7 @@ struct ScriptScanner
 	{
 		if(std::holds_alternative<Tcommand>(cmd)) //TCommand
 		{
-			Tcommand tcmd = std::get<Tcommand>(cmd);
+			auto tcmd = std::get<Tcommand>(cmd);
 			struct Visitor
 			{
 				void operator()(const ERM::Ttrigger& t) const
@@ -1423,7 +1423,7 @@ bool ERMInterpreter::isATrigger( const ERM::TLine & line )
 {
 	if(std::holds_alternative<ERM::TVExp>(line))
 	{
-		TVExp vexp = std::get<TVExp>(line);
+		auto vexp = std::get<TVExp>(line);
 		if(vexp.children.empty())
 			return false;
 
@@ -1442,7 +1442,7 @@ bool ERMInterpreter::isATrigger( const ERM::TLine & line )
 	}
 	else if(std::holds_alternative<TERMline>(line))
 	{
-		TERMline ermline = std::get<TERMline>(line);
+		auto ermline = std::get<TERMline>(line);
 		return std::holds_alternative<ERM::Tcommand>(ermline) && isCMDATrigger( std::get<ERM::Tcommand>(ermline) );
 	}
 	else
@@ -1511,10 +1511,10 @@ ERM::TTriggerBase & ERMInterpreter::retrieveTrigger(ERM::TLine & line)
 {
 	if(std::holds_alternative<ERM::TERMline>(line))
 	{
-		ERM::TERMline &tl = std::get<ERM::TERMline>(line);
+		auto &tl = std::get<ERM::TERMline>(line);
 		if(std::holds_alternative<ERM::Tcommand>(tl))
 		{
-			ERM::Tcommand &tcm = std::get<ERM::Tcommand>(tl);
+			auto &tcm = std::get<ERM::Tcommand>(tl);
 			if(std::holds_alternative<ERM::Ttrigger>(tcm.cmd))
 			{
 				return std::get<ERM::Ttrigger>(tcm.cmd);

+ 2 - 2
scripting/lua/api/Registry.cpp

@@ -22,7 +22,7 @@ Registry::Registry() = default;
 
 Registry * Registry::get()
 {
-	static std::unique_ptr<Registry> Instance = std::unique_ptr<Registry>(new Registry());
+	static auto Instance = std::unique_ptr<Registry>(new Registry());
 	return Instance.get();
 }
 
@@ -53,7 +53,7 @@ TypeRegistry::TypeRegistry()
 
 TypeRegistry * TypeRegistry::get()
 {
-	static std::unique_ptr<TypeRegistry> Instance = std::unique_ptr<TypeRegistry>(new TypeRegistry());
+	static auto Instance = std::unique_ptr<TypeRegistry>(new TypeRegistry());
 	return Instance.get();
 }
 

+ 1 - 1
server/CVCMIServer.cpp

@@ -294,7 +294,7 @@ bool CVCMIServer::prepareToStartGame()
 	Load::ProgressAccumulator progressTracking;
 	Load::Progress current(1);
 	progressTracking.include(current);
-	Load::Type currentProgress = std::numeric_limits<Load::Type>::max();
+	auto currentProgress = std::numeric_limits<Load::Type>::max();
 	
 	auto progressTrackingThread = boost::thread([this, &progressTracking, &currentProgress]()
 	{

+ 3 - 3
test/entity/CCreatureTest.cpp

@@ -107,7 +107,7 @@ TEST_F(CCreatureTest, DISABLED_JsonAddBonus)
 {
 	JsonNode data(JsonNode::JsonType::DATA_STRUCT);
 
-	std::shared_ptr<Bonus> b = std::make_shared<Bonus>(BonusDuration::PERMANENT, BonusType::BLOCKS_RETALIATION, BonusSource::CREATURE_ABILITY, 17, BonusSourceID(CreatureID(42)), BonusSubtypeID(CreatureID(43)), BonusValueType::BASE_NUMBER);
+	auto b = std::make_shared<Bonus>(BonusDuration::PERMANENT, BonusType::BLOCKS_RETALIATION, BonusSource::CREATURE_ABILITY, 17, BonusSourceID(CreatureID(42)), BonusSubtypeID(CreatureID(43)), BonusValueType::BASE_NUMBER);
 
 	JsonNode & toAdd = data["bonuses"]["toAdd"];
 
@@ -133,10 +133,10 @@ TEST_F(CCreatureTest, DISABLED_JsonRemoveBonus)
 {
 	JsonNode data(JsonNode::JsonType::DATA_STRUCT);
 
-	std::shared_ptr<Bonus> b1 = std::make_shared<Bonus>(BonusDuration::PERMANENT, BonusType::BLOCKS_RETALIATION, BonusSource::CREATURE_ABILITY, 17, BonusSourceID(CreatureID(42)), BonusSubtypeID(CreatureID(43)), BonusValueType::BASE_NUMBER);
+	auto b1 = std::make_shared<Bonus>(BonusDuration::PERMANENT, BonusType::BLOCKS_RETALIATION, BonusSource::CREATURE_ABILITY, 17, BonusSourceID(CreatureID(42)), BonusSubtypeID(CreatureID(43)), BonusValueType::BASE_NUMBER);
 	subject->addNewBonus(b1);
 
-	std::shared_ptr<Bonus> b2 = std::make_shared<Bonus>(BonusDuration::PERMANENT, BonusType::BLOCKS_RETALIATION, BonusSource::CREATURE_ABILITY, 18, BonusSourceID(CreatureID(42)), BonusSubtypeID(CreatureID(43)), BonusValueType::BASE_NUMBER);
+	auto b2 = std::make_shared<Bonus>(BonusDuration::PERMANENT, BonusType::BLOCKS_RETALIATION, BonusSource::CREATURE_ABILITY, 18, BonusSourceID(CreatureID(42)), BonusSubtypeID(CreatureID(43)), BonusValueType::BASE_NUMBER);
 	subject->addNewBonus(b2);
 
 

+ 4 - 4
test/erm/ERM_MA.cpp

@@ -87,13 +87,13 @@ TEST_F(ERM_MA, Example)
 	creatureBonuses.addNewBonus(std::make_shared<Bonus>(BonusDuration::PERMANENT, BonusType::FLYING, BonusSource::CREATURE_ABILITY, 0, 0));
 	creatureBonuses.addNewBonus(std::make_shared<Bonus>(BonusDuration::PERMANENT, Bonus::KING, BonusSource::CREATURE_ABILITY, 0, 0));
 
-	std::shared_ptr<Bonus> removed = std::make_shared<Bonus>(BonusDuration::PERMANENT, Bonus::MIND_IMMUNITY, BonusSource::CREATURE_ABILITY, 0, 0);
+	auto removed = std::make_shared<Bonus>(BonusDuration::PERMANENT, Bonus::MIND_IMMUNITY, BonusSource::CREATURE_ABILITY, 0, 0);
 
 	creatureBonuses.addNewBonus(removed);
 	creatureBonuses.addNewBonus(std::make_shared<Bonus>(BonusDuration::PERMANENT, Bonus::NO_MORALE, BonusSource::CREATURE_ABILITY, 0, 0));
 	creatureBonuses.addNewBonus(std::make_shared<Bonus>(BonusDuration::PERMANENT, BonusType::UNDEAD, BonusSource::CREATURE_ABILITY, 0, 0));
 
-	std::shared_ptr<Bonus> added = std::make_shared<Bonus>(BonusDuration::PERMANENT, Bonus::NO_MELEE_PENALTY, BonusSource::CREATURE_ABILITY, 0, 0);
+	auto added = std::make_shared<Bonus>(BonusDuration::PERMANENT, Bonus::NO_MELEE_PENALTY, BonusSource::CREATURE_ABILITY, 0, 0);
 
 
 	EXPECT_CALL(oldCreature, getRecruitCost(Eq(6))).WillOnce(Return(COST));
@@ -206,13 +206,13 @@ TEST_F(ERM_MA, Bonuses)
 	creatureBonuses.addNewBonus(std::make_shared<Bonus>(BonusDuration::PERMANENT, BonusType::FLYING, BonusSource::CREATURE_ABILITY, 0, 0));
 	creatureBonuses.addNewBonus(std::make_shared<Bonus>(BonusDuration::PERMANENT, Bonus::KING, BonusSource::CREATURE_ABILITY, 0, 0));
 
-	std::shared_ptr<Bonus> removed = std::make_shared<Bonus>(BonusDuration::PERMANENT, Bonus::MIND_IMMUNITY, BonusSource::CREATURE_ABILITY, 0, 0);
+	auto removed = std::make_shared<Bonus>(BonusDuration::PERMANENT, Bonus::MIND_IMMUNITY, BonusSource::CREATURE_ABILITY, 0, 0);
 
 	creatureBonuses.addNewBonus(removed);
 	creatureBonuses.addNewBonus(std::make_shared<Bonus>(BonusDuration::PERMANENT, Bonus::NO_MORALE, BonusSource::CREATURE_ABILITY, 0, 0));
 	creatureBonuses.addNewBonus(std::make_shared<Bonus>(BonusDuration::PERMANENT, BonusType::UNDEAD, BonusSource::CREATURE_ABILITY, 0, 0));
 
-	std::shared_ptr<Bonus> added = std::make_shared<Bonus>(BonusDuration::PERMANENT, Bonus::NO_MELEE_PENALTY, BonusSource::CREATURE_ABILITY, 0, 0);
+	auto added = std::make_shared<Bonus>(BonusDuration::PERMANENT, Bonus::NO_MELEE_PENALTY, BonusSource::CREATURE_ABILITY, 0, 0);
 
 	EXPECT_CALL(oldCreature, isDoubleWide()).WillRepeatedly(Return(false));
 

+ 1 - 1
test/events/EventBusTest.cpp

@@ -28,7 +28,7 @@ public:
 public:
 	static SubscriptionRegistry<EventExample> * getRegistry()
 	{
-		static std::unique_ptr<SubscriptionRegistry<EventExample>> Instance = std::make_unique<SubscriptionRegistry<EventExample>>();
+		static auto Instance = std::make_unique<SubscriptionRegistry<EventExample>>();
 		return Instance.get();
 	}
 

+ 1 - 1
test/map/CMapFormatTest.cpp

@@ -44,7 +44,7 @@ TEST(MapFormat, DISABLED_Random)
 
 	CMapGenOptions opt;
 	CRmgTemplate tmpl;
-	std::shared_ptr<ZoneOptionsFake> zoneOptions = std::make_shared<ZoneOptionsFake>();
+	auto zoneOptions = std::make_shared<ZoneOptionsFake>();
 
 	const_cast<CRmgTemplate::CPlayerCountRange &>(tmpl.getHumanPlayers()).addRange(1, 4);
 	const_cast<CRmgTemplate::Zones &>(tmpl.getZones())[0] = zoneOptions;

+ 1 - 1
test/rmg/CRmgTemplateTest.cpp

@@ -34,7 +34,7 @@ protected:
 
 	void testLoadSave(const std::string & id, const JsonNode & config)
 	{
-		std::shared_ptr<CRmgTemplate> subject = std::make_shared<CRmgTemplate>();
+		auto subject = std::make_shared<CRmgTemplate>();
 		subject->setId(id);
 
 		{

+ 3 - 3
test/spells/effects/CatapultTest.cpp

@@ -50,7 +50,7 @@ TEST_F(CatapultTest, NotApplicableWithoutTown)
 
 TEST_F(CatapultTest, NotApplicableInVillage)
 {
-	std::shared_ptr<CGTownInstance> fakeTown = std::make_shared<CGTownInstance>();
+	auto fakeTown = std::make_shared<CGTownInstance>();
 
 	EXPECT_CALL(*battleFake, getDefendedTown()).WillRepeatedly(Return(fakeTown.get()));
 	EXPECT_CALL(mechanicsMock, adaptProblem(_, _)).WillOnce(Return(false));
@@ -62,7 +62,7 @@ TEST_F(CatapultTest, NotApplicableInVillage)
 
 TEST_F(CatapultTest, NotApplicableForDefenderIfSmart)
 {
-	std::shared_ptr<CGTownInstance> fakeTown = std::make_shared<CGTownInstance>();
+	auto fakeTown = std::make_shared<CGTownInstance>();
 	fakeTown->builtBuildings.insert(BuildingID::FORT);
 	mechanicsMock.casterSide = BattleSide::DEFENDER;
 
@@ -76,7 +76,7 @@ TEST_F(CatapultTest, NotApplicableForDefenderIfSmart)
 
 TEST_F(CatapultTest, DISABLED_ApplicableInTown)
 {
-	std::shared_ptr<CGTownInstance> fakeTown = std::make_shared<CGTownInstance>();
+	auto fakeTown = std::make_shared<CGTownInstance>();
 	fakeTown->builtBuildings.insert(BuildingID::FORT);
 
 	EXPECT_CALL(*battleFake, getDefendedTown()).WillRepeatedly(Return(fakeTown.get()));

+ 3 - 3
test/spells/effects/DamageTest.cpp

@@ -104,7 +104,7 @@ TEST_F(DamageApplyTest, DISABLED_DoesDamageToAliveUnit)
 
 	unitsFake.setDefaultBonusExpectations();
 
-	std::shared_ptr<CUnitState> targetUnitState = std::make_shared<CUnitStateDetached>(&targetUnit, &targetUnit);
+	auto targetUnitState = std::make_shared<CUnitStateDetached>(&targetUnit, &targetUnit);
 	targetUnitState->localInit(&unitEnvironmentMock);
 	EXPECT_CALL(targetUnit, acquireState()).WillOnce(Return(targetUnitState));
 	EXPECT_CALL(*battleFake, setUnitState(Eq(unitId),_, Lt(0))).Times(1);
@@ -168,7 +168,7 @@ TEST_F(DamageApplyTest, DISABLED_DoesDamageByPercent)
 
 	unitsFake.setDefaultBonusExpectations();
 
-	std::shared_ptr<CUnitState> targetUnitState = std::make_shared<CUnitStateDetached>(&targetUnit, &targetUnit);
+	auto targetUnitState = std::make_shared<CUnitStateDetached>(&targetUnit, &targetUnit);
 	targetUnitState->localInit(&unitEnvironmentMock);
 	EXPECT_CALL(targetUnit, acquireState()).WillOnce(Return(targetUnitState));
 
@@ -212,7 +212,7 @@ TEST_F(DamageApplyTest, DISABLED_DoesDamageByCount)
 
 	unitsFake.setDefaultBonusExpectations();
 
-	std::shared_ptr<CUnitState> targetUnitState = std::make_shared<CUnitStateDetached>(&targetUnit, &targetUnit);
+	auto targetUnitState = std::make_shared<CUnitStateDetached>(&targetUnit, &targetUnit);
 	targetUnitState->localInit(&unitEnvironmentMock);
 	EXPECT_CALL(targetUnit, acquireState()).WillOnce(Return(targetUnitState));
 

+ 1 - 1
test/spells/effects/HealTest.cpp

@@ -352,7 +352,7 @@ TEST_P(HealApplyTest, DISABLED_Heals)
 
 	unitsFake.setDefaultBonusExpectations();
 
-	std::shared_ptr<CUnitState> targetUnitState = std::make_shared<CUnitStateDetached>(&targetUnit, &targetUnit);
+	auto targetUnitState = std::make_shared<CUnitStateDetached>(&targetUnit, &targetUnit);
 	targetUnitState->localInit(&unitEnvironmentMock);
 	{
 		int64_t initialDmg = unitAmount * unitHP / 2 - 1;