Index: source/graphics/CinemaManager.cpp =================================================================== --- source/graphics/CinemaManager.cpp +++ source/graphics/CinemaManager.cpp @@ -1,4 +1,4 @@ -/* Copyright (C) 2019 Wildfire Games. +/* Copyright (C) 2020 Wildfire Games. * This file is part of 0 A.D. * * 0 A.D. is free software: you can redistribute it and/or modify @@ -76,7 +76,7 @@ if (!cmpCinemaManager) return; - for (const std::pair& p : cmpCinemaManager->GetPaths()) + for (const std::pair& p : cmpCinemaManager->GetPaths()) { DrawSpline(p.second, CColor(0.2f, 0.2f, 1.f, 0.9f), 128, true); DrawNodes(p.second, CColor(0.1f, 1.f, 0.f, 1.f)); Index: source/graphics/ObjectEntry.cpp =================================================================== --- source/graphics/ObjectEntry.cpp +++ source/graphics/ObjectEntry.cpp @@ -1,4 +1,4 @@ -/* Copyright (C) 2016 Wildfire Games. +/* Copyright (C) 2020 Wildfire Games. * This file is part of 0 A.D. * * 0 A.D. is free software: you can redistribute it and/or modify @@ -46,7 +46,7 @@ CObjectEntry::~CObjectEntry() { - for (const std::pair& anim : m_Animations) + for (const std::pair& anim : m_Animations) delete anim.second; delete m_Model; Index: source/graphics/ObjectManager.cpp =================================================================== --- source/graphics/ObjectManager.cpp +++ source/graphics/ObjectManager.cpp @@ -1,4 +1,4 @@ -/* Copyright (C) 2015 Wildfire Games. +/* Copyright (C) 2020 Wildfire Games. * This file is part of 0 A.D. * * 0 A.D. is free software: you can redistribute it and/or modify @@ -170,11 +170,11 @@ void CObjectManager::UnloadObjects() { - for (const std::pair& p : m_Objects) + for (const std::pair& p : m_Objects) delete p.second; m_Objects.clear(); - for (const std::pair& p : m_ObjectBases) + for (const std::pair& p : m_ObjectBases) delete p.second; m_ObjectBases.clear(); } Index: source/graphics/TerrainTextureManager.cpp =================================================================== --- source/graphics/TerrainTextureManager.cpp +++ source/graphics/TerrainTextureManager.cpp @@ -1,4 +1,4 @@ -/* Copyright (C) 2016 Wildfire Games. +/* Copyright (C) 2020 Wildfire Games. * This file is part of 0 A.D. * * 0 A.D. is free software: you can redistribute it and/or modify @@ -63,7 +63,7 @@ delete te; m_TextureEntries.clear(); - for (const std::pair& tg : m_TerrainGroups) + for (const std::pair& tg : m_TerrainGroups) delete tg.second; m_TerrainGroups.clear(); Index: source/graphics/Unit.cpp =================================================================== --- source/graphics/Unit.cpp +++ source/graphics/Unit.cpp @@ -1,4 +1,4 @@ -/* Copyright (C) 2016 Wildfire Games. +/* Copyright (C) 2020 Wildfire Games. * This file is part of 0 A.D. * * 0 A.D. is free software: you can redistribute it and/or modify @@ -90,7 +90,7 @@ void CUnit::SetEntitySelection(const std::map& selections) { - for (const std::pair& s : selections) + for (const std::pair& s : selections) m_EntitySelections[s.first] = s.second.LowerCase(); ReloadObject(); @@ -105,7 +105,7 @@ void CUnit::ReloadObject() { std::set entitySelections; - for (const std::pair& selection : m_EntitySelections) + for (const std::pair& selection : m_EntitySelections) entitySelections.insert(selection.second); std::vector > selections; selections.push_back(entitySelections); Index: source/gui/CGUI.cpp =================================================================== --- source/gui/CGUI.cpp +++ source/gui/CGUI.cpp @@ -77,10 +77,10 @@ CGUI::~CGUI() { - for (const std::pair& p : m_pAllObjects) + for (const std::pair& p : m_pAllObjects) delete p.second; - for (const std::pair& p : m_Sprites) + for (const std::pair& p : m_Sprites) delete p.second; } Index: source/gui/ObjectBases/IGUIObject.cpp =================================================================== --- source/gui/ObjectBases/IGUIObject.cpp +++ source/gui/ObjectBases/IGUIObject.cpp @@ -74,7 +74,7 @@ IGUIObject::~IGUIObject() { - for (const std::pair& p : m_Settings) + for (const std::pair& p : m_Settings) delete p.second; if (!m_ScriptHandlers.empty()) @@ -282,7 +282,7 @@ // Other styles are reported if they specify a Setting that does not exist, // so that the XML author is informed and can correct the style. - for (const std::pair& p : m_pGUI.GetStyle(StyleName).m_SettingsDefaults) + for (const std::pair& p : m_pGUI.GetStyle(StyleName).m_SettingsDefaults) { if (SettingExists(p.first)) SetSettingFromString(p.first, p.second, true); Index: source/gui/ObjectTypes/CDropDown.cpp =================================================================== --- source/gui/ObjectTypes/CDropDown.cpp +++ source/gui/ObjectTypes/CDropDown.cpp @@ -1,4 +1,4 @@ -/* Copyright (C) 2019 Wildfire Games. +/* Copyright (C) 2020 Wildfire Games. * This file is part of 0 A.D. * * 0 A.D. is free software: you can redistribute it and/or modify @@ -307,8 +307,7 @@ // If we have inputed a character try to get the closest element to it. // TODO: not too nice and doesn't deal with dashes. if (m_Open && ((szChar >= SDLK_a && szChar <= SDLK_z) || szChar == SDLK_SPACE - || (szChar >= SDLK_0 && szChar <= SDLK_9) - || (szChar >= SDLK_KP_0 && szChar <= SDLK_KP_9))) + || (szChar >= SDLK_0 && szChar <= SDLK_9))) { // arbitrary 1 second limit to add to string or start fresh. // maximal amount of characters is 100, which imo is far more than enough. Index: source/lib/code_annotation.h =================================================================== --- source/lib/code_annotation.h +++ source/lib/code_annotation.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2019 Wildfire Games. +/* Copyright (c) 2020 Wildfire Games. * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the @@ -79,6 +79,9 @@ #if GCC_VERSION # define NOTHROW_DECLARE __attribute__((nothrow)) # define NOTHROW_DEFINE // not supported for definitions +#elif CLANG_VERSION +# define NOTHROW_DECLARE __attribute__((nothrow)) +# define NOTHROW_DEFINE // not supported for definitions #elif MSC_VERSION // Kevin Frei, 2006-03-23: "I work on the Visual C++ compiler team, // and agree completely with Paul Parks: don't use throw(), because Index: source/lib/path.h =================================================================== --- source/lib/path.h +++ source/lib/path.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2019 Wildfire Games. +/* Copyright (C) 2020 Wildfire Games. * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the @@ -287,7 +287,7 @@ // annoying and inefficient. we allow either type of separators, // appending whichever was first encountered. when modifying the path, // we ensure the same separator is used. - wchar_t separator; + wchar_t separator = '/'; }; static inline std::wostream& operator<<(std::wostream& s, const Path& path) Index: source/lib/res/h_mgr.cpp =================================================================== --- source/lib/res/h_mgr.cpp +++ source/lib/res/h_mgr.cpp @@ -557,11 +557,10 @@ #endif hd->pathname.~VfsPath(); // FIXME: ugly hack, but necessary to reclaim memory - memset(hd, 0, sizeof(*hd)); + *hd = {}; pool_free(&hpool, hd); } - Status h_free(Handle& h, H_Type type) { std::lock_guard lock(h_mutex); Index: source/lobby/XmppClient.cpp =================================================================== --- source/lobby/XmppClient.cpp +++ source/lobby/XmppClient.cpp @@ -543,7 +543,7 @@ ScriptInterface::CreateArray(rq, ret); int j = 0; - for (const std::pair& p : m_PlayerMap) + for (const std::pair& p : m_PlayerMap) { JS::RootedValue player(rq.cx); Index: source/network/NetClient.cpp =================================================================== --- source/network/NetClient.cpp +++ source/network/NetClient.cpp @@ -277,7 +277,7 @@ JS::RootedValue newAssignments(rq.cx); ScriptInterface::CreateObject(rq, &newAssignments); - for (const std::pair& p : m_PlayerAssignments) + for (const std::pair& p : m_PlayerAssignments) { JS::RootedValue assignment(rq.cx); Index: source/network/NetServer.cpp =================================================================== --- source/network/NetServer.cpp +++ source/network/NetServer.cpp @@ -738,7 +738,7 @@ { // Find all player IDs in active use; we mustn't give them to a second player (excluding the unassigned ID: -1) std::set usedIDs; - for (const std::pair& p : m_PlayerAssignments) + for (const std::pair& p : m_PlayerAssignments) if (p.second.m_Enabled && p.second.m_PlayerID != -1) usedIDs.insert(p.second.m_PlayerID); Index: source/network/NetServerTurnManager.cpp =================================================================== --- source/network/NetServerTurnManager.cpp +++ source/network/NetServerTurnManager.cpp @@ -72,7 +72,7 @@ void CNetServerTurnManager::CheckClientsReady() { // See if all clients (including self) are ready for a new turn - for (const std::pair& clientReady : m_ClientsReady) + for (const std::pair& clientReady : m_ClientsReady) { NETSERVERTURN_LOG(" %d: %d <=? %d\n", clientReady.first, clientReady.second, m_ReadyTurn); if (clientReady.second <= m_ReadyTurn) @@ -122,7 +122,7 @@ // Find the newest turn which we know all clients have simulated u32 newest = std::numeric_limits::max(); - for (const std::pair& clientSimulated : m_ClientsSimulated) + for (const std::pair& clientSimulated : m_ClientsSimulated) if (clientSimulated.second < newest) newest = clientSimulated.second; @@ -137,7 +137,7 @@ // Find all players that are OOS on that turn std::vector OOSPlayerNames; - for (const std::pair& hashPair : clientStateHash.second) + for (const std::pair& hashPair : clientStateHash.second) { NETSERVERTURN_LOG("sync check %d: %d = %hs\n", it->first, cit->first, Hexify(cit->second).c_str()); if (hashPair.second != expected) Index: source/ps/ConfigDB.cpp =================================================================== --- source/ps/ConfigDB.cpp +++ source/ps/ConfigDB.cpp @@ -1,4 +1,4 @@ -/* Copyright (C) 2019 Wildfire Games. +/* Copyright (C) 2020 Wildfire Games. * This file is part of 0 A.D. * * 0 A.D. is free software: you can redistribute it and/or modify @@ -188,11 +188,11 @@ // Loop upwards so that values in later namespaces can override // values in earlier namespaces for (int search_ns = 0; search_ns <= ns; ++search_ns) - for (const std::pair& p : m_Map[search_ns]) + for (const std::pair& p : m_Map[search_ns]) if (boost::algorithm::starts_with(p.first, prefix)) ret[p.first] = p.second; - for (const std::pair& p : m_Map[CFG_COMMAND]) + for (const std::pair& p : m_Map[CFG_COMMAND]) if (boost::algorithm::starts_with(p.first, prefix)) ret[p.first] = p.second; @@ -431,7 +431,8 @@ shared_ptr buf; AllocateAligned(buf, 1*MiB, maxSectorSize); char* pos = (char*)buf.get(); - for (const std::pair& p : m_Map[ns]) + + for (const std::pair& p : m_Map[ns]) { size_t i; pos += sprintf(pos, "%s = ", p.first.c_str()); Index: source/ps/Hotkey.cpp =================================================================== --- source/ps/Hotkey.cpp +++ source/ps/Hotkey.cpp @@ -40,7 +40,7 @@ // all key combinations that trigger it. static void LoadConfigBindings() { - for (const std::pair& configPair : g_ConfigDB.GetValuesWithPrefix(CFG_COMMAND, "hotkey.")) + for (const std::pair& configPair : g_ConfigDB.GetValuesWithPrefix(CFG_COMMAND, "hotkey.")) { std::string hotkeyName = configPair.first.substr(7); // strip the "hotkey." prefix for (const CStr& hotkey : configPair.second) @@ -93,7 +93,7 @@ // Set up the state of the hotkeys given no key is down. // i.e. find those hotkeys triggered by all negations. - for (const std::pair& p : g_HotkeyMap) + for (const std::pair& p : g_HotkeyMap) for (const SHotkeyMapping& hotkey : p.second) { if (!hotkey.negated) Index: source/ps/ProfileViewer.cpp =================================================================== --- source/ps/ProfileViewer.cpp +++ source/ps/ProfileViewer.cpp @@ -402,10 +402,11 @@ namespace { - struct WriteTable + class WriteTable { - std::ofstream& f; + public: WriteTable(std::ofstream& f) : f(f) {} + WriteTable(const WriteTable& writeTable) = default; void operator() (AbstractProfileTable* table) { @@ -480,6 +481,7 @@ } private: + std::ofstream& f; const WriteTable& operator=(const WriteTable&); }; Index: source/ps/Profiler2.cpp =================================================================== --- source/ps/Profiler2.cpp +++ source/ps/Profiler2.cpp @@ -1,4 +1,4 @@ -/* Copyright (C) 2019 Wildfire Games. +/* Copyright (C) 2020 Wildfire Games. * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the @@ -587,7 +587,7 @@ curTime += 0.000001; } // sub-events, aggregated - for (const std::pair& type : timeByType) + for (const std::pair& type : timeByType) { CProfiler2::SItem_dt_id item = { (float)curTime, std::get<0>(type.second) }; buffer[writePos] = (u8)CProfiler2::ITEM_ENTER; Index: source/ps/XML/XeroXMB.h =================================================================== --- source/ps/XML/XeroXMB.h +++ source/ps/XML/XeroXMB.h @@ -195,7 +195,7 @@ typedef std::forward_iterator_tag iterator_category; iterator(size_t size, const char* ptr, const char* endptr = NULL) - : m_Size(size), m_CurItemID(endptr ? size : 0), m_CurPointer(endptr ? endptr : ptr), m_Pointer(ptr) {} + : m_Size(size), m_CurItemID(endptr ? size : 0), m_CurPointer(endptr ? endptr : ptr) {} XMBElement operator*() const { return XMBElement(m_CurPointer); } XMBElement operator->() const { return **this; } iterator& operator++(); @@ -211,7 +211,6 @@ size_t m_Size; size_t m_CurItemID; const char* m_CurPointer; - const char* m_Pointer; }; iterator begin() { return iterator(m_Size, m_Pointer); } iterator end() { return iterator(m_Size, m_Pointer, m_EndPointer); } @@ -264,7 +263,7 @@ typedef std::forward_iterator_tag iterator_category; iterator(size_t size, const char* ptr, const char* endptr = NULL) - : m_Size(size), m_CurItemID(endptr ? size : 0), m_CurPointer(endptr ? endptr : ptr), m_Pointer(ptr) {} + : m_Size(size), m_CurItemID(endptr ? size : 0), m_CurPointer(endptr ? endptr : ptr) {} XMBAttribute operator*() const; XMBAttribute operator->() const { return **this; } iterator& operator++(); @@ -280,7 +279,6 @@ size_t m_Size; size_t m_CurItemID; const char* m_CurPointer; - const char* m_Pointer; }; iterator begin() const { return iterator(m_Size, m_Pointer); } iterator end() const { return iterator(m_Size, m_Pointer, m_EndPointer); } Index: source/ps/scripting/JSInterface_Hotkey.cpp =================================================================== --- source/ps/scripting/JSInterface_Hotkey.cpp +++ source/ps/scripting/JSInterface_Hotkey.cpp @@ -75,7 +75,8 @@ JS::RootedValue hotkeyMap(rq.cx); std::unordered_map>> hotkeys; - for (const std::pair& key : g_HotkeyMap) + + for (const std::pair& key : g_HotkeyMap) for (const SHotkeyMapping& mapping : key.second) { std::vector keymap; Index: source/ps/scripting/JSInterface_ModIo.cpp =================================================================== --- source/ps/scripting/JSInterface_ModIo.cpp +++ source/ps/scripting/JSInterface_ModIo.cpp @@ -99,7 +99,7 @@ JS::RootedValue m(rq.cx); ScriptInterface::CreateObject(rq, &m); - for (const std::pair& prop : mod.properties) + for (const std::pair& prop : mod.properties) scriptInterface->SetProperty(m, prop.first.c_str(), prop.second, true); scriptInterface->SetProperty(m, "dependencies", mod.dependencies, true); Index: source/renderer/ModelRenderer.cpp =================================================================== --- source/renderer/ModelRenderer.cpp +++ source/renderer/ModelRenderer.cpp @@ -316,9 +316,12 @@ struct SMRMaterialBucketKey { +public: SMRMaterialBucketKey(CStrIntern effect, const CShaderDefines& defines) : effect(effect), defines(defines) { } + SMRMaterialBucketKey(const SMRMaterialBucketKey& entity) = default; + CStrIntern effect; CShaderDefines defines; Index: source/renderer/PatchRData.cpp =================================================================== --- source/renderer/PatchRData.cpp +++ source/renderer/PatchRData.cpp @@ -1130,7 +1130,7 @@ ENSURE(!(streamflags & ~(STREAM_POS|STREAM_POSTOUV0|STREAM_POSTOUV1))); // Render each batch - for (const std::pair& streamBatch : batches) + for (const std::pair& streamBatch : batches) { GLsizei stride = sizeof(SBaseVertex); SBaseVertex *base = (SBaseVertex *)streamBatch.first->Bind(); @@ -1143,7 +1143,7 @@ shader->AssertPointersBound(); - for (const std::pair& batchIndexBuffer : streamBatch.second) + for (const std::pair& batchIndexBuffer : streamBatch.second) { batchIndexBuffer.first->Bind(); Index: source/renderer/TerrainRenderer.cpp =================================================================== --- source/renderer/TerrainRenderer.cpp +++ source/renderer/TerrainRenderer.cpp @@ -672,7 +672,7 @@ /*if (!g_RenderingOptions.GetPreferGLSL() && !superFancy) m->fancyWaterShader = g_Renderer.GetShaderManager().LoadProgram("arb/water_high", defines); else*/ - m->fancyWaterShader = g_Renderer.GetShaderManager().LoadProgram("glsl/water_high", defines); + m->fancyWaterShader = g_Renderer.GetShaderManager().LoadProgram("glsl/water_high", defines); if (!m->fancyWaterShader) { Index: source/simulation2/components/CCmpCinemaManager.cpp =================================================================== --- source/simulation2/components/CCmpCinemaManager.cpp +++ source/simulation2/components/CCmpCinemaManager.cpp @@ -1,4 +1,4 @@ -/* Copyright (C) 2017 Wildfire Games. +/* Copyright (C) 2020 Wildfire Games. * This file is part of 0 A.D. * * 0 A.D. is free software: you can redistribute it and/or modify @@ -65,7 +65,7 @@ serializer.Bool("MapRevealed", m_MapRevealed); serializer.NumberU32_Unbounded("NumberOfPaths", m_Paths.size()); - for (const std::pair& it : m_Paths) + for (const std::pair& it : m_Paths) SerializePath(it.second, serializer); serializer.NumberU32_Unbounded("NumberOfQueuedPaths", m_PathQueue.size()); Index: source/simulation2/components/CCmpPathfinder.cpp =================================================================== --- source/simulation2/components/CCmpPathfinder.cpp +++ source/simulation2/components/CCmpPathfinder.cpp @@ -258,7 +258,7 @@ void CCmpPathfinder::GetPassabilityClasses(std::map& nonPathfindingPassClasses, std::map& pathfindingPassClasses) const { - for (const std::pair& pair : m_PassClassMasks) + for (const std::pair& pair : m_PassClassMasks) { if ((GetPassabilityFromMask(pair.second)->m_Obstructions == PathfinderPassability::PATHFINDING)) pathfindingPassClasses[pair.first] = pair.second; Index: source/simulation2/components/CCmpRangeManager.cpp =================================================================== --- source/simulation2/components/CCmpRangeManager.cpp +++ source/simulation2/components/CCmpRangeManager.cpp @@ -297,13 +297,16 @@ * It must only be passed entities that are in 'entities' * and are currently in the world. */ -struct EntityDistanceOrdering +class EntityDistanceOrdering { +public: EntityDistanceOrdering(const EntityMap& entities, const CFixedVector2D& source) : m_EntityData(entities), m_Source(source) { } + EntityDistanceOrdering(const EntityDistanceOrdering& entity) = default; + bool operator()(entity_id_t a, entity_id_t b) const { const EntityData& da = m_EntityData.find(a)->second; Index: source/simulation2/components/CCmpTemplateManager.cpp =================================================================== --- source/simulation2/components/CCmpTemplateManager.cpp +++ source/simulation2/components/CCmpTemplateManager.cpp @@ -1,4 +1,4 @@ -/* Copyright (C) 2017 Wildfire Games. +/* Copyright (C) 2020 Wildfire Games. * This file is part of 0 A.D. * * 0 A.D. is free software: you can redistribute it and/or modify @@ -61,7 +61,7 @@ { std::map> templateMap; - for (const std::pair& templateEnt : m_LatestTemplates) + for (const std::pair& templateEnt : m_LatestTemplates) if (!ENTITY_IS_LOCAL(templateEnt.first)) templateMap[templateEnt.second].push_back(templateEnt.first); @@ -72,9 +72,9 @@ { Init(paramNode); - std::map> templateMap; + std::map> templateMap; SerializeMap>()(deserialize, "templates", templateMap); - for (const std::pair>& mapEl : templateMap) + for (const std::pair>& mapEl : templateMap) for (entity_id_t id : mapEl.second) m_LatestTemplates[id] = mapEl.first; } @@ -219,7 +219,7 @@ std::vector CCmpTemplateManager::FindUsedTemplates() const { std::vector usedTemplates; - for (const std::pair& p : m_LatestTemplates) + for (const std::pair& p : m_LatestTemplates) if (std::find(usedTemplates.begin(), usedTemplates.end(), p.second) == usedTemplates.end()) usedTemplates.push_back(p.second); return usedTemplates; @@ -231,7 +231,7 @@ std::vector CCmpTemplateManager::GetEntitiesUsingTemplate(const std::string& templateName) const { std::vector entities; - for (const std::pair& p : m_LatestTemplates) + for (const std::pair& p : m_LatestTemplates) if (p.second == templateName) entities.push_back(p.first); Index: source/simulation2/components/CCmpTerritoryManager.cpp =================================================================== --- source/simulation2/components/CCmpTerritoryManager.cpp +++ source/simulation2/components/CCmpTerritoryManager.cpp @@ -459,14 +459,14 @@ // store the root influences to mark territory as connected std::vector rootInfluenceEntities; - for (const std::pair >& pair : influenceEntities) + for (const std::pair >& pair : influenceEntities) { // entityGrid stores the weight for a single entity, and is reset per entity Grid entityGrid(tilesW, tilesH); // playerGrid stores the combined weight of all entities for this player Grid playerGrid(tilesW, tilesH); - u8 owner = (u8)pair.first; + u8 owner = static_cast(pair.first); const std::vector& ents = pair.second; // With 2^16 entities, we're safe against overflows as the weight is also limited to 2^16 ENSURE(ents.size() < 1 << 16); Index: source/simulation2/helpers/HierarchicalPathfinder.cpp =================================================================== --- source/simulation2/helpers/HierarchicalPathfinder.cpp +++ source/simulation2/helpers/HierarchicalPathfinder.cpp @@ -467,7 +467,7 @@ if (!dirtinessGrid.any_set_in_square(i0, j0, i1, j1)) continue; - for (const std::pair& passClassMask : m_PassClassMasks) + for (const std::pair& passClassMask : m_PassClassMasks) { pass_class_t passClass = passClassMask.second; Chunk& a = m_Chunks[passClass].at(ci + cj*m_ChunksW); @@ -627,7 +627,8 @@ { // Use FindReachableRegions because we cannot be sure, even if we find a non-dirty chunk nearby, // that we weren't the only bridge connecting that chunk to the rest of the global region. - for (const std::pair >& regionsInNeed : needNewGlobalRegionMap) + for (const std::pair >& regionsInNeed : needNewGlobalRegionMap) + { for (const RegionID& reg : regionsInNeed.second) { std::map& globalRegions = m_GlobalRegions[regionsInNeed.first]; @@ -643,6 +644,7 @@ for (const RegionID& regionId : reachable) globalRegions[regionId] = ID; } + } } HierarchicalPathfinder::RegionID HierarchicalPathfinder::Get(u16 i, u16 j, pass_class_t passClass) const Index: source/soundmanager/SoundManager.cpp =================================================================== --- source/soundmanager/SoundManager.cpp +++ source/soundmanager/SoundManager.cpp @@ -1,4 +1,4 @@ -/* Copyright (C) 2019 Wildfire Games. +/* Copyright (C) 2020 Wildfire Games. * This file is part of 0 A.D. * * 0 A.D. is free software: you can redistribute it and/or modify @@ -275,7 +275,7 @@ } AL_CHECK; - for (const std::pair& p : m_SoundGroups) + for (const std::pair& p : m_SoundGroups) delete p.second; m_SoundGroups.clear(); Index: source/third_party/jsonspirit/json_spirit_value.h =================================================================== --- source/third_party/jsonspirit/json_spirit_value.h +++ source/third_party/jsonspirit/json_spirit_value.h @@ -32,7 +32,7 @@ { enum Value_type{ obj_type, array_type, str_type, bool_type, int_type, real_type, null_type }; - static std::string value_type_to_string( Value_type vtype ); + static inline std::string value_type_to_string( Value_type vtype ); struct Null{}; @@ -584,7 +584,7 @@ return internal_::get_value( *this, internal_::Type_to_type< T >() ); } - static std::string value_type_to_string( const Value_type vtype ) + static inline std::string value_type_to_string( const Value_type vtype ) { switch( vtype ) { Index: source/tools/atlas/AtlasUI/ScenarioEditor/Sections/Map/Map.cpp =================================================================== --- source/tools/atlas/AtlasUI/ScenarioEditor/Sections/Map/Map.cpp +++ source/tools/atlas/AtlasUI/ScenarioEditor/Sections/Map/Map.cpp @@ -239,7 +239,7 @@ m_MapSettingsVictoryConditions.insert(std::string(victoryCondition)); // Clear Checkboxes before loading data. We don't update victory condition just yet because it might reenable some of the checkboxes. - for (const std::pair& vc : m_VictoryConditions) + for (const std::pair& vc : m_VictoryConditions) { wxCheckBox* checkBox = wxDynamicCast(FindWindow(vc.first), wxCheckBox); if (!checkBox) @@ -249,7 +249,7 @@ checkBox->Enable(true); } - for (const std::pair& vc : m_VictoryConditions) + for (const std::pair& vc : m_VictoryConditions) { std::string escapedTitle = wxString::FromUTF8(vc.second["Data"]["Title"]).Lower().ToStdString(); std::replace(escapedTitle.begin(), escapedTitle.end(), ' ', '_'); @@ -298,20 +298,20 @@ AtObj victoryCondition; wxCheckBox* modifiedCheckbox = wxDynamicCast(FindWindow(controlId), wxCheckBox); - for (const std::pair& vc : m_VictoryConditions) + for (const std::pair& vc : m_VictoryConditions) { - if(vc.first != controlId) + if (vc.first != controlId) continue; - victoryCondition = vc.second; + victoryCondition = vc.second; break; } - if(modifiedCheckbox->GetValue()) + if (modifiedCheckbox->GetValue()) { for (AtIter victoryConditionPair = victoryCondition["Data"]["ChangeOnChecked"]; victoryConditionPair.defined(); ++victoryConditionPair) { - for (const std::pair& vc : m_VictoryConditions) + for (const std::pair& vc : m_VictoryConditions) { std::string escapedTitle = wxString::FromUTF8(vc.second["Data"]["Title"]).Lower().ToStdString(); std::replace(escapedTitle.begin(), escapedTitle.end(), ' ', '_'); @@ -325,7 +325,7 @@ } } - for (const std::pair& vc : m_VictoryConditions) + for (const std::pair& vc : m_VictoryConditions) { if (vc.first == controlId) continue; @@ -333,7 +333,7 @@ wxCheckBox* otherCheckbox = wxDynamicCast(FindWindow(vc.first), wxCheckBox); otherCheckbox->Enable(true); - for (const std::pair& vc2 : m_VictoryConditions) + for (const std::pair& vc2 : m_VictoryConditions) { for (AtIter victoryConditionTitle = vc2.second["Data"]["DisabledWhenChecked"]; victoryConditionTitle.defined(); ++victoryConditionTitle) { @@ -371,7 +371,7 @@ else \ m_MapSettingsVictoryConditions.erase(name); - for (const std::pair& vc : m_VictoryConditions) + for (const std::pair& vc : m_VictoryConditions) { std::string escapedTitle = wxString::FromUTF8(vc.second["Data"]["Title"]).Lower().ToStdString(); std::replace(escapedTitle.begin(), escapedTitle.end(), ' ', '_'); Index: source/tools/atlas/GameInterface/Handlers/CinemaHandler.cpp =================================================================== --- source/tools/atlas/GameInterface/Handlers/CinemaHandler.cpp +++ source/tools/atlas/GameInterface/Handlers/CinemaHandler.cpp @@ -1,4 +1,4 @@ -/* Copyright (C) 2017 Wildfire Games. +/* Copyright (C) 2020 Wildfire Games. * This file is part of 0 A.D. * * 0 A.D. is free software: you can redistribute it and/or modify @@ -491,9 +491,9 @@ CVector2D cursor; msg->pos->GetScreenSpace(cursor.X, cursor.Y); - for (const std::pair& p : cmpCinemaManager->GetPaths()) + for (const std::pair& p : cmpCinemaManager->GetPaths()) { - const CCinemaPath& path = p.second; + const CCinemaPath& path = p.second; if (isPathNodePicked(path, cursor, node, false) || isPathNodePicked(path.GetTargetSpline(), cursor, node, true)) { node.name = path.GetName(); Index: source/tools/atlas/GameInterface/Handlers/MapHandlers.cpp =================================================================== --- source/tools/atlas/GameInterface/Handlers/MapHandlers.cpp +++ source/tools/atlas/GameInterface/Handlers/MapHandlers.cpp @@ -518,10 +518,9 @@ const CFixedVector3D offset = CFixedVector3D(fixed::FromInt(offsetX), fixed::FromInt(0), fixed::FromInt(offsetZ)); const CSimulation2::InterfaceListUnordered& ents = sim.GetEntitiesWithInterfaceUnordered(IID_Selectable); - for (const std::pair& ent : ents) + for (const std::pair& ent : ents) { const entity_id_t entityId = ent.first; - CmpPtr cmpPosition(sim, entityId); if (cmpPosition && cmpPosition->IsInWorld() && Within(cmpPosition->GetPosition(), mapCenterX, mapCenterZ, radiusInTerrainUnits)) Index: source/tools/atlas/GameInterface/Handlers/ObjectHandlers.cpp =================================================================== --- source/tools/atlas/GameInterface/Handlers/ObjectHandlers.cpp +++ source/tools/atlas/GameInterface/Handlers/ObjectHandlers.cpp @@ -767,7 +767,7 @@ void SetPos(const std::map& map) { - for (const std::pair& p : map) + for (const std::pair& p : map) { CmpPtr cmpPosition(*g_Game->GetSimulation2(), p.first); if (!cmpPosition) @@ -859,7 +859,7 @@ void SetPos(const std::map& position, const std::map& angle) { - for (const std::pair& p : position) + for (const std::pair& p : position) { CmpPtr cmpPosition(*g_Game->GetSimulation2(), p.first); if (!cmpPosition) @@ -873,7 +873,7 @@ } - for (const std::pair& p: position) + for (const std::pair& p : position) CheckObstructionAndUpdateVisual(p.first); } @@ -963,7 +963,7 @@ void SetAngle(const std::map& angles) { - for (const std::pair& p : angles) + for (const std::pair& p : angles) { CmpPtr cmpPosition(*g_Game->GetSimulation2(), p.first); if (!cmpPosition) Index: source/tools/atlas/GameInterface/View.cpp =================================================================== --- source/tools/atlas/GameInterface/View.cpp +++ source/tools/atlas/GameInterface/View.cpp @@ -179,7 +179,7 @@ AtlasViewGame::~AtlasViewGame() { - for (const std::pair& p : m_SavedStates) + for (const std::pair& p : m_SavedStates) delete p.second; }