equal
deleted
inserted
replaced
97 // 0 - 28 are cargos, 29 is default, 30 is the advert (purchase list) |
97 // 0 - 28 are cargos, 29 is default, 30 is the advert (purchase list) |
98 // (It isn't and shouldn't be like this in the GRF files since new cargo types |
98 // (It isn't and shouldn't be like this in the GRF files since new cargo types |
99 // may appear in future - however it's more convenient to store it like this in |
99 // may appear in future - however it's more convenient to store it like this in |
100 // memory. --pasky) |
100 // memory. --pasky) |
101 static SpriteGroup *engine_custom_sprites[TOTAL_NUM_ENGINES][NUM_GLOBAL_CID]; |
101 static SpriteGroup *engine_custom_sprites[TOTAL_NUM_ENGINES][NUM_GLOBAL_CID]; |
|
102 static uint32 _engine_grf[TOTAL_NUM_ENGINES]; |
102 |
103 |
103 void SetCustomEngineSprites(EngineID engine, byte cargo, SpriteGroup *group) |
104 void SetCustomEngineSprites(EngineID engine, byte cargo, SpriteGroup *group) |
104 { |
105 { |
105 assert(engine < TOTAL_NUM_ENGINES); |
106 assert(engine < TOTAL_NUM_ENGINES); |
106 if (engine_custom_sprites[engine][cargo] != NULL) { |
107 if (engine_custom_sprites[engine][cargo] != NULL) { |
119 |
120 |
120 for (engine = 0; engine < TOTAL_NUM_ENGINES; engine++) { |
121 for (engine = 0; engine < TOTAL_NUM_ENGINES; engine++) { |
121 for (cargo = 0; cargo < NUM_GLOBAL_CID; cargo++) { |
122 for (cargo = 0; cargo < NUM_GLOBAL_CID; cargo++) { |
122 engine_custom_sprites[engine][cargo] = NULL; |
123 engine_custom_sprites[engine][cargo] = NULL; |
123 } |
124 } |
124 } |
125 _engine_grf[engine] = 0; |
125 } |
126 } |
|
127 } |
|
128 |
|
129 void SetEngineGRF(EngineID engine, uint32 grfid) |
|
130 { |
|
131 assert(engine < TOTAL_NUM_ENGINES); |
|
132 _engine_grf[engine] = grfid; |
|
133 } |
|
134 |
|
135 uint32 GetEngineGRFID(EngineID engine) |
|
136 { |
|
137 assert(engine < TOTAL_NUM_ENGINES); |
|
138 return _engine_grf[engine]; |
|
139 } |
|
140 |
126 |
141 |
127 static int MapOldSubType(const Vehicle *v) |
142 static int MapOldSubType(const Vehicle *v) |
128 { |
143 { |
129 if (v->type != VEH_Train) return v->subtype; |
144 if (v->type != VEH_Train) return v->subtype; |
130 if (IsTrainEngine(v)) return 0; |
145 if (IsTrainEngine(v)) return 0; |