From c085c06f72cb59602a8ba000bc7958b428350877 Mon Sep 17 00:00:00 2001 From: meep-eep Date: Thu, 25 Aug 2005 00:03:27 +0000 Subject: [PATCH] Support UTF-8 in mineral names (bug #770). git-svn-id: svn://svn.code.sf.net/p/sc2/code/trunk@1861 8092fc87-c524-0410-9efc-e669fe64eaf9 --- sc2/ChangeLog | 1 + sc2/src/sc2code/planets/lander.c | 22 +++++++++++++++------- 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/sc2/ChangeLog b/sc2/ChangeLog index 58d65c05b..2fd4f79f1 100644 --- a/sc2/ChangeLog +++ b/sc2/ChangeLog @@ -1,4 +1,5 @@ Changes towards version 0.5: +- Support UTF-8 chars in mineral names (bug #770) - SvdB - Modified scalers to use surface pitch instead of width - reported to fix bug #740 - Michael - Cleaner build output. Set '$MAKE_VERBOSE' to 1 for old output. - SvdB diff --git a/sc2/src/sc2code/planets/lander.c b/sc2/src/sc2code/planets/lander.c index 009cdb8e4..dc8386e88 100644 --- a/sc2/src/sc2code/planets/lander.c +++ b/sc2/src/sc2code/planets/lander.c @@ -798,28 +798,36 @@ CheckObjectCollision (COUNT index) (SURFACE_HEIGHT >> 1) + (ElementControl.EndPoint.y - LanderControl.EndPoint.y); - pPSD->MineralText[0].CharCount = (COUNT)~0; + pPSD->MineralText[0].CharCount = + (COUNT)~0; pPSD->MineralText[1].pStr = pStr; while ((ch = *pStr++) && ch != ' ') ; if (ch == '\0') { - pPSD->MineralText[1].CharCount = (COUNT)~0; + pPSD->MineralText[1].CharCount = + (COUNT)~0; pPSD->MineralText[2].CharCount = 0; } - else + else /* ch == ' ' */ { + // Name contains a space. Print over + // two lines. pPSD->MineralText[1].CharCount = - (pStr - pPSD->MineralText[1].pStr) - 1; + utf8StringCountN( + pPSD->MineralText[1].pStr, + pStr - 1); pPSD->MineralText[2].pStr = pStr; - pPSD->MineralText[2].CharCount = (COUNT)~0; + pPSD->MineralText[2].CharCount = + (COUNT)~0; } } break; } PlaySound (SetAbsSoundIndex ( - LanderSounds, LANDER_FULL - ), NotPositional (), NULL, GAME_SOUND_PRIORITY); + LanderSounds, LANDER_FULL), + NotPositional (), NULL, + GAME_SOUND_PRIORITY); continue; case BIOLOGICAL_SCAN: if (pPSD->BiologicalLevel < MAX_SCROUNGED)