diff options
author | tron <tron@openttd.org> | 2005-09-10 08:17:30 +0000 |
---|---|---|
committer | tron <tron@openttd.org> | 2005-09-10 08:17:30 +0000 |
commit | 9de2c05c5602293a11a57f2e88d4575230a4e105 (patch) | |
tree | 507775a3d6777a0e74faaafe964b0f305e7bd216 | |
parent | 0fe36a6900b135361a3f01b36a00d8ad6acac8bc (diff) | |
download | openttd-9de2c05c5602293a11a57f2e88d4575230a4e105.tar.xz |
(svn r2933) Implement the non-breaking space
-rw-r--r-- | gfx.c | 6 | ||||
-rw-r--r-- | gfx.h | 2 | ||||
-rw-r--r-- | gfxinit.c | 7 | ||||
-rw-r--r-- | spritecache.c | 8 | ||||
-rw-r--r-- | spritecache.h | 1 | ||||
-rw-r--r-- | strgen/strgen.c | 4 |
6 files changed, 21 insertions, 7 deletions
@@ -1627,15 +1627,15 @@ void LoadStringWidthTable(void) // 2 equals space. for (i = 2; i != 226; i++) { - *b++ = (i < 93 || i > 113) && i != 116 && i != 117 && (i < 123 || i > 129) && (i < 151 || i > 153) && i != 155 ? GetSprite(i)->width : 0; + *b++ = (i < 93 || i > 97) && (i < 99 || i > 113) && i != 116 && i != 117 && (i < 123 || i > 129) && (i < 151 || i > 153) && i != 155 ? GetSprite(i)->width : 0; } for (i = 226; i != 450; i++) { - *b++ = (i < 317 || i >= 354) && i != 367 && (i < 375 || i > 377) && i != 379 ? GetSprite(i)->width + 1 : 0; + *b++ = (i < 317 || i > 321) && (i < 323 || i > 353) && i != 367 && (i < 375 || i > 377) && i != 379 ? GetSprite(i)->width + 1 : 0; } for (i = 450; i != 674; i++) { - *b++ = (i < 541 || i >= 579) && i != 585 && i != 587 && i != 588 && (i < 590 || i > 597) && (i < 599 || i > 601) && i != 603 && i != 633 && i != 665 ? GetSprite(i)->width + 1 : 0; + *b++ = (i < 541 || i > 577) && i != 585 && i != 587 && i != 588 && (i < 590 || i > 597) && (i < 599 || i > 601) && i != 603 && i != 633 && i != 665 ? GetSprite(i)->width + 1 : 0; } } @@ -41,7 +41,7 @@ void GfxScroll(int left, int top, int width, int height, int xo, int yo); // XXX doesn't really belong here, but the only // consumers always use it in conjunction with DoDrawString() -#define UPARROW "\xA0" +#define UPARROW "\x80" #define DOWNARROW "\xAA" @@ -192,7 +192,7 @@ static const SpriteID trg1idx[] = { 2, 92, // ' ' till 'z' 0xFFFE, 36, 160, 160, // Move ¾ to the correct position - 130, 130, // TODO Up arrow + 98, 98, // Up arrow 131, 133, 0xFFFE, 1, // skip currency sign 135, 135, @@ -219,7 +219,7 @@ static const SpriteID trg1idx[] = { 342, 346, // place holders for transport markers 0xFFFE, 6, 384, 384, // Move ¾ to the correct position - 354, 354, // TODO Up arrow + 322, 322, // Up arrow 355, 357, 0xFFFE, 1, // skip currency sign 359, 359, @@ -316,6 +316,9 @@ static void LoadSpriteTables(void) files = _use_dos_palette? &files_dos : &files_win; LoadGrfIndexed(files->basic[0].filename, trg1idx, 0); + DupSprite( 2, 130); // non-breaking space medium + DupSprite(226, 354); // non-breaking space tiny + DupSprite(450, 578); // non-breaking space large load_index = 4793; for (i = 1; files->basic[i].filename != NULL; i++) { diff --git a/spritecache.c b/spritecache.c index 967538125..df64970fa 100644 --- a/spritecache.c +++ b/spritecache.c @@ -155,6 +155,14 @@ bool LoadNextSprite(int load_index, byte file_index) return true; } + +void DupSprite(SpriteID old, SpriteID new) +{ + _sprite_file_pos[new] = _sprite_file_pos[old]; + _sprite_ptr[new] = NULL; +} + + void SkipSprites(uint count) { for (; count > 0; --count) { diff --git a/spritecache.h b/spritecache.h index c2ff67134..ebc37de2b 100644 --- a/spritecache.h +++ b/spritecache.h @@ -28,6 +28,7 @@ void GfxInitSpriteMem(void); void IncreaseSpriteLRU(void); bool LoadNextSprite(int load_index, byte file_index); +void DupSprite(SpriteID old, SpriteID new); void SkipSprites(uint count); #endif diff --git a/strgen/strgen.c b/strgen/strgen.c index 719f91833..84df5fa17 100644 --- a/strgen/strgen.c +++ b/strgen/strgen.c @@ -465,7 +465,9 @@ static const CmdStruct _cmd_structs[] = { // 0x9E=158 is the LAST special character we may use. - {"UPARROW", EmitSingleByte, 0xA0, 0}, + {"UPARROW", EmitSingleByte, 0x80, 0}, + + {"NBSP", EmitSingleByte, 0xA0, 0, C_DONTCOUNT}, {"POUNDSIGN", EmitSingleByte, 0xA3, 0}, {"YENSIGN", EmitSingleByte, 0xA5, 0}, {"COPYRIGHT", EmitSingleByte, 0xA9, 0}, |