creature names font fix

This commit is contained in:
Henrique Santiago 2011-12-21 02:43:51 -02:00
parent 2b25ffd86b
commit e6d1252b34
3 changed files with 8 additions and 2 deletions

View File

@ -3,6 +3,7 @@ Font
texture: verdana-11px-rounded.png
height: 14
glyph-size: 16 16
spacing: -1 0
glyph-widths:
32: 4

View File

@ -188,7 +188,9 @@ const std::vector<Point>& Font::calculateGlyphsPositions(const std::string& text
lineWidths.resize(lines+1);
lineWidths[lines] = 0;
} else if(glyph >= 32) {
lineWidths[lines] += m_glyphsSize[glyph].width();
lineWidths[lines] += m_glyphsSize[glyph].width() ;
if((i+1 != textLength && text[i+1] != '\n')) // only add space if letter is not the last or before a \n.
lineWidths[lines] += m_glyphSpacing.width();
maxLineWidth = std::max(maxLineWidth, lineWidths[lines]);
}
}
@ -221,7 +223,7 @@ const std::vector<Point>& Font::calculateGlyphsPositions(const std::string& text
// render only if the glyph is valid
if(glyph >= 32 && glyph != (uchar)'\n') {
virtualPos.x += m_glyphsSize[glyph].width();
virtualPos.x += m_glyphsSize[glyph].width() + m_glyphSpacing.width();
}
}

View File

@ -1055,6 +1055,9 @@ ThingPtr ProtocolGame::internalGetThing(InputMessage& msg)
uint32 id = msg.getU32();
std::string name = msg.getString();
if(name.length() > 0) // every creature name must have a capital letter
name[0] = toupper(name[0]);
g_map.removeCreatureById(removeId);
if(m_localPlayer->getId() == id)