mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-04-28 21:07:59 +03:00
Apply clang-format to code base
This commit is contained in:
parent
f37d0be806
commit
ddb0522bbf
2199 changed files with 118692 additions and 114392 deletions
|
@ -8,9 +8,9 @@ namespace Fallback
|
|||
{
|
||||
std::map<std::string, std::string, std::less<>> Map::mFallbackMap;
|
||||
|
||||
void Map::init(const std::map<std::string,std::string>& fallback)
|
||||
void Map::init(const std::map<std::string, std::string>& fallback)
|
||||
{
|
||||
for(const auto& entry : fallback)
|
||||
for (const auto& entry : fallback)
|
||||
mFallbackMap.insert(entry);
|
||||
}
|
||||
|
||||
|
@ -71,18 +71,21 @@ namespace Fallback
|
|||
unsigned int j = 0;
|
||||
for (unsigned int i = 0; i < sum.length(); ++i)
|
||||
{
|
||||
if(sum[i]==',') j++;
|
||||
else if (sum[i] != ' ') ret[j]+=sum[i];
|
||||
if (sum[i] == ',')
|
||||
j++;
|
||||
else if (sum[i] != ' ')
|
||||
ret[j] += sum[i];
|
||||
}
|
||||
return osg::Vec4f(std::stoi(ret[0])/255.f,std::stoi(ret[1])/255.f,std::stoi(ret[2])/255.f, 1.f);
|
||||
return osg::Vec4f(std::stoi(ret[0]) / 255.f, std::stoi(ret[1]) / 255.f, std::stoi(ret[2]) / 255.f, 1.f);
|
||||
}
|
||||
catch (const std::invalid_argument&)
|
||||
{
|
||||
Log(Debug::Error) << "Error: '" << fall << "' setting value (" << sum << ") is not a valid color, using middle gray as a fallback";
|
||||
Log(Debug::Error) << "Error: '" << fall << "' setting value (" << sum
|
||||
<< ") is not a valid color, using middle gray as a fallback";
|
||||
}
|
||||
}
|
||||
|
||||
return osg::Vec4f(0.5f,0.5f,0.5f,1.f);
|
||||
return osg::Vec4f(0.5f, 0.5f, 0.5f, 1.f);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -12,15 +12,16 @@ namespace Fallback
|
|||
/// @brief contains settings imported from the Morrowind INI file.
|
||||
class Map
|
||||
{
|
||||
static std::map<std::string, std::string, std::less<>> mFallbackMap;
|
||||
public:
|
||||
static void init(const std::map<std::string,std::string>& fallback);
|
||||
static std::map<std::string, std::string, std::less<>> mFallbackMap;
|
||||
|
||||
static std::string_view getString(std::string_view fall);
|
||||
static float getFloat(std::string_view fall);
|
||||
static int getInt(std::string_view fall);
|
||||
static bool getBool(std::string_view fall);
|
||||
static osg::Vec4f getColour(std::string_view fall);
|
||||
public:
|
||||
static void init(const std::map<std::string, std::string>& fallback);
|
||||
|
||||
static std::string_view getString(std::string_view fall);
|
||||
static float getFloat(std::string_view fall);
|
||||
static int getInt(std::string_view fall);
|
||||
static bool getBool(std::string_view fall);
|
||||
static osg::Vec4f getColour(std::string_view fall);
|
||||
};
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -10,13 +10,14 @@ void Fallback::validate(boost::any& v, std::vector<std::string> const& tokens, F
|
|||
v = boost::any(FallbackMap());
|
||||
}
|
||||
|
||||
FallbackMap *map = boost::any_cast<FallbackMap>(&v);
|
||||
FallbackMap* map = boost::any_cast<FallbackMap>(&v);
|
||||
|
||||
for (const auto& token : tokens)
|
||||
{
|
||||
size_t sep = token.find(',');
|
||||
if (sep < 1 || sep == token.length() - 1 || sep == std::string::npos)
|
||||
throw boost::program_options::validation_error(boost::program_options::validation_error::invalid_option_value);
|
||||
throw boost::program_options::validation_error(
|
||||
boost::program_options::validation_error::invalid_option_value);
|
||||
|
||||
std::string key(token.substr(0, sep));
|
||||
std::string value(token.substr(sep + 1));
|
||||
|
|
|
@ -17,11 +17,12 @@ namespace boost
|
|||
namespace Fallback
|
||||
{
|
||||
|
||||
struct FallbackMap {
|
||||
struct FallbackMap
|
||||
{
|
||||
std::map<std::string, std::string> mMap;
|
||||
};
|
||||
|
||||
void validate(boost::any &v, std::vector<std::string> const &tokens, FallbackMap*, int);
|
||||
void validate(boost::any& v, std::vector<std::string> const& tokens, FallbackMap*, int);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue