mirror of
https://gitea.wildfiregames.com/0ad/0ad.git
synced 2026-11-09 16:50:42 +00:00
Use fmt::format for LOGERROR
The format string can be checked at compile time. It will be easier to transition to `std::format`.
This commit is contained in:
115 files changed
+631
-454
No files matched your search
@@ -137,7 +137,7 @@ private:
|
||||
m_Worker.LoadMetadata(path, &metadata);
|
||||
if (metadata.isUndefined())
|
||||
{
|
||||
LOGERROR("Failed to create AI player: can't find %s", path.string8());
|
||||
LOGERROR("Failed to create AI player: can't find {}", path.string8());
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -147,7 +147,7 @@ private:
|
||||
JS::RootedValue ctor(rq.cx);
|
||||
if (!Script::HasProperty(rq, metadata, "filename"))
|
||||
{
|
||||
LOGERROR("Failed to create AI player: %s: missing 'filename'", path.string8());
|
||||
LOGERROR("Failed to create AI player: {}: missing 'filename'", path.string8());
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -162,7 +162,7 @@ private:
|
||||
|
||||
if (!Script::GetProperty(rq, metadata, "constructor", constructor))
|
||||
{
|
||||
LOGERROR("Failed to create AI player: %s: missing 'constructor'", path.string8());
|
||||
LOGERROR("Failed to create AI player: {}: missing 'constructor'", path.string8());
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -170,7 +170,8 @@ private:
|
||||
if (!Script::GetProperty(rq, objectWithConstructor, constructor.c_str(), &ctor)
|
||||
|| ctor.isNull())
|
||||
{
|
||||
LOGERROR("Failed to create AI player: %s: can't find constructor '%s'", path.string8(), constructor);
|
||||
LOGERROR("Failed to create AI player: {}: can't find constructor '{}'",
|
||||
path.string8(), constructor);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -197,7 +198,8 @@ private:
|
||||
|
||||
if (m_Obj.get().isNull())
|
||||
{
|
||||
LOGERROR("Failed to create AI player: %s: error calling constructor '%s'", path.string8(), constructor);
|
||||
LOGERROR("Failed to create AI player: {}: error calling constructor '{}'",
|
||||
path.string8(), constructor);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
@@ -432,7 +434,8 @@ public:
|
||||
if (!Script::GetProperty(rq, AIModule, "SharedScript", &ctor)
|
||||
|| ctor.isUndefined())
|
||||
{
|
||||
LOGERROR("Failed to create shared AI component: %s: can't find constructor '%s'", path.string8(), "SharedScript");
|
||||
LOGERROR("Failed to create shared AI component: {}: can't find constructor '{}'",
|
||||
path.string8(), "SharedScript");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -462,7 +465,8 @@ public:
|
||||
|
||||
if (m_SharedAIObj.get().isNull())
|
||||
{
|
||||
LOGERROR("Failed to create shared AI component: %s: error calling constructor '%s'", path.string8(), "SharedScript");
|
||||
LOGERROR("Failed to create shared AI component: {}: error calling constructor '{}'",
|
||||
path.string8(), "SharedScript");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -145,7 +145,7 @@ public:
|
||||
{
|
||||
CColor colorObj(1.0f, 1.0f, 1.0f, 1.0f);
|
||||
if (!colorObj.ParseString(color, 1))
|
||||
LOGERROR("OverlayRenderer: Error parsing '%s'", color);
|
||||
LOGERROR("OverlayRenderer: Error parsing '{}'", color);
|
||||
|
||||
CTextureProperties textureProps(textureName);
|
||||
|
||||
|
||||
@@ -295,7 +295,7 @@ pass_class_t CCmpPathfinder::GetPassabilityClass(const std::string& name) const
|
||||
std::map<std::string, pass_class_t>::const_iterator it = m_PassClassMasks.find(name);
|
||||
if (it == m_PassClassMasks.end())
|
||||
{
|
||||
LOGERROR("Invalid passability class name '%s'", name.c_str());
|
||||
LOGERROR("Invalid passability class name '{}'", name);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -1021,7 +1021,7 @@ public:
|
||||
{
|
||||
if (m_Queries.find(tag) == m_Queries.end())
|
||||
{
|
||||
LOGERROR("CCmpRangeManager: DestroyActiveQuery called with invalid tag %u", tag);
|
||||
LOGERROR("CCmpRangeManager: DestroyActiveQuery called with invalid tag {}", tag);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1033,7 +1033,7 @@ public:
|
||||
std::map<tag_t, Query>::iterator it = m_Queries.find(tag);
|
||||
if (it == m_Queries.end())
|
||||
{
|
||||
LOGERROR("CCmpRangeManager: EnableActiveQuery called with invalid tag %u", tag);
|
||||
LOGERROR("CCmpRangeManager: EnableActiveQuery called with invalid tag {}", tag);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1046,7 +1046,7 @@ public:
|
||||
std::map<tag_t, Query>::iterator it = m_Queries.find(tag);
|
||||
if (it == m_Queries.end())
|
||||
{
|
||||
LOGERROR("CCmpRangeManager: DisableActiveQuery called with invalid tag %u", tag);
|
||||
LOGERROR("CCmpRangeManager: DisableActiveQuery called with invalid tag {}", tag);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1059,7 +1059,7 @@ public:
|
||||
std::map<tag_t, Query>::const_iterator it = m_Queries.find(tag);
|
||||
if (it == m_Queries.end())
|
||||
{
|
||||
LOGERROR("CCmpRangeManager: IsActiveQueryEnabled called with invalid tag %u", tag);
|
||||
LOGERROR("CCmpRangeManager: IsActiveQueryEnabled called with invalid tag {}", tag);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -1116,7 +1116,7 @@ public:
|
||||
std::map<tag_t, Query>::iterator it = m_Queries.find(tag);
|
||||
if (it == m_Queries.end())
|
||||
{
|
||||
LOGERROR("CCmpRangeManager: ResetActiveQuery called with invalid tag %u", tag);
|
||||
LOGERROR("CCmpRangeManager: ResetActiveQuery called with invalid tag {}", tag);
|
||||
return r;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 2025 Wildfire Games.
|
||||
/* Copyright (C) 2026 Wildfire Games.
|
||||
* This file is part of 0 A.D.
|
||||
*
|
||||
* 0 A.D. is free software: you can redistribute it and/or modify
|
||||
@@ -171,7 +171,7 @@ const CParamNode* CCmpTemplateManager::GetTemplate(const std::string& templateNa
|
||||
|
||||
// Show error on the first failure to validate the template
|
||||
if (!m_TemplateSchemaValidity[templateName])
|
||||
LOGERROR("Failed to validate entity template '%s'", templateName.c_str());
|
||||
LOGERROR("Failed to validate entity template '{}'", templateName);
|
||||
}
|
||||
// Refuse to return invalid templates
|
||||
if (!m_TemplateSchemaValidity[templateName])
|
||||
@@ -182,7 +182,7 @@ const CParamNode* CCmpTemplateManager::GetTemplate(const std::string& templateNa
|
||||
if (!templateRoot.IsOk())
|
||||
{
|
||||
// The validator should never let this happen
|
||||
LOGERROR("Invalid root element in entity template '%s'", templateName.c_str());
|
||||
LOGERROR("Invalid root element in entity template '{}'", templateName);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 2025 Wildfire Games.
|
||||
/* Copyright (C) 2026 Wildfire Games.
|
||||
* This file is part of 0 A.D.
|
||||
*
|
||||
* 0 A.D. is free software: you can redistribute it and/or modify
|
||||
@@ -51,7 +51,8 @@ public:
|
||||
case static_cast<int>(LosVisibility::VISIBLE):
|
||||
return LosVisibility::VISIBLE;
|
||||
default:
|
||||
LOGERROR("Received the invalid visibility value %d from the Visibility scripted component!", visibility);
|
||||
LOGERROR("Received the invalid visibility value {} from the Visibility scripted "
|
||||
"component!", visibility);
|
||||
return LosVisibility::HIDDEN;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user