Fixes MSVC build warnings about unhanded cases in switch statement (C4062) and missing parameter in macro (C4003)

This was SVN commit r16141.
This commit is contained in:
historic_bruno 2015-01-11 21:37:53 +00:00
parent 8fc14655b5
commit 851d3d964a
2 changed files with 61 additions and 56 deletions

View File

@ -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<TextChunk::Tag::TagAttribute>::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<TextChunk::Tag::TagAttribute>::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<CSize>::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<CSize>::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;
}
}

View File

@ -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<CStr, CConfigValueSet> 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;