mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-16 18:19:55 +00:00
Clean code up a bit
This commit is contained in:
parent
ba91cd658b
commit
5f41f7c48d
4 changed files with 11 additions and 11 deletions
|
@ -239,16 +239,13 @@ BookTypesetter::Ptr JournalBooks::createLatinJournalIndex ()
|
||||||
{
|
{
|
||||||
char ch = 'A' + i;
|
char ch = 'A' + i;
|
||||||
char buffer [32];
|
char buffer [32];
|
||||||
|
|
||||||
sprintf (buffer, "( %c )", ch);
|
sprintf (buffer, "( %c )", ch);
|
||||||
|
|
||||||
char buffer2 [32];
|
char buffer2 [32];
|
||||||
sprintf(buffer2, "%c", ch);
|
sprintf(buffer2, "%c", ch);
|
||||||
const char * c = buffer2;
|
Utf8Stream stream (buffer2);
|
||||||
Utf8Stream stream ((unsigned char*) c,(unsigned char*) c + strlen(c));
|
|
||||||
uint32_t first = stream.peek();
|
uint32_t first = stream.peek();
|
||||||
|
|
||||||
// TODO: find a way to store a multibyte character in the InteractiveId (this is a intptr_t)
|
|
||||||
const MWGui::TextColours& textColours = MWBase::Environment::get().getWindowManager()->getTextColours();
|
const MWGui::TextColours& textColours = MWBase::Environment::get().getWindowManager()->getTextColours();
|
||||||
BookTypesetter::Style* style = typesetter->createHotStyle (body, textColours.journalTopic,
|
BookTypesetter::Style* style = typesetter->createHotStyle (body, textColours.journalTopic,
|
||||||
textColours.journalTopicOver,
|
textColours.journalTopicOver,
|
||||||
|
@ -274,13 +271,12 @@ BookTypesetter::Ptr JournalBooks::createCyrillicJournalIndex ()
|
||||||
for (int i = 0; i < 32; ++i)
|
for (int i = 0; i < 32; ++i)
|
||||||
{
|
{
|
||||||
char buffer [32];
|
char buffer [32];
|
||||||
|
|
||||||
sprintf(buffer, "( %c%c )", 0xd0, 0x90 + i); // CYRILLIC CAPITAL A is a 0xd090 in UTF-8
|
sprintf(buffer, "( %c%c )", 0xd0, 0x90 + i); // CYRILLIC CAPITAL A is a 0xd090 in UTF-8
|
||||||
|
|
||||||
char buffer2 [32];
|
char buffer2 [32];
|
||||||
sprintf(buffer2, "%c%c", 0xd0, 0x90 + i);
|
sprintf(buffer2, "%c%c", 0xd0, 0x90 + i);
|
||||||
const char * c = buffer2;
|
|
||||||
Utf8Stream stream ((unsigned char*) c,(unsigned char*) c + strlen(c));
|
Utf8Stream stream (buffer2);
|
||||||
uint32_t first = stream.peek();
|
uint32_t first = stream.peek();
|
||||||
|
|
||||||
const MWGui::TextColours& textColours = MWBase::Environment::get().getWindowManager()->getTextColours();
|
const MWGui::TextColours& textColours = MWBase::Environment::get().getWindowManager()->getTextColours();
|
||||||
|
|
|
@ -313,8 +313,7 @@ struct JournalViewModelImpl : JournalViewModel
|
||||||
|
|
||||||
for (MWBase::Journal::TTopicIter i = journal->topicBegin (); i != journal->topicEnd (); ++i)
|
for (MWBase::Journal::TTopicIter i = journal->topicBegin (); i != journal->topicEnd (); ++i)
|
||||||
{
|
{
|
||||||
const char * c = i->first.c_str();
|
Utf8Stream stream (i->first.c_str());
|
||||||
Utf8Stream stream ((unsigned char*) c,(unsigned char*) c + strlen(c));
|
|
||||||
uint32_t first = Misc::StringUtils::toUpper(stream.peek());
|
uint32_t first = Misc::StringUtils::toUpper(stream.peek());
|
||||||
|
|
||||||
if (first != character)
|
if (first != character)
|
||||||
|
|
|
@ -58,7 +58,7 @@ public:
|
||||||
|
|
||||||
static uint32_t toUpper(uint32_t ch)
|
static uint32_t toUpper(uint32_t ch)
|
||||||
{
|
{
|
||||||
// Russian alphabete
|
// Russian alphabet
|
||||||
if (ch >= 0x0430 && ch < 0x0450)
|
if (ch >= 0x0430 && ch < 0x0450)
|
||||||
ch -= 0x20;
|
ch -= 0x20;
|
||||||
|
|
||||||
|
@ -66,7 +66,7 @@ public:
|
||||||
if (ch == 0x0451)
|
if (ch == 0x0451)
|
||||||
ch -= 0x50;
|
ch -= 0x50;
|
||||||
|
|
||||||
// Latin alphabete
|
// Latin alphabet
|
||||||
if (ch >= 0x61 && ch < 0x80)
|
if (ch >= 0x61 && ch < 0x80)
|
||||||
ch -= 0x20;
|
ch -= 0x20;
|
||||||
|
|
||||||
|
|
|
@ -18,6 +18,11 @@ public:
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Utf8Stream (const char * str) :
|
||||||
|
cur ((unsigned char*) str), nxt ((unsigned char*) str), end ((unsigned char*) str + strlen(str)), val(Utf8Stream::sBadChar())
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
Utf8Stream (std::pair <Point, Point> range) :
|
Utf8Stream (std::pair <Point, Point> range) :
|
||||||
cur (range.first), nxt (range.first), end (range.second), val(Utf8Stream::sBadChar())
|
cur (range.first), nxt (range.first), end (range.second), val(Utf8Stream::sBadChar())
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue