(svn r18872) -Codechange: introduce PaletteID and use it

This commit is contained in:
rubidium
2010-01-21 01:38:13 +00:00
parent 02edae5454
commit f94c83a387
33 changed files with 94 additions and 95 deletions

View File

@@ -766,7 +766,7 @@ void CallVehicleTicks()
static void DoDrawVehicle(const Vehicle *v)
{
SpriteID image = v->cur_image;
SpriteID pal = PAL_NONE;
PaletteID pal = PAL_NONE;
if (v->vehstatus & VS_DEFPAL) pal = (v->vehstatus & VS_CRASHED) ? PALETTE_CRASH : GetVehiclePalette(v);
@@ -1393,9 +1393,9 @@ const Livery *GetEngineLivery(EngineID engine_type, CompanyID company, EngineID
}
static SpriteID GetEngineColourMap(EngineID engine_type, CompanyID company, EngineID parent_engine_type, const Vehicle *v)
static PaletteID GetEngineColourMap(EngineID engine_type, CompanyID company, EngineID parent_engine_type, const Vehicle *v)
{
SpriteID map = (v != NULL) ? v->colourmap : PAL_NONE;
PaletteID map = (v != NULL) ? v->colourmap : PAL_NONE;
/* Return cached value if any */
if (map != PAL_NONE) return map;
@@ -1421,7 +1421,7 @@ static SpriteID GetEngineColourMap(EngineID engine_type, CompanyID company, Engi
bool twocc = HasBit(e->info.misc_flags, EF_USES_2CC);
if (map == PAL_NONE) map = twocc ? (SpriteID)SPR_2CCMAP_BASE : (SpriteID)PALETTE_RECOLOUR_START;
if (map == PAL_NONE) map = twocc ? (PaletteID)SPR_2CCMAP_BASE : (PaletteID)PALETTE_RECOLOUR_START;
/* Spectator has news shown too, but has invalid company ID - as well as dedicated server */
if (!Company::IsValidID(company)) return map;
@@ -1436,12 +1436,12 @@ static SpriteID GetEngineColourMap(EngineID engine_type, CompanyID company, Engi
return map;
}
SpriteID GetEnginePalette(EngineID engine_type, CompanyID company)
PaletteID GetEnginePalette(EngineID engine_type, CompanyID company)
{
return GetEngineColourMap(engine_type, company, INVALID_ENGINE, NULL);
}
SpriteID GetVehiclePalette(const Vehicle *v)
PaletteID GetVehiclePalette(const Vehicle *v)
{
if (v->type == VEH_TRAIN) {
return GetEngineColourMap(v->engine_type, v->owner, Train::From(v)->tcache.first_engine, v);