diff --git a/source/gui/GUItext.cpp b/source/gui/GUItext.cpp index 100171e8e6..69d9f479fe 100644 --- a/source/gui/GUItext.cpp +++ b/source/gui/GUItext.cpp @@ -1,4 +1,4 @@ -/* Copyright (C) 2014 Wildfire Games. +/* Copyright (C) 2015 Wildfire Games. * This file is part of 0 A.D. * * 0 A.D. is free software: you can redistribute it and/or modify @@ -123,61 +123,66 @@ void CGUIString::GenerateTextCall(const CGUI *pGUI, break; case CGUIString::TextChunk::Tag::TAG_ICON: - // We'll need to setup a text-call that will point - // to the icon, this is to be able to iterate - // through the text-calls without having to - // complex the structure virtually for nothing more. - SGUIText::STextCall TextCall; - - // Also add it to the sprites being rendered. - SGUIText::SSpriteCall SpriteCall; - - // Get Icon from icon database in pGUI - SGUIIcon icon = pGUI->GetIcon(path); - - CSize size = icon.m_Size; - - // append width, and make maximum height the height. - Feedback.m_Size.cx += size.cx; - Feedback.m_Size.cy = std::max(Feedback.m_Size.cy, size.cy); - - // These are also needed later - TextCall.m_Size = size; - SpriteCall.m_Area = size; - - // Handle additional attributes - std::vector::const_iterator att_it; - for (att_it = tag.m_TagAttributes.begin(); att_it != tag.m_TagAttributes.end(); ++att_it) { - const TextChunk::Tag::TagAttribute& tagAttrib = *att_it; + // We'll need to setup a text-call that will point + // to the icon, this is to be able to iterate + // through the text-calls without having to + // complex the structure virtually for nothing more. + SGUIText::STextCall TextCall; - if (tagAttrib.attrib == L"displace" && !tagAttrib.value.empty()) + // Also add it to the sprites being rendered. + SGUIText::SSpriteCall SpriteCall; + + // Get Icon from icon database in pGUI + SGUIIcon icon = pGUI->GetIcon(path); + + CSize size = icon.m_Size; + + // append width, and make maximum height the height. + Feedback.m_Size.cx += size.cx; + Feedback.m_Size.cy = std::max(Feedback.m_Size.cy, size.cy); + + // These are also needed later + TextCall.m_Size = size; + SpriteCall.m_Area = size; + + // Handle additional attributes + std::vector::const_iterator att_it; + for (att_it = tag.m_TagAttributes.begin(); att_it != tag.m_TagAttributes.end(); ++att_it) { - //Displace the sprite - CSize displacement; - // Parse the value - if (!GUI::ParseString(tagAttrib.value, displacement)) - LOGERROR(L"Error parsing 'displace' value for tag [ICON]"); - else - SpriteCall.m_Area += displacement; + const TextChunk::Tag::TagAttribute& tagAttrib = *att_it; + + if (tagAttrib.attrib == L"displace" && !tagAttrib.value.empty()) + { + //Displace the sprite + CSize displacement; + // Parse the value + if (!GUI::ParseString(tagAttrib.value, displacement)) + LOGERROR(L"Error parsing 'displace' value for tag [ICON]"); + else + SpriteCall.m_Area += displacement; + } + else if (tagAttrib.attrib == L"tooltip") + SpriteCall.m_Tooltip = tagAttrib.value; + else if (tagAttrib.attrib == L"tooltip_style") + SpriteCall.m_TooltipStyle = tagAttrib.value; } - else if (tagAttrib.attrib == L"tooltip") - SpriteCall.m_Tooltip = tagAttrib.value; - else if (tagAttrib.attrib == L"tooltip_style") - SpriteCall.m_TooltipStyle = tagAttrib.value; + + SpriteCall.m_Sprite = icon.m_SpriteName; + SpriteCall.m_CellID = icon.m_CellID; + + // Add sprite call + Feedback.m_SpriteCalls.push_back(SpriteCall); + + // Finalize text call + TextCall.m_pSpriteCall = &Feedback.m_SpriteCalls.back(); + + // Add text call + Feedback.m_TextCalls.push_back(TextCall); } - - SpriteCall.m_Sprite = icon.m_SpriteName; - SpriteCall.m_CellID = icon.m_CellID; - - // Add sprite call - Feedback.m_SpriteCalls.push_back(SpriteCall); - - // Finalize text call - TextCall.m_pSpriteCall = &Feedback.m_SpriteCalls.back(); - - // Add text call - Feedback.m_TextCalls.push_back(TextCall); + break; + default: + LOGERROR(L"Encountered unexpected tag applied to text"); break; } } diff --git a/source/ps/ConfigDB.cpp b/source/ps/ConfigDB.cpp index 129239f9b7..11ce79ea0c 100644 --- a/source/ps/ConfigDB.cpp +++ b/source/ps/ConfigDB.cpp @@ -1,4 +1,4 @@ -/* Copyright (C) 2014 Wildfire Games. +/* Copyright (C) 2015 Wildfire Games. * This file is part of 0 A.D. * * 0 A.D. is free software: you can redistribute it and/or modify @@ -88,7 +88,7 @@ std::string EscapeString(const CStr& str) #define GETVAL(type)\ void CConfigDB::GetValue(EConfigNamespace ns, const CStr& name, type& value)\ {\ - CHECK_NS();\ + CHECK_NS(;);\ CScopeLock s(&cfgdb_mutex);\ TConfigMap::iterator it = m_Map[CFG_COMMAND].find(name);\ if (it != m_Map[CFG_COMMAND].end())\ @@ -115,7 +115,7 @@ GETVAL(std::string) void CConfigDB::GetValues(EConfigNamespace ns, const CStr& name, CConfigValueSet& values) { - CHECK_NS(); + CHECK_NS(;); CScopeLock s(&cfgdb_mutex); TConfigMap::iterator it = m_Map[CFG_COMMAND].find(name); @@ -184,7 +184,7 @@ std::map CConfigDB::GetValuesWithPrefix(EConfigNamespace void CConfigDB::SetValueString(EConfigNamespace ns, const CStr& name, const CStr& value) { - CHECK_NS(); + CHECK_NS(;); CScopeLock s(&cfgdb_mutex); TConfigMap::iterator it = m_Map[ns].find(name); @@ -196,7 +196,7 @@ void CConfigDB::SetValueString(EConfigNamespace ns, const CStr& name, const CStr void CConfigDB::SetConfigFile(EConfigNamespace ns, const VfsPath& path) { - CHECK_NS(); + CHECK_NS(;); CScopeLock s(&cfgdb_mutex); m_ConfigFile[ns] = path;