From fb92761c92605520262745d153b05393c46672cb Mon Sep 17 00:00:00 2001 From: leper Date: Wed, 13 Jan 2016 00:42:55 +0000 Subject: [PATCH] Use explicit types instead of auto. This was SVN commit r17642. --- source/graphics/CinemaManager.cpp | 4 ++-- source/graphics/ObjectEntry.cpp | 20 ++++++++----------- source/graphics/TerrainTextureManager.cpp | 6 +++--- source/gui/IGUIObject.cpp | 11 +++++----- .../gui/scripting/JSInterface_IGUIObject.cpp | 2 +- source/renderer/VertexBuffer.cpp | 10 +++++----- .../simulation2/components/CCmpAIManager.cpp | 6 +++--- .../serialization/StdDeserializer.cpp | 6 +++--- 8 files changed, 30 insertions(+), 35 deletions(-) diff --git a/source/graphics/CinemaManager.cpp b/source/graphics/CinemaManager.cpp index 904be50def..019627c9ef 100644 --- a/source/graphics/CinemaManager.cpp +++ b/source/graphics/CinemaManager.cpp @@ -187,8 +187,8 @@ void CCinemaManager::Render() return; // draw all paths - for (auto it : m_CinematicSimulationData.m_Paths) - it.second.Draw(); + for (const std::pair& p : m_CinematicSimulationData.m_Paths) + p.second.Draw(); } void CCinemaManager::DrawBars() const diff --git a/source/graphics/ObjectEntry.cpp b/source/graphics/ObjectEntry.cpp index 4427a4f105..eae43a9bda 100644 --- a/source/graphics/ObjectEntry.cpp +++ b/source/graphics/ObjectEntry.cpp @@ -1,4 +1,4 @@ -/* Copyright (C) 2015 Wildfire Games. +/* Copyright (C) 2016 Wildfire Games. * This file is part of 0 A.D. * * 0 A.D. is free software: you can redistribute it and/or modify @@ -81,15 +81,14 @@ bool CObjectEntry::BuildVariation(const std::vector >& selections { CMaterial material = g_Renderer.GetMaterialManager().LoadMaterial(m_Base->m_Material); - std::vector::iterator samp; - for (samp = m_Samplers.begin(); samp != m_Samplers.end(); ++samp) + for (const CObjectBase::Samp& samp : m_Samplers) { - CTextureProperties textureProps(samp->m_SamplerFile); + CTextureProperties textureProps(samp.m_SamplerFile); textureProps.SetWrap(GL_CLAMP_TO_BORDER); CTexturePtr texture = g_Renderer.GetTextureManager().CreateTexture(textureProps); // TODO: Should check which renderpath is selected and only preload the necessary textures. texture->Prefetch(); - material.AddSampler(CMaterial::TextureSampler(samp->m_SamplerName, texture)); + material.AddSampler(CMaterial::TextureSampler(samp.m_SamplerName, texture)); } SDecal decal(material, @@ -133,7 +132,7 @@ bool CObjectEntry::BuildVariation(const std::vector >& selections if (m_Samplers.empty()) LOGERROR("Actor '%s' has no textures.", utf8_from_wstring(m_Base->m_ShortName)); - for (const auto& samp : m_Samplers) + for (const CObjectBase::Samp& samp : m_Samplers) { CTextureProperties textureProps(samp.m_SamplerFile); textureProps.SetWrap(GL_CLAMP_TO_EDGE); @@ -145,11 +144,10 @@ bool CObjectEntry::BuildVariation(const std::vector >& selections model->GetMaterial().AddSampler(CMaterial::TextureSampler(samp.m_SamplerName, texture)); } - const std::vector& requiredSamplers = model->GetMaterial().GetRequiredSampler(); - for (const auto& requSampName : requiredSamplers) + for (const CStrIntern& requSampName : model->GetMaterial().GetRequiredSampler()) { if (std::find_if(m_Samplers.begin(), m_Samplers.end(), - [&](CObjectBase::Samp sampler) { return sampler.m_SamplerName == requSampName; }) == m_Samplers.end()) + [&](const CObjectBase::Samp& sampler) { return sampler.m_SamplerName == requSampName; }) == m_Samplers.end()) LOGERROR("Actor %s: required texture sampler %s not found (material %s)", utf8_from_wstring(m_Base->m_ShortName), requSampName.string().c_str(), m_Base->m_Material.string8().c_str()); } @@ -193,10 +191,8 @@ bool CObjectEntry::BuildVariation(const std::vector >& selections // build props - TODO, RC - need to fix up bounds here // TODO: Make sure random variations get handled correctly when a prop fails - for (size_t p = 0; p < props.size(); p++) + for (const CObjectBase::Prop& prop : props) { - const CObjectBase::Prop& prop = props[p]; - // Pluck out the special attachpoint 'projectile' if (prop.m_PropPointName == "projectile") { diff --git a/source/graphics/TerrainTextureManager.cpp b/source/graphics/TerrainTextureManager.cpp index 874d194d9b..557f3cc54a 100644 --- a/source/graphics/TerrainTextureManager.cpp +++ b/source/graphics/TerrainTextureManager.cpp @@ -1,4 +1,4 @@ -/* Copyright (C) 2015 Wildfire Games. +/* Copyright (C) 2016 Wildfire Games. * This file is part of 0 A.D. * * 0 A.D. is free software: you can redistribute it and/or modify @@ -91,7 +91,7 @@ CTerrainTextureEntry* CTerrainTextureManager::AddTexture(const CTerrainPropertie void CTerrainTextureManager::DeleteTexture(CTerrainTextureEntry* entry) { - auto it = std::find(m_TextureEntries.begin(), m_TextureEntries.end(), entry); + std::vector::iterator it = std::find(m_TextureEntries.begin(), m_TextureEntries.end(), entry); if (it != m_TextureEntries.end()) m_TextureEntries.erase(it); @@ -148,7 +148,7 @@ void CTerrainGroup::AddTerrain(CTerrainTextureEntry* pTerrain) void CTerrainGroup::RemoveTerrain(CTerrainTextureEntry* pTerrain) { - auto it = find(m_Terrains.begin(), m_Terrains.end(), pTerrain); + std::vector::iterator it = find(m_Terrains.begin(), m_Terrains.end(), pTerrain); if (it != m_Terrains.end()) m_Terrains.erase(it); } diff --git a/source/gui/IGUIObject.cpp b/source/gui/IGUIObject.cpp index f60bbff9df..f766e821df 100644 --- a/source/gui/IGUIObject.cpp +++ b/source/gui/IGUIObject.cpp @@ -453,7 +453,7 @@ InReaction IGUIObject::SendEvent(EGUIMessageType type, const CStr& EventName) void IGUIObject::ScriptEvent(const CStr& Action) { - auto it = m_ScriptHandlers.find(Action); + std::map>::iterator it = m_ScriptHandlers.find(Action); if (it == m_ScriptHandlers.end()) return; @@ -482,7 +482,7 @@ void IGUIObject::ScriptEvent(const CStr& Action) void IGUIObject::ScriptEvent(const CStr& Action, JS::HandleValue Argument) { - auto it = m_ScriptHandlers.find(Action); + std::map>::iterator it = m_ScriptHandlers.find(Action); if (it == m_ScriptHandlers.end()) return; @@ -540,18 +540,17 @@ bool IGUIObject::IsFocused() const bool IGUIObject::IsRootObject() const { - return (GetGUI() != 0 && m_pParent == GetGUI()->m_BaseObject); + return GetGUI() != 0 && m_pParent == GetGUI()->m_BaseObject; } void IGUIObject::TraceMember(JSTracer* trc) { - for (auto& handler : m_ScriptHandlers) + for (std::pair>& handler : m_ScriptHandlers) JS_CallHeapObjectTracer(trc, &handler.second, "IGUIObject::m_ScriptHandlers"); } PSRETURN IGUIObject::LogInvalidSettings(const CStr8& Setting) const { - LOGWARNING("IGUIObject: setting %s was not found on an object", - Setting.c_str()); + LOGWARNING("IGUIObject: setting %s was not found on an object", Setting.c_str()); return PSRETURN_GUI_InvalidSetting; } diff --git a/source/gui/scripting/JSInterface_IGUIObject.cpp b/source/gui/scripting/JSInterface_IGUIObject.cpp index 325330874c..f02ffe9401 100644 --- a/source/gui/scripting/JSInterface_IGUIObject.cpp +++ b/source/gui/scripting/JSInterface_IGUIObject.cpp @@ -89,7 +89,7 @@ bool JSI_IGUIObject::getProperty(JSContext* cx, JS::HandleObject obj, JS::Handle if (propName.substr(0, 2) == "on") { CStr eventName(CStr(propName.substr(2)).LowerCase()); - auto it = e->m_ScriptHandlers.find(eventName); + std::map>::iterator it = e->m_ScriptHandlers.find(eventName); if (it == e->m_ScriptHandlers.end()) vp.setNull(); else diff --git a/source/renderer/VertexBuffer.cpp b/source/renderer/VertexBuffer.cpp index b67095268f..0f0fa747d5 100644 --- a/source/renderer/VertexBuffer.cpp +++ b/source/renderer/VertexBuffer.cpp @@ -1,4 +1,4 @@ -/* Copyright (C) 2015 Wildfire Games. +/* Copyright (C) 2016 Wildfire Games. * This file is part of 0 A.D. * * 0 A.D. is free software: you can redistribute it and/or modify @@ -237,7 +237,7 @@ u8* CVertexBuffer::Bind() // If any chunks are out of sync with the current VBO, and are // needed for rendering this frame, we'll need to re-upload the VBO bool needUpload = false; - for (auto& chunk : m_AllocList) + for (VBChunk* const& chunk : m_AllocList) { if (chunk->m_Dirty && chunk->m_Needed) { @@ -277,7 +277,7 @@ u8* CVertexBuffer::Bind() // the VBO contains data for every unit in the world, but only a // handful are visible on screen and we don't need to bother copying // the rest.) - for (auto& chunk : m_AllocList) + for (VBChunk* const& chunk : m_AllocList) if (chunk->m_Needed) memcpy((u8 *)p + chunk->m_Index * m_VertexSize, chunk->m_BackingStore, chunk->m_Count * m_VertexSize); @@ -291,7 +291,7 @@ u8* CVertexBuffer::Bind() // Anything we just uploaded is clean; anything else is dirty // since the rest of the VBO content is now undefined - for (auto& chunk : m_AllocList) + for (VBChunk* const& chunk : m_AllocList) { if (chunk->m_Needed) chunk->m_Dirty = false; @@ -301,7 +301,7 @@ u8* CVertexBuffer::Bind() } // Reset the flags for the next phase - for (auto& chunk : m_AllocList) + for (VBChunk* const& chunk : m_AllocList) chunk->m_Needed = false; } diff --git a/source/simulation2/components/CCmpAIManager.cpp b/source/simulation2/components/CCmpAIManager.cpp index 2ec0cb7a8b..e7448e0c4d 100644 --- a/source/simulation2/components/CCmpAIManager.cpp +++ b/source/simulation2/components/CCmpAIManager.cpp @@ -781,9 +781,9 @@ private: void TraceMember(JSTracer *trc) { - for (auto& prototypes : m_DeserializablePrototypes) - JS_CallHeapObjectTracer(trc, &prototypes.second, "CAIWorker::m_DeserializablePrototypes"); - for (auto& metadata : m_PlayerMetadata) + for (std::pair>& prototype : m_DeserializablePrototypes) + JS_CallHeapObjectTracer(trc, &prototype.second, "CAIWorker::m_DeserializablePrototypes"); + for (std::pair>& metadata : m_PlayerMetadata) JS_CallHeapValueTracer(trc, &metadata.second, "CAIWorker::m_PlayerMetadata"); } diff --git a/source/simulation2/serialization/StdDeserializer.cpp b/source/simulation2/serialization/StdDeserializer.cpp index 66bcf2c47c..b3740e0fe3 100644 --- a/source/simulation2/serialization/StdDeserializer.cpp +++ b/source/simulation2/serialization/StdDeserializer.cpp @@ -1,4 +1,4 @@ -/* Copyright (C) 2015 Wildfire Games. +/* Copyright (C) 2016 Wildfire Games. * This file is part of 0 A.D. * * 0 A.D. is free software: you can redistribute it and/or modify @@ -55,10 +55,10 @@ void CStdDeserializer::Trace(JSTracer *trc, void *data) void CStdDeserializer::TraceMember(JSTracer *trc) { - for (size_t i=0; i>& proto : m_SerializablePrototypes) JS_CallHeapObjectTracer(trc, &proto.second, "StdDeserializer::m_SerializablePrototypes"); }