mirror of
https://github.com/edubart/otclient.git
synced 2025-12-03 00:16:50 +01:00
add clock, change exceptions, add network exceptions, fix some crashes
This commit is contained in:
@@ -79,8 +79,6 @@ BorderImagePtr BorderImage::loadFromOTML(const OTMLNodePtr& borderImageNode)
|
||||
// load texture
|
||||
std::string source = borderImageNode->at("source")->value();
|
||||
TexturePtr texture = g_textures.getTexture(source);
|
||||
if(!texture)
|
||||
throw OTMLException(borderImageNode, "could not load border-image texture");
|
||||
|
||||
// load basic border confs
|
||||
size = texture->getSize();
|
||||
|
||||
@@ -37,8 +37,6 @@ void Font::load(const OTMLNodePtr& fontNode)
|
||||
|
||||
// load font texture
|
||||
m_texture = g_textures.getTexture(textureName);
|
||||
if(!m_texture)
|
||||
throw std::runtime_error("failed to load texture for font");
|
||||
|
||||
if(OTMLNodePtr node = fontNode->get("fixed-glyph-width")) {
|
||||
for(int glyph = m_firstGlyph; glyph < 256; ++glyph)
|
||||
|
||||
@@ -44,7 +44,7 @@ bool FontManager::importFont(std::string fontFile)
|
||||
|
||||
std::string name = fontNode->valueAt("name");
|
||||
if(fontExists(name))
|
||||
throw std::runtime_error("a font with the same name is already imported, did you duplicate font names?");
|
||||
Fw::throwException("font '", name, "' already exists, cannot have duplicate font names");
|
||||
|
||||
FontPtr font(new Font(name));
|
||||
font->load(fontNode);
|
||||
@@ -55,8 +55,8 @@ bool FontManager::importFont(std::string fontFile)
|
||||
m_defaultFont = font;
|
||||
|
||||
return true;
|
||||
} catch(std::exception& e) {
|
||||
logError("could not load font from '", fontFile, "': ", e.what());
|
||||
} catch(Exception& e) {
|
||||
logError("Unable to load font from file '", fontFile, "': ", e.what());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -43,8 +43,6 @@ void Image::loadFromOTML(const OTMLNodePtr& imageNode)
|
||||
|
||||
// load texture
|
||||
m_texture = g_textures.getTexture(source);
|
||||
if(!m_texture)
|
||||
throw OTMLException(imageNode, "could not load image texture");
|
||||
m_textureCoords = imageNode->valueAt("coords", Rect(Point(0,0),m_texture->getSize()));
|
||||
|
||||
// enable texture bilinear filter
|
||||
|
||||
@@ -46,14 +46,14 @@ TexturePtr TextureManager::getTexture(const std::string& textureFile)
|
||||
try {
|
||||
// currently only png textures are supported
|
||||
if(!boost::ends_with(textureFile, ".png"))
|
||||
throw std::runtime_error("texture file format no supported");
|
||||
Fw::throwException("texture file format no supported");
|
||||
|
||||
// load texture file data
|
||||
std::stringstream fin;
|
||||
g_resources.loadFile(textureFile, fin);
|
||||
texture = loadPNG(fin);
|
||||
} catch(std::exception& e) {
|
||||
logError("unable to load texture '",textureFile,"': ", e.what());
|
||||
} catch(Exception& e) {
|
||||
Fw::throwException("unable to load texture '", textureFile, "': ", e.what());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user