add clock, change exceptions, add network exceptions, fix some crashes

This commit is contained in:
Eduardo Bart
2011-12-01 20:25:32 -02:00
parent 4afbe43e6f
commit d5e15d1f06
54 changed files with 442 additions and 274 deletions

View File

@@ -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();

View File

@@ -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)

View File

@@ -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;
}
}

View File

@@ -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

View File

@@ -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());
}
}