mirror of
https://gitea.wildfiregames.com/0ad/0ad.git
synced 2026-10-09 23:32:45 +00:00
Use fmt::format for LOGWARNING
The format string can be checked at compile time. It will be easier to transition to `std::format`.
This commit is contained in:
@@ -52,7 +52,7 @@ namespace
|
||||
if (severity == LOG_INFO)
|
||||
LOGMESSAGE("{}: {}", path->string8(), text);
|
||||
else if (severity == LOG_WARNING)
|
||||
LOGWARNING("%s: %s", path->string8(), text);
|
||||
LOGWARNING("{}: {}", path->string8(), text);
|
||||
else
|
||||
LOGERROR("%s: %s", path->string8(), text);
|
||||
}
|
||||
|
||||
@@ -110,24 +110,25 @@ bool CColor::ParseString(const CStr8& value, int defaultAlpha)
|
||||
stream >> values[i];
|
||||
if ((stream.rdstate() & std::stringstream::failbit) != 0)
|
||||
{
|
||||
LOGWARNING("Unable to parse CColor parameters. Your input: '%s'", value.c_str());
|
||||
LOGWARNING("Unable to parse CColor parameters. Your input: '{}'", value);
|
||||
return false;
|
||||
}
|
||||
if (values[i] < 0 || values[i] > 255)
|
||||
{
|
||||
LOGWARNING("Invalid value (<0 or >255) when parsing CColor parameters. Your input: '%s'", value.c_str());
|
||||
LOGWARNING("Invalid value (<0 or >255) when parsing CColor parameters. Your input: '{}'",
|
||||
value);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (i < 3)
|
||||
{
|
||||
LOGWARNING("Not enough parameters when parsing as CColor. Your input: '%s'", value.c_str());
|
||||
LOGWARNING("Not enough parameters when parsing as CColor. Your input: '{}'", value);
|
||||
return false;
|
||||
}
|
||||
if (!stream.eof())
|
||||
{
|
||||
LOGWARNING("Too many parameters when parsing as CColor. Your input: '%s'", value.c_str());
|
||||
LOGWARNING("Too many parameters when parsing as CColor. Your input: '{}'", value);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -434,7 +434,7 @@ Script::StructuredClone RunMapGenerationScript(const StopToken stopToken, std::a
|
||||
if (tempProgress < currentProgress)
|
||||
{
|
||||
LOGWARNING("The random map script tried to reduce the loading progress from "
|
||||
"%d to %d.", currentProgress, tempProgress);
|
||||
"{} to {}.", currentProgress, tempProgress);
|
||||
return;
|
||||
}
|
||||
progress.store(tempProgress);
|
||||
|
||||
@@ -971,7 +971,7 @@ void CXMLReader::ReadPaths(XMBElement parent)
|
||||
CCinemaPath path(pathData, positionSpline, targetSpline);
|
||||
if (path.Empty())
|
||||
{
|
||||
LOGWARNING("Path with name '%s' is empty", pathName.ToUTF8());
|
||||
LOGWARNING("Path with name '{}' is empty", pathName.ToUTF8());
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -980,10 +980,10 @@ void CXMLReader::ReadPaths(XMBElement parent)
|
||||
if (!cmpCinemaManager->HasPath(pathName))
|
||||
cmpCinemaManager->AddPath(path);
|
||||
else
|
||||
LOGWARNING("Path with name '%s' already exists", pathName.ToUTF8());
|
||||
LOGWARNING("Path with name '{}' already exists", pathName.ToUTF8());
|
||||
}
|
||||
else
|
||||
LOGWARNING("Invalid path child with name '%s'", element.GetText());
|
||||
LOGWARNING("Invalid path child with name '{}'", element.GetText());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1519,7 +1519,7 @@ int CMapReader::ParseEnvironment()
|
||||
const auto getEnvironmentProperty = [&](JS::HandleValue val, const char* prop, auto&& out)
|
||||
{
|
||||
if (!Script::GetProperty(rq, val, prop, std::forward<decltype(out)>(out)))
|
||||
LOGWARNING("CMapReader::ParseEnvironment() failed to get '%s' property", prop);
|
||||
LOGWARNING("CMapReader::ParseEnvironment() failed to get '{}' property", prop);
|
||||
};
|
||||
|
||||
JS::RootedValue envObj(rq.cx);
|
||||
@@ -1618,7 +1618,7 @@ int CMapReader::ParseCamera()
|
||||
const auto getCameraProperty = [&](JS::HandleValue val, const char* prop, auto&& out)
|
||||
{
|
||||
if (!Script::GetProperty(rq, val, prop, std::forward<decltype(out)>(out)))
|
||||
LOGWARNING("CMapReader::ParseCamera() failed to get '%s' property", prop);
|
||||
LOGWARNING("CMapReader::ParseCamera() failed to get '{}' property", prop);
|
||||
};
|
||||
|
||||
JS::RootedValue cameraObj(rq.cx);
|
||||
|
||||
@@ -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
|
||||
@@ -67,7 +67,8 @@ void CModelAbstract::CalcSelectionBox()
|
||||
default:
|
||||
{
|
||||
m_SelectionBox.SetEmpty();
|
||||
//LOGWARNING("[ModelAbstract] Unrecognized selection shape type: %ld", m_CustomSelectionShape->m_Type);
|
||||
// LOGWARNING("[ModelAbstract] Unrecognized selection shape type: {}",
|
||||
// m_CustomSelectionShape->m_Type);
|
||||
debug_warn("[ModelAbstract] Unrecognized selection shape type");
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -915,7 +915,10 @@ bool CActorDef::Load(const VfsPath& pathname)
|
||||
else if (attr.Name == at_file)
|
||||
{
|
||||
if (attr.Value.empty())
|
||||
LOGWARNING("Empty actor file specified (file %s)", pathname.string8());
|
||||
{
|
||||
LOGWARNING("Empty actor file specified (file {})",
|
||||
pathname.string8());
|
||||
}
|
||||
file = attr.Value;
|
||||
}
|
||||
else if (attr.Name == at_inline)
|
||||
@@ -949,7 +952,10 @@ bool CActorDef::Load(const VfsPath& pathname)
|
||||
else
|
||||
{
|
||||
if (actor.GetChildNodes().size() > 0)
|
||||
LOGWARNING("Actor definition refers to file but has children elements, they will be ignored (file %s)", pathname.string8());
|
||||
{
|
||||
LOGWARNING("Actor definition refers to file but has children elements, they "
|
||||
"will be ignored (file {})", pathname.string8());
|
||||
}
|
||||
|
||||
// Open up an external file to load.
|
||||
// Don't crash hard when failures happen, but log them and continue
|
||||
|
||||
@@ -362,7 +362,7 @@ int CParticleEmitterType::GetVariableID(const std::string& name)
|
||||
if (name == "color.r") return VAR_COLOR_R;
|
||||
if (name == "color.g") return VAR_COLOR_G;
|
||||
if (name == "color.b") return VAR_COLOR_B;
|
||||
LOGWARNING("Particle sets unknown variable '%s'", name.c_str());
|
||||
LOGWARNING("Particle sets unknown variable '{}'", name);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
@@ -86,7 +86,7 @@ CTerrainPropertiesPtr CTerrainProperties::FromXML(const CTerrainPropertiesPtr& p
|
||||
}
|
||||
else
|
||||
{
|
||||
LOGWARNING("TerrainProperties: Loading %s: Unexpected node %s\n",
|
||||
LOGWARNING("TerrainProperties: Loading {}: Unexpected node {}\n",
|
||||
pathname.string8(),
|
||||
XeroFile.GetElementString(child.GetNodeName()));
|
||||
// Keep reading - typos shouldn't be showstoppers
|
||||
|
||||
@@ -82,7 +82,7 @@ CTerrainTextureEntry* CTerrainTextureManager::FindTexture(const CStr& tag_)
|
||||
if (textureEntry->GetTag() == tag)
|
||||
return textureEntry.get();
|
||||
|
||||
LOGWARNING("CTerrainTextureManager: Couldn't find terrain %s using fallback texture", tag.c_str());
|
||||
LOGWARNING("CTerrainTextureManager: Couldn't find terrain {} using fallback texture", tag);
|
||||
|
||||
// If the texture is not found, return a default texture.
|
||||
// This is a fallback texture, so it should not be used in the editor.
|
||||
|
||||
+13
-3
@@ -871,7 +871,11 @@ void CGUI::Xeromyces_ReadObject(const XMBData& xmb, XMBElement element, IGUIObje
|
||||
if (!filename.empty())
|
||||
{
|
||||
if (!directory.empty())
|
||||
LOGWARNING("GUI: Include element found with file name (%s) and directory name (%s). Only the file will be processed.", utf8_from_wstring(filename), utf8_from_wstring(directory));
|
||||
{
|
||||
LOGWARNING("GUI: Include element found with file name ({}) and directory "
|
||||
"name ({}). Only the file will be processed.",
|
||||
utf8_from_wstring(filename), utf8_from_wstring(directory));
|
||||
}
|
||||
|
||||
Paths.insert(filename);
|
||||
|
||||
@@ -1048,7 +1052,10 @@ void CGUI::Xeromyces_ReadSprite(const XMBData& xmb, XMBElement element)
|
||||
CStr name = element.GetAttributes().GetNamedItem(xmb.GetAttributeID("name"));
|
||||
|
||||
if (m_Sprites.find(name) != m_Sprites.end())
|
||||
LOGWARNING("GUI sprite name '%s' used more than once; first definition will be discarded", name.c_str());
|
||||
{
|
||||
LOGWARNING("GUI sprite name '{}' used more than once; first definition will be discarded",
|
||||
name);
|
||||
}
|
||||
|
||||
// shared_ptr to link the effect to every image, faster than copy.
|
||||
std::shared_ptr<SGUIImageEffects> effects;
|
||||
@@ -1337,7 +1344,10 @@ void CGUI::Xeromyces_ReadIcon(const XMBData& xmb, XMBElement element)
|
||||
void CGUI::ReportMissingIcon(const CStr& name) const
|
||||
{
|
||||
if (m_MissingIconsReported.insert(name).second)
|
||||
LOGWARNING("Trying to use an icon, imgleft or imgright-tag with an undefined icon (\"%s\").", name);
|
||||
{
|
||||
LOGWARNING("Trying to use an icon, imgleft or imgright-tag with an undefined icon (\"{}\").",
|
||||
name);
|
||||
}
|
||||
}
|
||||
|
||||
void CGUI::Xeromyces_ReadTooltip(const XMBData& xmb, XMBElement element)
|
||||
|
||||
@@ -82,20 +82,22 @@ bool CGUI::ParseString<CRect>(const CGUI*, const CStrW& Value, CRect& Output)
|
||||
{
|
||||
if (stream.eof())
|
||||
{
|
||||
LOGWARNING("Too few CRect parameters (min %i). Your input: '%s'", NUM_COORDS, Value.ToUTF8().c_str());
|
||||
LOGWARNING("Too few CRect parameters (min {}). Your input: '{}'", NUM_COORDS,
|
||||
Value.ToUTF8());
|
||||
return false;
|
||||
}
|
||||
stream >> coords[i];
|
||||
if ((stream.rdstate() & std::wstringstream::failbit) != 0)
|
||||
{
|
||||
LOGWARNING("Unable to parse CRect parameters. Your input: '%s'", Value.ToUTF8().c_str());
|
||||
LOGWARNING("Unable to parse CRect parameters. Your input: '{}'", Value.ToUTF8());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (!stream.eof())
|
||||
{
|
||||
LOGWARNING("Too many CRect parameters (max %i). Your input: '%s'", NUM_COORDS, Value.ToUTF8().c_str());
|
||||
LOGWARNING("Too many CRect parameters (max {}). Your input: '{}'", NUM_COORDS,
|
||||
Value.ToUTF8());
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -129,13 +131,14 @@ bool CGUI::ParseString<CSize2D>(const CGUI*, const CStrW& Value, CSize2D& Output
|
||||
{
|
||||
if (stream.eof())
|
||||
{
|
||||
LOGWARNING("Too few CSize2D parameters (min %i). Your input: '%s'", NUM_COORDS, Value.ToUTF8().c_str());
|
||||
LOGWARNING("Too few CSize2D parameters (min {}). Your input: '{}'", NUM_COORDS,
|
||||
Value.ToUTF8());
|
||||
return false;
|
||||
}
|
||||
stream >> coords[i];
|
||||
if ((stream.rdstate() & std::wstringstream::failbit) != 0)
|
||||
{
|
||||
LOGWARNING("Unable to parse CSize2D parameters. Your input: '%s'", Value.ToUTF8().c_str());
|
||||
LOGWARNING("Unable to parse CSize2D parameters. Your input: '{}'", Value.ToUTF8());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -145,7 +148,8 @@ bool CGUI::ParseString<CSize2D>(const CGUI*, const CStrW& Value, CSize2D& Output
|
||||
|
||||
if (!stream.eof())
|
||||
{
|
||||
LOGWARNING("Too many CSize2D parameters (max %i). Your input: '%s'", NUM_COORDS, Value.ToUTF8().c_str());
|
||||
LOGWARNING("Too many CSize2D parameters (max {}). Your input: '{}'", NUM_COORDS,
|
||||
Value.ToUTF8());
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -164,13 +168,14 @@ bool CGUI::ParseString<CVector2D>(const CGUI*, const CStrW& Value, CVector2D& Ou
|
||||
{
|
||||
if (stream.eof())
|
||||
{
|
||||
LOGWARNING("Too few CVector2D parameters (min %i). Your input: '%s'", NUM_COORDS, Value.ToUTF8().c_str());
|
||||
LOGWARNING("Too few CVector2D parameters (min {}). Your input: '{}'", NUM_COORDS,
|
||||
Value.ToUTF8());
|
||||
return false;
|
||||
}
|
||||
stream >> coords[i];
|
||||
if ((stream.rdstate() & std::wstringstream::failbit) != 0)
|
||||
{
|
||||
LOGWARNING("Unable to parse CVector2D parameters. Your input: '%s'", Value.ToUTF8().c_str());
|
||||
LOGWARNING("Unable to parse CVector2D parameters. Your input: '{}'", Value.ToUTF8());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -180,7 +185,8 @@ bool CGUI::ParseString<CVector2D>(const CGUI*, const CStrW& Value, CVector2D& Ou
|
||||
|
||||
if (!stream.eof())
|
||||
{
|
||||
LOGWARNING("Too many CVector2D parameters (max %i). Your input: '%s'", NUM_COORDS, Value.ToUTF8().c_str());
|
||||
LOGWARNING("Too many CVector2D parameters (max {}). Your input: '{}'", NUM_COORDS,
|
||||
Value.ToUTF8());
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -300,7 +300,10 @@ bool IGUIObject::ApplyStyle(const CStr& StyleName)
|
||||
if (SettingExists(p.first))
|
||||
m_Settings.at(p.first)->FromString(p.second, true);
|
||||
else if (StyleName != "default")
|
||||
LOGWARNING("GUI object has no setting \"%s\", but the style \"%s\" defines it", p.first, StyleName.c_str());
|
||||
{
|
||||
LOGWARNING("GUI object has no setting \"{}\", but the style \"{}\" defines it",
|
||||
p.first, StyleName);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -145,7 +145,10 @@ void CChart::UpdateSeries()
|
||||
CChartData& data = m_Series[i];
|
||||
|
||||
if (i < m_SeriesColor->m_Items.size() && !data.m_Color.ParseString(m_pGUI, m_SeriesColor->m_Items[i].GetOriginalString().ToUTF8(), 0))
|
||||
LOGWARNING("GUI: Error parsing 'series_color' (\"%s\")", utf8_from_wstring(m_SeriesColor->m_Items[i].GetOriginalString()));
|
||||
{
|
||||
LOGWARNING("GUI: Error parsing 'series_color' (\"{}\")",
|
||||
utf8_from_wstring(m_SeriesColor->m_Items[i].GetOriginalString()));
|
||||
}
|
||||
|
||||
data.m_Points = m_SeriesSetting->m_Series[i];
|
||||
}
|
||||
|
||||
@@ -195,7 +195,11 @@ bool CGUISimpleSetting<CGUISize>::DoFromJSVal(const Script::Request& rq, JS::Han
|
||||
}
|
||||
|
||||
if (JS_InstanceOf(rq.cx, obj, &JSI_GUISize::JSI_class, nullptr))
|
||||
ONCE(LOGWARNING("Assigning an GUISize to CGUISize is deprecated. Please use the object.size = {left:number, top:number, right:number, bottom:number} format instead. This support will be removed in a future version."));
|
||||
{
|
||||
ONCE(LOGWARNING("Assigning an GUISize to CGUISize is deprecated. Please use the object.size = "
|
||||
"{{left:number, top:number, right:number, bottom:number}} format instead. This support "
|
||||
"will be removed in a future version."));
|
||||
}
|
||||
|
||||
bool atLeastOnePropertySet{false};
|
||||
CRect pixel{};
|
||||
|
||||
@@ -103,7 +103,7 @@ public:
|
||||
status = g_VFS->LoadFile(sourcePath, shapeFile, size);
|
||||
if (status != INFO::OK)
|
||||
{
|
||||
LOGWARNING("Mouse event mask texture not found ('%s')", spec);
|
||||
LOGWARNING("Mouse event mask texture not found ('{}')", spec);
|
||||
return nullptr;
|
||||
}
|
||||
Tex tex;
|
||||
@@ -188,6 +188,6 @@ bool CGUIMouseEventMask::DoFromString(const CStrW& Value)
|
||||
LOGERROR("Could not create shape for: %s", spec);
|
||||
}
|
||||
else
|
||||
LOGWARNING("Unknown clickable shape: %s", spec);
|
||||
LOGWARNING("Unknown clickable shape: {}", spec);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -1015,7 +1015,8 @@ bool XmppClient::Impl::handleIq(const gloox::IQ& iq)
|
||||
{
|
||||
if (iq.from().full() != m_xpartamuppId)
|
||||
{
|
||||
LOGWARNING("XmppClient: Received game list response from unexpected sender: %s", iq.from().full());
|
||||
LOGWARNING("XmppClient: Received game list response from unexpected sender: {}",
|
||||
iq.from().full());
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -1030,7 +1031,8 @@ bool XmppClient::Impl::handleIq(const gloox::IQ& iq)
|
||||
{
|
||||
if (iq.from().full() != m_echelonId)
|
||||
{
|
||||
LOGWARNING("XmppClient: Received board list response from unexpected sender: %s", iq.from().full());
|
||||
LOGWARNING("XmppClient: Received board list response from unexpected sender: {}",
|
||||
iq.from().full());
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -1061,7 +1063,8 @@ bool XmppClient::Impl::handleIq(const gloox::IQ& iq)
|
||||
{
|
||||
if (iq.from().full() != m_echelonId)
|
||||
{
|
||||
LOGWARNING("XmppClient: Received profile response from unexpected sender: %s", iq.from().full());
|
||||
LOGWARNING("XmppClient: Received profile response from unexpected sender: {}",
|
||||
iq.from().full());
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -75,7 +75,7 @@ public:
|
||||
ENetAddress addr { ENET_HOST_ANY, ENET_PORT_ANY };
|
||||
ENetHost* host = enet_host_create(&addr, 1, 1, 0, 0);
|
||||
StunClient::FindPublicIP(*host, ip, port);
|
||||
LOGWARNING("%s %i", ip.c_str(), port);
|
||||
LOGWARNING("{} {}", ip, port);
|
||||
CConfigDB::Shutdown();
|
||||
}
|
||||
};
|
||||
|
||||
+2
-1
@@ -38,7 +38,8 @@ extern CLogger* g_Logger;
|
||||
fmt::format(FMT_STRING(fmtstring), ## __VA_ARGS__).c_str(), false)
|
||||
#define LOGMESSAGERENDER(fmtstring, ...) g_Logger->WriteMessage( \
|
||||
fmt::format(FMT_STRING(fmtstring), ## __VA_ARGS__).c_str(), true)
|
||||
#define LOGWARNING(...) g_Logger->WriteWarning(fmt::sprintf(__VA_ARGS__).c_str())
|
||||
#define LOGWARNING(fmtstring, ...) g_Logger->WriteWarning( \
|
||||
fmt::format(FMT_STRING(fmtstring), ## __VA_ARGS__).c_str())
|
||||
#define LOGERROR(...) g_Logger->WriteError (fmt::sprintf(__VA_ARGS__).c_str())
|
||||
|
||||
/**
|
||||
|
||||
@@ -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
|
||||
@@ -33,7 +33,7 @@ public:
|
||||
CStrInternInternals(const char* str, size_t len)
|
||||
: data(str, str+len), hash(fnv_hash(str, len))
|
||||
{
|
||||
// LOGWARNING("New interned string '%s'", data.c_str());
|
||||
// LOGWARNING("New interned string '{}'", data);
|
||||
}
|
||||
|
||||
CStrInternInternals(const CStrInternInternals& b) = default;
|
||||
|
||||
@@ -205,7 +205,7 @@ void DllLoader::LogLoadError(const char* errors)
|
||||
LOGMESSAGE("DllLoader: {}", errors);
|
||||
break;
|
||||
case CLogger::Warning:
|
||||
LOGWARNING("DllLoader: %s", errors);
|
||||
LOGWARNING("DllLoader: {}", errors);
|
||||
break;
|
||||
case CLogger::Error:
|
||||
LOGERROR("DllLoader: %s", errors);
|
||||
|
||||
@@ -435,16 +435,16 @@ static void FixLocales()
|
||||
for (size_t i = 0; i < ARRAY_SIZE(LocaleEnvVars); i++)
|
||||
{
|
||||
if (char* envval = getenv(LocaleEnvVars[i]))
|
||||
LOGWARNING(" %s=\"%s\"", LocaleEnvVars[i], envval);
|
||||
LOGWARNING(" {}=\"{}\"", LocaleEnvVars[i], envval);
|
||||
else
|
||||
LOGWARNING(" %s=\"(unset)\"", LocaleEnvVars[i]);
|
||||
LOGWARNING(" {}=\"(unset)\"", LocaleEnvVars[i]);
|
||||
}
|
||||
|
||||
// We should set LC_ALL since it overrides LANG
|
||||
if (setenv("LC_ALL", std::locale::classic().name().c_str(), 1))
|
||||
debug_warn(L"Invalid locale settings, and unable to set LC_ALL env variable.");
|
||||
else
|
||||
LOGWARNING("Setting LC_ALL env variable to: %s", getenv("LC_ALL"));
|
||||
LOGWARNING("Setting LC_ALL env variable to: {}", getenv("LC_ALL"));
|
||||
}
|
||||
}
|
||||
#else
|
||||
|
||||
@@ -119,7 +119,7 @@ static void LoadConfigBindings(CConfigDB& configDB)
|
||||
SDL_Scancode scancode = FindScancode(it->c_str());
|
||||
if (!scancode)
|
||||
{
|
||||
LOGWARNING("Hotkey mapping used invalid key '%s'", hotkey.c_str());
|
||||
LOGWARNING("Hotkey mapping used invalid key '{}'", hotkey);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
+2
-1
@@ -99,7 +99,8 @@ bool LoadModJSON(const PIVFS& vfs, OsPath modsPath, OsPath mod, std::string& tex
|
||||
else
|
||||
{
|
||||
// Print a warning - we'll keep trying, which could have adverse effects.
|
||||
LOGWARNING("Could not write external mod.json for zipped mod '%s'. The mod should be reinstalled.", mod.string8());
|
||||
LOGWARNING("Could not write external mod.json for zipped mod '{}'. The mod should be "
|
||||
"reinstalled.", mod.string8());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -186,8 +186,11 @@ void CheckReplayMods(const std::vector<Mod::ModData>& replayMods)
|
||||
for (const Mod::ModData& data : replayMods)
|
||||
replayData.push_back(&data);
|
||||
if (!Mod::AreModsPlayCompatible(g_Mods.GetEnabledModsData(), replayData))
|
||||
LOGWARNING("Incompatible replay mods detected.\nThe mods of the replay are:\n%s\nThese mods are enabled:\n%s",
|
||||
ModListToString(replayData), ModListToString(g_Mods.GetEnabledModsData()));
|
||||
{
|
||||
LOGWARNING("Incompatible replay mods detected.\nThe mods of the replay are:\n{}\n"
|
||||
"These mods are enabled:\n{}", ModListToString(replayData),
|
||||
ModListToString(g_Mods.GetEnabledModsData()));
|
||||
}
|
||||
}
|
||||
} // anonymous namespace
|
||||
|
||||
|
||||
@@ -306,7 +306,7 @@ JS::Value SavedGames::GetSavedGames(const Script::Interface& scriptInterface)
|
||||
if (!archiveReader)
|
||||
{
|
||||
// Triggered by e.g. the file being open in another program
|
||||
LOGWARNING("Failed to read saved game '%s'", realPath.string8());
|
||||
LOGWARNING("Failed to read saved game '{}'", realPath.string8());
|
||||
continue; // skip this file
|
||||
}
|
||||
|
||||
|
||||
@@ -380,7 +380,10 @@ bool CVideoMode::SetVideoMode(int w, int h, int bpp, bool fullscreen)
|
||||
else if (forceGLProfile == "core")
|
||||
profile = SDL_GL_CONTEXT_PROFILE_CORE;
|
||||
else if (forceGLProfile != "compatibility")
|
||||
LOGWARNING("Unknown force GL profile '%s', compatibility profile is used", forceGLProfile.c_str());
|
||||
{
|
||||
LOGWARNING("Unknown force GL profile '{}', compatibility profile is used",
|
||||
forceGLProfile);
|
||||
}
|
||||
|
||||
if (forceGLMajorVersion < 1 || forceGLMinorVersion < 0)
|
||||
{
|
||||
@@ -434,7 +437,7 @@ bool CVideoMode::SetVideoMode(int w, int h, int bpp, bool fullscreen)
|
||||
setenv("MVK_CONFIG_LOG_LEVEL", "2", 1);
|
||||
if (SDL_Vulkan_LoadLibrary(fullPathToVulkanLibrary.c_str()) != 0)
|
||||
{
|
||||
LOGWARNING("Failed to load %s.", fullPathToVulkanLibrary.c_str());
|
||||
LOGWARNING("Failed to load {}.", fullPathToVulkanLibrary);
|
||||
DowngradeBackendSettingAfterCreationFailure();
|
||||
return SetVideoMode(w, h, bpp, fullscreen);
|
||||
}
|
||||
@@ -449,7 +452,7 @@ bool CVideoMode::SetVideoMode(int w, int h, int bpp, bool fullscreen)
|
||||
// SDL might fail to create a window in case of missing a Vulkan driver.
|
||||
if (m_Backend == Renderer::Backend::Backend::VULKAN)
|
||||
{
|
||||
LOGWARNING("Failed to create a Vulkan window: %s", SDL_GetError());
|
||||
LOGWARNING("Failed to create a Vulkan window: {}", SDL_GetError());
|
||||
DowngradeBackendSettingAfterCreationFailure();
|
||||
return SetVideoMode(w, h, bpp, fullscreen);
|
||||
}
|
||||
@@ -458,7 +461,7 @@ bool CVideoMode::SetVideoMode(int w, int h, int bpp, bool fullscreen)
|
||||
if (fullscreen)
|
||||
{
|
||||
LOGWARNING("Failed to set the video mode to fullscreen for the chosen resolution "
|
||||
"%dx%d:%d (\"%hs\"), falling back to windowed mode",
|
||||
"{}x{}:{} (\"{}\"), falling back to windowed mode",
|
||||
w, h, bpp, SDL_GetError());
|
||||
// Using default size for the window for now, as the attempted setting
|
||||
// could be as large, or larger than the screen size.
|
||||
|
||||
@@ -388,7 +388,7 @@ JS::Value VisualReplay::LoadReplayData(const Script::Interface& scriptInterface,
|
||||
|
||||
if (type != "start")
|
||||
{
|
||||
LOGWARNING("The replay %s doesn't begin with 'start'!", replayFile.string8().c_str());
|
||||
LOGWARNING("The replay {} doesn't begin with 'start'!", replayFile.string8());
|
||||
SAFE_DELETE(replayStream);
|
||||
return JS::NullValue();
|
||||
}
|
||||
|
||||
@@ -1141,7 +1141,10 @@ void CPatchRData::RenderBlends(
|
||||
// TODO: move enabling blend to XML.
|
||||
const CStrIntern shaderEffect = bestTex->GetMaterial().GetShaderEffect(materialPass);
|
||||
if (shaderEffect != str_terrain_base && shaderEffect != str_terrain_base_reflections && shaderEffect != str_terrain_base_wireframe)
|
||||
ONCE(LOGWARNING("Shader effect '%s' doesn't support semi-transparent terrain rendering.", shaderEffect.c_str()));
|
||||
{
|
||||
ONCE(LOGWARNING("Shader effect '{}' doesn't support semi-transparent terrain "
|
||||
"rendering.", shaderEffect.string()));
|
||||
}
|
||||
layer.m_ShaderTech = g_Renderer.GetShaderManager().LoadEffect([](const CStrIntern shaderEffect)
|
||||
{
|
||||
if (shaderEffect == str_terrain_base)
|
||||
|
||||
@@ -201,14 +201,14 @@ void CPostprocManager::InitializePBR()
|
||||
if (m_Device->IsFramebufferFormatSupported(Renderer::Backend::Format::R32G32B32A32_SFLOAT))
|
||||
m_FramebufferColorFormat = Renderer::Backend::Format::R32G32B32A32_SFLOAT;
|
||||
else
|
||||
LOGWARNING("%s is unsupported", framebufferFormatName);
|
||||
LOGWARNING("{} is unsupported", framebufferFormatName);
|
||||
}
|
||||
else if (framebufferFormatName == "r11g11b10")
|
||||
{
|
||||
if (m_Device->IsFramebufferFormatSupported(Renderer::Backend::Format::B10G11R11_UFLOAT))
|
||||
m_FramebufferColorFormat = Renderer::Backend::Format::B10G11R11_UFLOAT;
|
||||
else
|
||||
LOGWARNING("%s is unsupported", framebufferFormatName);
|
||||
LOGWARNING("{} is unsupported", framebufferFormatName);
|
||||
}
|
||||
|
||||
if (m_Device->GetCapabilities().computeShaders)
|
||||
@@ -887,7 +887,7 @@ void CPostprocManager::UpdateAntiAliasingTechnique()
|
||||
std::end(m_AllowedSampleCounts))
|
||||
{
|
||||
m_MultisampleCount = std::min(4u, m_Device->GetCapabilities().maxSampleCount);
|
||||
LOGWARNING("Wrong MSAA sample count: %s.", m_AAName.EscapeToPrintableASCII().c_str());
|
||||
LOGWARNING("Wrong MSAA sample count: {}.", m_AAName.EscapeToPrintableASCII());
|
||||
}
|
||||
m_UsingMultisampleBuffer = true;
|
||||
CreateMultisampleBuffer();
|
||||
@@ -1085,7 +1085,7 @@ void CPostprocManager::RecalculateSize(const uint32_t width, const uint32_t heig
|
||||
m_Scale = g_ConfigDB.Get("renderer.scale", m_Scale);
|
||||
if (m_Scale < 0.25f || m_Scale > 2.0f)
|
||||
{
|
||||
LOGWARNING("Invalid renderer scale: %0.2f", m_Scale);
|
||||
LOGWARNING("Invalid renderer scale: {:0.2f}", m_Scale);
|
||||
m_Scale = 1.0f;
|
||||
}
|
||||
m_UnscaledWidth = width;
|
||||
|
||||
@@ -856,7 +856,8 @@ void CRenderer::RenderBigScreenShot(const bool needsPresent)
|
||||
const int tileHeight{g_ConfigDB.Get("screenshot.tileheight", 256)};
|
||||
if (tiles <= 0 || tileWidth <= 0 || tileHeight <= 0 || tileWidth * tiles % 4 != 0 || tileHeight * tiles % 4 != 0)
|
||||
{
|
||||
LOGWARNING("Invalid big screenshot size: tiles=%d tileWidth=%d tileHeight=%d", tiles, tileWidth, tileHeight);
|
||||
LOGWARNING("Invalid big screenshot size: tiles={} tileWidth={} tileHeight={}", tiles,
|
||||
tileWidth, tileHeight);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -864,7 +865,7 @@ void CRenderer::RenderBigScreenShot(const bool needsPresent)
|
||||
{
|
||||
LOGWARNING(
|
||||
"The window size is too small for a big screenshot, increase the"
|
||||
" window size %dx%d or decrease the tile size %dx%d",
|
||||
" window size {}x{} or decrease the tile size {}x{}",
|
||||
g_VideoMode.GetWindowWidth(), g_VideoMode.GetWindowHeight(), tileWidth, tileHeight);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -71,7 +71,7 @@ RenderDebugMode RenderDebugModeEnum::FromString(const CStr8& name)
|
||||
if (name == str_RENDER_DEBUG_MODE_CUSTOM.c_str())
|
||||
return RenderDebugMode::CUSTOM;
|
||||
|
||||
LOGWARNING("Unknown render debug mode %s", name.c_str());
|
||||
LOGWARNING("Unknown render debug mode {}", name);
|
||||
return RenderDebugMode::NONE;
|
||||
}
|
||||
|
||||
|
||||
@@ -205,8 +205,8 @@ void GLAD_API_PTR OnDebugMessage(
|
||||
}
|
||||
else
|
||||
{
|
||||
LOGWARNING(
|
||||
"OpenGL | %s: %s source: %s id %u: %s\n", debugSeverity.c_str(), debugType.c_str(), debugSource.c_str(), id, message);
|
||||
LOGWARNING( "OpenGL | {}: {} source: {} id {}: {}\n", debugSeverity, debugType,
|
||||
debugSource, id, message);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -169,7 +169,7 @@ VKAPI_ATTR VkBool32 VKAPI_CALL DebugCallback(
|
||||
return (hideRule.flags & messageType) && message.find(hideRule.pattern) != std::string_view::npos;
|
||||
});
|
||||
if (it == std::end(hideRules))
|
||||
LOGWARNING("Vulkan: %s", callbackData->pMessage);
|
||||
LOGWARNING("Vulkan: {}", callbackData->pMessage);
|
||||
else if (!it->skip)
|
||||
LOGMESSAGE("Vulkan: {}", callbackData->pMessage);
|
||||
}
|
||||
@@ -403,7 +403,7 @@ std::unique_ptr<CDevice> CDevice::Create(SDL_Window* window)
|
||||
return availableDevice.index == static_cast<uint32_t>(deviceIndexOverride);
|
||||
});
|
||||
if (chosenDeviceIt == device->m_AvailablePhysicalDevices.end())
|
||||
LOGWARNING("Device with override index %d not found.", deviceIndexOverride);
|
||||
LOGWARNING("Device with override index {} not found.", deviceIndexOverride);
|
||||
}
|
||||
if (chosenDeviceIt == device->m_AvailablePhysicalDevices.end())
|
||||
{
|
||||
|
||||
@@ -196,7 +196,7 @@ bool warn(JSContext* cx, unsigned int argc, JS::Value* vp)
|
||||
std::wstring str;
|
||||
if (!Script::FromJSVal(rq, args[0], str))
|
||||
return false;
|
||||
LOGWARNING("%s", utf8_from_wstring(str));
|
||||
LOGWARNING("{}", utf8_from_wstring(str));
|
||||
args.rval().setUndefined();
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -361,7 +361,10 @@ void CSimulation2Impl::InitRNGSeedSimulation()
|
||||
Script::Request rq(m_ComponentManager.GetScriptInterface());
|
||||
if (!Script::HasProperty(rq, m_MapSettings, "Seed") ||
|
||||
!Script::GetProperty(rq, m_MapSettings, "Seed", seed))
|
||||
LOGWARNING("CSimulation2Impl::InitRNGSeedSimulation: No seed value specified - using %d", seed);
|
||||
{
|
||||
LOGWARNING("CSimulation2Impl::InitRNGSeedSimulation: No seed value specified - using {}",
|
||||
seed);
|
||||
}
|
||||
|
||||
m_ComponentManager.SetRNGSeed(seed);
|
||||
}
|
||||
@@ -372,7 +375,9 @@ void CSimulation2Impl::InitRNGSeedAI()
|
||||
Script::Request rq(m_ComponentManager.GetScriptInterface());
|
||||
if (!Script::HasProperty(rq, m_MapSettings, "AISeed") ||
|
||||
!Script::GetProperty(rq, m_MapSettings, "AISeed", seed))
|
||||
LOGWARNING("CSimulation2Impl::InitRNGSeedAI: No seed value specified - using %d", seed);
|
||||
{
|
||||
LOGWARNING("CSimulation2Impl::InitRNGSeedAI: No seed value specified - using {}", seed);
|
||||
}
|
||||
|
||||
CmpPtr<ICmpAIManager> cmpAIManager(m_SimContext, SYSTEM_ENTITY);
|
||||
if (cmpAIManager)
|
||||
@@ -640,7 +645,7 @@ void CSimulation2Impl::DumpState()
|
||||
|
||||
if (!DirectoryExists(m_OOSLogPath))
|
||||
{
|
||||
LOGWARNING("OOS-log directory %s was deleted, creating it again.", m_OOSLogPath.string8().c_str());
|
||||
LOGWARNING("OOS-log directory {} was deleted, creating it again.", m_OOSLogPath.string8());
|
||||
CreateDirectories(m_OOSLogPath, 0700);
|
||||
}
|
||||
|
||||
|
||||
@@ -143,7 +143,7 @@ public:
|
||||
{
|
||||
if (m_Paths.find(path.GetName()) != m_Paths.end())
|
||||
{
|
||||
LOGWARNING("Cinema path with name '%s' already exists", path.GetName().ToUTF8());
|
||||
LOGWARNING("Cinema path with name '{}' already exists", path.GetName().ToUTF8());
|
||||
return;
|
||||
}
|
||||
m_Paths[path.GetName()] = path;
|
||||
@@ -153,7 +153,7 @@ public:
|
||||
{
|
||||
if (!HasPath(name))
|
||||
{
|
||||
LOGWARNING("Cinema path with name '%s' doesn't exist", name.ToUTF8());
|
||||
LOGWARNING("Cinema path with name '{}' doesn't exist", name.ToUTF8());
|
||||
return;
|
||||
}
|
||||
m_PathQueue.remove_if([name](const CCinemaPath& path) { return path.GetName() == name; });
|
||||
@@ -179,7 +179,7 @@ public:
|
||||
{
|
||||
if (!HasPath(name))
|
||||
{
|
||||
LOGWARNING("Cinema path with name '%s' doesn't exist", name.ToUTF8());
|
||||
LOGWARNING("Cinema path with name '{}' doesn't exist", name.ToUTF8());
|
||||
return;
|
||||
}
|
||||
m_PathQueue.push_back(m_Paths[name]);
|
||||
|
||||
@@ -1618,12 +1618,18 @@ public:
|
||||
{
|
||||
// Min range must be non-negative.
|
||||
if (minRange < entity_pos_t::Zero())
|
||||
LOGWARNING("CCmpRangeManager: Invalid min range %f in query for entity %u", minRange.ToDouble(), source);
|
||||
{
|
||||
LOGWARNING("CCmpRangeManager: Invalid min range {:f} in query for entity {}",
|
||||
minRange.ToDouble(), source);
|
||||
}
|
||||
|
||||
// Max range must be non-negative, or else ALWAYS_IN_RANGE.
|
||||
// TODO add NEVER_IN_RANGE.
|
||||
if (maxRange < entity_pos_t::Zero() && maxRange != ALWAYS_IN_RANGE)
|
||||
LOGWARNING("CCmpRangeManager: Invalid max range %f in query for entity %u", maxRange.ToDouble(), source);
|
||||
{
|
||||
LOGWARNING("CCmpRangeManager: Invalid max range {:f} in query for entity {}",
|
||||
maxRange.ToDouble(), source);
|
||||
}
|
||||
|
||||
CmpPtr<ICmpOwnership> cmpOwnership(GetSimContext(), source);
|
||||
|
||||
@@ -1663,7 +1669,7 @@ public:
|
||||
q.ownersMask |= CalcOwnerMask(owners[i]);
|
||||
|
||||
if (q.ownersMask == 0)
|
||||
LOGWARNING("CCmpRangeManager: No owners in query for entity %u", source);
|
||||
LOGWARNING("CCmpRangeManager: No owners in query for entity {}", source);
|
||||
|
||||
q.interface = requiredInterface;
|
||||
q.flagsMask = flagsMask;
|
||||
@@ -1826,7 +1832,7 @@ public:
|
||||
if (identifier == "injured")
|
||||
return FlagMasks::Injured;
|
||||
|
||||
LOGWARNING("CCmpRangeManager: Invalid flag identifier %s", identifier.c_str());
|
||||
LOGWARNING("CCmpRangeManager: Invalid flag identifier {}", identifier);
|
||||
return FlagMasks::None;
|
||||
}
|
||||
|
||||
@@ -1841,7 +1847,10 @@ public:
|
||||
std::uint8_t flag = GetEntityFlagMask(identifier);
|
||||
|
||||
if (flag == FlagMasks::None)
|
||||
LOGWARNING("CCmpRangeManager: Invalid flag identifier %s for entity %u", identifier.c_str(), ent);
|
||||
{
|
||||
LOGWARNING("CCmpRangeManager: Invalid flag identifier {} for entity {}", identifier,
|
||||
ent);
|
||||
}
|
||||
else
|
||||
it->second.SetFlag(flag, value);
|
||||
}
|
||||
|
||||
@@ -57,7 +57,7 @@ CCinemaPath::CCinemaPath(const CCinemaData& data, const TNSpline& spline, const
|
||||
DistModePtr = &CCinemaPath::EaseOutIn;
|
||||
else
|
||||
{
|
||||
LOGWARNING("Cinematic mode not found for '%s'", data.m_Mode.ToUTF8().c_str());
|
||||
LOGWARNING("Cinematic mode not found for '{}'", data.m_Mode.ToUTF8());
|
||||
DistModePtr = &CCinemaPath::EaseInOut;
|
||||
}
|
||||
|
||||
@@ -73,13 +73,14 @@ CCinemaPath::CCinemaPath(const CCinemaData& data, const TNSpline& spline, const
|
||||
DistStylePtr = &CCinemaPath::EaseSine;
|
||||
else
|
||||
{
|
||||
LOGWARNING("Cinematic style not found for '%s'", data.m_Style.ToUTF8().c_str());
|
||||
LOGWARNING("Cinematic style not found for '{}'", data.m_Style.ToUTF8());
|
||||
DistStylePtr = &CCinemaPath::EaseDefault;
|
||||
}
|
||||
|
||||
if (m_Timescale <= fixed::FromInt(0))
|
||||
{
|
||||
LOGWARNING("Invalid cinema path timescale specified: %f. It must be greater than 0.", m_Timescale.ToFloat());
|
||||
LOGWARNING("Invalid cinema path timescale specified: {:f}. It must be greater than 0.",
|
||||
m_Timescale.ToFloat());
|
||||
m_Timescale = fixed::FromInt(1);
|
||||
}
|
||||
}
|
||||
@@ -117,7 +118,10 @@ const CStrW& CCinemaPath::GetName() const
|
||||
void CCinemaPath::SetTimescale(fixed scale)
|
||||
{
|
||||
if (scale <= fixed::FromInt(0))
|
||||
LOGWARNING("Invalid cinema path timescale specified: %f. It must be greater than 0.", scale.ToFloat());
|
||||
{
|
||||
LOGWARNING("Invalid cinema path timescale specified: {:f}. It must be greater than 0.",
|
||||
scale.ToFloat());
|
||||
}
|
||||
else
|
||||
m_Timescale = scale;
|
||||
}
|
||||
|
||||
@@ -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
|
||||
@@ -166,7 +166,7 @@ PathfinderPassability::PathfinderPassability(pass_class_t mask, const CParamNode
|
||||
// If clearance isn't an integer number of navcells then we'll
|
||||
// probably get weird behaviour when expanding the navcell grid
|
||||
// by clearance, vs expanding static obstructions by clearance
|
||||
LOGWARNING("Pathfinder passability class has clearance %f, should be multiple of %f",
|
||||
LOGWARNING("Pathfinder passability class has clearance {:f}, should be multiple of {:f}",
|
||||
m_Clearance.ToFloat(), Pathfinding::NAVCELL_SIZE.ToFloat());
|
||||
}*/
|
||||
}
|
||||
|
||||
@@ -140,7 +140,7 @@ void CParamNode::ApplyLayer(const XMBData& xmb, const XMBElement& element, const
|
||||
else if (attr.Value == "mul_round")
|
||||
op = MUL_ROUND;
|
||||
else
|
||||
LOGWARNING("Invalid op '%ls'", attr.Value);
|
||||
LOGWARNING("Invalid op '{}'", attr.Value);
|
||||
}
|
||||
}
|
||||
for (XMBAttribute attr : element.GetAttributes())
|
||||
@@ -174,7 +174,7 @@ void CParamNode::ApplyLayer(const XMBData& xmb, const XMBElement& element, const
|
||||
sourceIdentifier ? (" in '" +
|
||||
utf8_from_wstring(sourceIdentifier) + "'") : ""};
|
||||
LOGWARNING("[ParamNode] Could not remove token "
|
||||
"'%s' from node '%s'%s; not present in "
|
||||
"'{}' from node '{}'{}; not present in "
|
||||
"list nor inherited (possible typo?)",
|
||||
std::string_view{newToken}.substr(1), name,
|
||||
identifier);
|
||||
|
||||
@@ -226,7 +226,7 @@ void CTurnManager::AddCommand(int client, int player, JS::HandleValue data, turn
|
||||
// which is possible when cheats are enabled. Report & ignore.
|
||||
// It seems a bad idea to error out too badly here:
|
||||
// nefarious clients could try and send broken commands to DOS.
|
||||
LOGWARNING("Received command for invalid turn %i (current turn is %i)", turn, m_CurrentTurn);
|
||||
LOGWARNING("Received command for invalid turn {} (current turn is {})", turn, m_CurrentTurn);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -232,7 +232,10 @@ void CSoundGroup::UploadPropertiesAndPlay([[maybe_unused]] size_t index,
|
||||
itemRollOff = 0;
|
||||
|
||||
if (sndData->IsStereo())
|
||||
LOGWARNING("OpenAL: stereo sounds can't be positioned: %s", sndData->GetFileName().string8());
|
||||
{
|
||||
LOGWARNING("OpenAL: stereo sounds can't be positioned: {}",
|
||||
sndData->GetFileName().string8());
|
||||
}
|
||||
|
||||
hSound->SetLocation(CVector3D(itemDist * sin(offset), 0, -itemDist * cos(offset)));
|
||||
hSound->SetRollOff(itemRollOff, m_MinDist, m_MaxDist);
|
||||
|
||||
Reference in New Issue
Block a user