1
0
mirror of https://github.com/OpenTTD/OpenTTD synced 2026-01-16 17:02:37 +01:00

(svn r13871) [0.6] -Backport from trunk:

- Fix: NewGRF Callback 10 (visual effect and powered wagons setting) and powered wagons operation were not performed for articulated wagons [FS#2167] (r13870)
- Fix: In some cases the sprite cache could be filled with unremovable items [FS#2153] (r13869)
- Fix: Return of wrong parent scope of (NewGRF) industry variables (r13868)
- Fix: Loading of TTD(Patch) savegames from the command line did not work (r13859)
- Fix: Buffer overflow for too long filename supplied as '-g' parameter (r13858)
- Fix: Cargo type lookup was incorrect for NewGRF version 7 files without a translation table [FS#2157] (r13855)
- Fix: GetTownByTile() is only valid for houses and roads (r13851)
- Fix: Power, running cost and capacity of multiheaded engines were (too often) doubled in newspaper resp. offer window (r13844)
- Fix: FreeType may return a bitmap glyph even if a grey-scale glyph was requested [FS#2152] (r13832)
This commit is contained in:
rubidium
2008-07-29 22:37:54 +00:00
parent 22cda2f1b8
commit 6054758c1d
10 changed files with 104 additions and 37 deletions

View File

@@ -137,7 +137,7 @@ static void* ReadSprite(SpriteCache *sc, SpriteID id, bool real_sprite)
file_pos = GetSpriteCache(SPR_IMG_QUERY)->file_pos;
}
if (BlitterFactoryBase::GetCurrentBlitter()->GetScreenDepth() == 32) {
if (real_sprite && BlitterFactoryBase::GetCurrentBlitter()->GetScreenDepth() == 32) {
#ifdef WITH_PNG
/* Try loading 32bpp graphics in case we are 32bpp output */
SpriteLoaderPNG sprite_loader;
@@ -147,7 +147,7 @@ static void* ReadSprite(SpriteCache *sc, SpriteID id, bool real_sprite)
sc->ptr = BlitterFactoryBase::GetCurrentBlitter()->Encode(&sprite, &AllocSprite);
free(sprite.data);
sc->real_sprite = true;
sc->real_sprite = real_sprite;
return sc->ptr;
}
@@ -173,13 +173,13 @@ static void* ReadSprite(SpriteCache *sc, SpriteID id, bool real_sprite)
DEBUG(sprite, warning_level, "Tried to load non sprite #%d as a real sprite. Probable cause: NewGRF interference", id);
warning_level = 6;
if (id == SPR_IMG_QUERY) error("Uhm, would you be so kind not to load a NewGRF that makes the 'query' sprite a non- sprite?");
return (void*)GetSprite(SPR_IMG_QUERY);
return (void*)GetRawSprite(SPR_IMG_QUERY, true);
}
byte *dest = (byte *)AllocSprite(num);
sc->ptr = dest;
sc->real_sprite = false;
sc->real_sprite = real_sprite;
FioReadBlock(dest, num);
return sc->ptr;
@@ -194,6 +194,7 @@ static void* ReadSprite(SpriteCache *sc, SpriteID id, bool real_sprite)
* something ;) The image should really have been a data-stream
* (so type = 0xFF basicly). */
if (id >= 4845 && id <= 4881) {
assert(real_sprite);
uint height = FioReadByte();
uint width = FioReadWord();
Sprite *sprite;
@@ -221,22 +222,23 @@ static void* ReadSprite(SpriteCache *sc, SpriteID id, bool real_sprite)
}
}
sc->real_sprite = false;
sc->real_sprite = real_sprite;
return sc->ptr;
}
sc->real_sprite = true;
if (!real_sprite) {
static byte warning_level = 0;
DEBUG(sprite, warning_level, "Tried to load real sprite #%d as a non sprite. Probable cause: NewGRF interference", id);
warning_level = 6;
return (void*)GetRawSprite(id, true);
}
SpriteLoaderGrf sprite_loader;
SpriteLoader::Sprite sprite;
sc->real_sprite = real_sprite;
if (!sprite_loader.LoadSprite(&sprite, file_slot, file_pos)) return NULL;
if (id == 142) sprite.height = 10; // Compensate for a TTD bug
sc->ptr = BlitterFactoryBase::GetCurrentBlitter()->Encode(&sprite, &AllocSprite);