Map label length is correctly determined for multibyte character

and thus the limit has been reduced to 32 characters again (bug #6855).
This commit is contained in:
Mark de Wever 2007-10-01 15:37:05 +00:00
parent fe431b92cb
commit 16f994fb43
3 changed files with 17 additions and 4 deletions

View file

@ -43,6 +43,8 @@ Version 1.3.8+svn:
* miscellaneous and bug fixes:
* various bug fixes and code cleanups
* fixed a glitch where an item halo shifted position when zooming
* map label length is correctly determined for multibyte character
and thus the limit has been reduced to 32 characters again (bug #6855)
Version 1.3.8:
* campaigns:

View file

@ -47,6 +47,10 @@ Version 1.3.8+svn:
* Unit changes and balancing
* Created undead variations for the 'bat' and 'gryphon' race.
* Miscellaneous and bug fixes
* Map label length is properly calculated and has been reduced
to 32 characters.
Version 1.3.8:
* Campaigns
* Descent into Darkness

View file

@ -23,7 +23,7 @@
#include "wassert.hpp"
namespace {
const size_t max_label_size = 64;
const size_t max_label_size = 32;
}
//our definition of map labels being obscured is if the tile is obscured,
@ -501,9 +501,16 @@ bool terrain_label::visible() const
void terrain_label::check_text_length()
{
if (text_.size() > parent_->get_max_chars())
{
text_.resize(parent_->get_max_chars());
// The actual data is wide_strings so test in wide_string mode
// also cutting a wide_string at an arbritary place gives odd
// problems.
//
//! @todo It might be an option to use wide_string as type for
// the labels to avoid this conversion
wide_string tmp = utils::string_to_wstring(text_);
if(tmp.size() > parent_->get_max_chars()) {
tmp.resize(parent_->get_max_chars());
text_ = utils::wstring_to_string(tmp);
}
}