mirror of https://github.com/OpenTTD/OpenTTD.git
(svn r4629) - NewGRF: constify more code that deals with sprite groups, now that ref counting is gone.
This commit is contained in:
parent
8faf1838e6
commit
771b9fc75b
|
@ -18,7 +18,7 @@
|
||||||
typedef struct WagonOverride {
|
typedef struct WagonOverride {
|
||||||
byte *train_id;
|
byte *train_id;
|
||||||
int trains;
|
int trains;
|
||||||
SpriteGroup *group;
|
const SpriteGroup *group;
|
||||||
} WagonOverride;
|
} WagonOverride;
|
||||||
|
|
||||||
typedef struct WagonOverrides {
|
typedef struct WagonOverrides {
|
||||||
|
@ -28,8 +28,7 @@ typedef struct WagonOverrides {
|
||||||
|
|
||||||
static WagonOverrides _engine_wagon_overrides[TOTAL_NUM_ENGINES];
|
static WagonOverrides _engine_wagon_overrides[TOTAL_NUM_ENGINES];
|
||||||
|
|
||||||
void SetWagonOverrideSprites(EngineID engine, SpriteGroup *group, byte *train_id,
|
void SetWagonOverrideSprites(EngineID engine, const SpriteGroup *group, byte *train_id, int trains)
|
||||||
int trains)
|
|
||||||
{
|
{
|
||||||
WagonOverrides *wos;
|
WagonOverrides *wos;
|
||||||
WagonOverride *wo;
|
WagonOverride *wo;
|
||||||
|
@ -98,10 +97,10 @@ void UnloadWagonOverrides(void)
|
||||||
// (It isn't and shouldn't be like this in the GRF files since new cargo types
|
// (It isn't and shouldn't be like this in the GRF files since new cargo types
|
||||||
// may appear in future - however it's more convenient to store it like this in
|
// may appear in future - however it's more convenient to store it like this in
|
||||||
// memory. --pasky)
|
// memory. --pasky)
|
||||||
static SpriteGroup *engine_custom_sprites[TOTAL_NUM_ENGINES][NUM_GLOBAL_CID];
|
static const SpriteGroup *engine_custom_sprites[TOTAL_NUM_ENGINES][NUM_GLOBAL_CID];
|
||||||
static uint32 _engine_grf[TOTAL_NUM_ENGINES];
|
static uint32 _engine_grf[TOTAL_NUM_ENGINES];
|
||||||
|
|
||||||
void SetCustomEngineSprites(EngineID engine, byte cargo, SpriteGroup *group)
|
void SetCustomEngineSprites(EngineID engine, byte cargo, const SpriteGroup *group)
|
||||||
{
|
{
|
||||||
assert(engine < TOTAL_NUM_ENGINES);
|
assert(engine < TOTAL_NUM_ENGINES);
|
||||||
if (engine_custom_sprites[engine][cargo] != NULL) {
|
if (engine_custom_sprites[engine][cargo] != NULL) {
|
||||||
|
|
|
@ -14,9 +14,8 @@ VARDEF const uint32 _landscape_global_cargo_mask[NUM_LANDSCAPE];
|
||||||
VARDEF const CargoID _local_cargo_id_ctype[NUM_GLOBAL_CID];
|
VARDEF const CargoID _local_cargo_id_ctype[NUM_GLOBAL_CID];
|
||||||
VARDEF const uint32 cargo_classes[16];
|
VARDEF const uint32 cargo_classes[16];
|
||||||
|
|
||||||
void SetWagonOverrideSprites(EngineID engine, struct SpriteGroup *group, byte *train_id, int trains);
|
void SetWagonOverrideSprites(EngineID engine, const struct SpriteGroup *group, byte *train_id, int trains);
|
||||||
void SetCustomEngineSprites(EngineID engine, byte cargo, struct SpriteGroup *group);
|
void SetCustomEngineSprites(EngineID engine, byte cargo, const struct SpriteGroup *group);
|
||||||
// loaded is in percents, overriding_engine 0xffff is none
|
|
||||||
SpriteID GetCustomEngineSprite(EngineID engine, const Vehicle* v, Direction direction);
|
SpriteID GetCustomEngineSprite(EngineID engine, const Vehicle* v, Direction direction);
|
||||||
|
|
||||||
void SetEngineGRF(EngineID engine, uint32 grfid);
|
void SetEngineGRF(EngineID engine, uint32 grfid);
|
||||||
|
|
Loading…
Reference in New Issue