mirror of
https://github.com/edubart/otclient.git
synced 2025-10-20 22:43:27 +02:00
new logger
scripts are now more error prone
This commit is contained in:
@@ -68,7 +68,7 @@ bool Font::load(const std::string& file)
|
||||
{
|
||||
std::string fileContents = g_resources.loadTextFile(file);
|
||||
if(!fileContents.size()) {
|
||||
logError("Coult not load font file \"%s", file.c_str());
|
||||
flogError("ERROR: Coult not load font file \"%s", file.c_str());
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -96,7 +96,7 @@ bool Font::load(const std::string& file)
|
||||
// load texture
|
||||
m_texture = g_textures.get("fonts/" + textureName);
|
||||
if(!m_texture) {
|
||||
logError("Failed to load image for font file \"%s\"", file.c_str());
|
||||
flogError("ERROR: Failed to load image for font file \"%s\"", file.c_str());
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -123,7 +123,7 @@ bool Font::load(const std::string& file)
|
||||
m_glyphHeight);
|
||||
}
|
||||
} catch (YAML::Exception& e) {
|
||||
logError("Malformed font file \"%s\":\n %s", file.c_str(), e.what());
|
||||
flogError("ERROR: Malformed font file \"%s\":\n %s", file.c_str() % e.what());
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@@ -47,7 +47,7 @@ void Fonts::init(const std::string& defaultFontName)
|
||||
}
|
||||
|
||||
if(!m_defaultFont)
|
||||
logFatal("Could not load the default font \"%s\"\n", defaultFontName.c_str());
|
||||
flogFatal("FATAL ERROR: Could not load the default font \"%s\"\n", defaultFontName.c_str());
|
||||
}
|
||||
|
||||
Font* Fonts::get(const std::string& fontName)
|
||||
@@ -58,6 +58,6 @@ Font* Fonts::get(const std::string& fontName)
|
||||
return (*it).get();
|
||||
}
|
||||
|
||||
logError("Font \"%s\" not found, returing the default one", fontName.c_str());
|
||||
flogError("ERROR: Font \"%s\" not found, returing the default one", fontName.c_str());
|
||||
return m_defaultFont.get();
|
||||
}
|
||||
|
@@ -43,8 +43,8 @@ void Graphics::init()
|
||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
|
||||
|
||||
logInfo("GPU %s", (const char*)glGetString(GL_RENDERER));
|
||||
logInfo("OpenGL %s", (const char*)glGetString(GL_VERSION));
|
||||
flogInfo("GPU %s", (const char*)glGetString(GL_RENDERER));
|
||||
flogInfo("OpenGL %s", (const char*)glGetString(GL_VERSION));
|
||||
}
|
||||
|
||||
void Graphics::terminate()
|
||||
|
@@ -46,18 +46,18 @@ TexturePtr Textures::get(const std::string& textureFile)
|
||||
if(!texture) {
|
||||
// currently only png textures are supported
|
||||
if(!boost::ends_with(textureFile, ".png"))
|
||||
logFatal("Unable to load texture %s, file format no supported.", textureFile.c_str());
|
||||
flogFatal("FATAL ERROR: Unable to load texture %s, file format no supported.", textureFile.c_str());
|
||||
|
||||
// load texture file data
|
||||
uint fileSize;
|
||||
uchar *textureFileData = g_resources.loadFile(textureFile, &fileSize);
|
||||
if(!textureFileData)
|
||||
logFatal("Unable to load texture %s, file could not be read.", textureFile.c_str());
|
||||
flogFatal("FATAL ERROR: Unable to load texture %s, file could not be read.", textureFile.c_str());
|
||||
|
||||
// load the texture
|
||||
texture = TexturePtr(TextureLoader::loadPNG(textureFileData));
|
||||
if(!texture)
|
||||
logFatal("Unable to load texture %s", textureFile.c_str());
|
||||
flogFatal("FATAL ERROR: Unable to load texture %s", textureFile.c_str());
|
||||
delete[] textureFileData;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user