1
0
Fork 0

(svn r20436) -Codechange: use GRFFilePropsBase's spritegroup for stations.

release/1.1
rubidium 2010-08-10 15:51:33 +00:00
parent ca7a067b7a
commit 3d21fb44aa
3 changed files with 12 additions and 13 deletions

View File

@ -3870,7 +3870,7 @@ static void StationMapSpriteGroup(ByteReader *buf, uint8 idcount)
continue; continue;
} }
statspec->spritegroup[ctype] = _cur_grffile->spritegroups[groupid]; statspec->grf_prop.spritegroup[ctype] = _cur_grffile->spritegroups[groupid];
} }
} }
@ -3890,7 +3890,7 @@ static void StationMapSpriteGroup(ByteReader *buf, uint8 idcount)
continue; continue;
} }
statspec->spritegroup[CT_DEFAULT] = _cur_grffile->spritegroups[groupid]; statspec->grf_prop.spritegroup[CT_DEFAULT] = _cur_grffile->spritegroups[groupid];
statspec->grf_prop.grffile = _cur_grffile; statspec->grf_prop.grffile = _cur_grffile;
statspec->grf_prop.local_id = stations[i]; statspec->grf_prop.local_id = stations[i];
StationClass::Assign(statspec); StationClass::Assign(statspec);

View File

@ -550,7 +550,7 @@ static const SpriteGroup *ResolveStation(ResolverObject *object)
/* Pick the first cargo that we have waiting */ /* Pick the first cargo that we have waiting */
const CargoSpec *cs; const CargoSpec *cs;
FOR_ALL_CARGOSPECS(cs) { FOR_ALL_CARGOSPECS(cs) {
if (object->u.station.statspec->spritegroup[cs->Index()] != NULL && if (object->u.station.statspec->grf_prop.spritegroup[cs->Index()] != NULL &&
!st->goods[cs->Index()].cargo.Empty()) { !st->goods[cs->Index()].cargo.Empty()) {
ctype = cs->Index(); ctype = cs->Index();
break; break;
@ -558,10 +558,10 @@ static const SpriteGroup *ResolveStation(ResolverObject *object)
} }
} }
group = object->u.station.statspec->spritegroup[ctype]; group = object->u.station.statspec->grf_prop.spritegroup[ctype];
if (group == NULL) { if (group == NULL) {
ctype = CT_DEFAULT; ctype = CT_DEFAULT;
group = object->u.station.statspec->spritegroup[ctype]; group = object->u.station.statspec->grf_prop.spritegroup[ctype];
} }
if (group == NULL) return NULL; if (group == NULL) return NULL;

View File

@ -47,7 +47,13 @@ typedef byte *StationLayout;
/** Station specification. */ /** Station specification. */
struct StationSpec { struct StationSpec {
GRFFilePropsBase<0> grf_prop; ///< Properties related the the grf file /**
* Properties related the the grf file.
* NUM_CARGO real cargo plus three pseudo cargo sprite groups.
* Used for obtaining the sprite offset of custom sprites, and for
* evaluating callbacks.
*/
GRFFilePropsBase<NUM_CARGO + 3> grf_prop;
StationClassID cls_id; ///< The class to which this spec belongs. StationClassID cls_id; ///< The class to which this spec belongs.
StringID name; ///< Name of this station. StringID name; ///< Name of this station.
@ -99,13 +105,6 @@ struct StationSpec {
uint8 anim_status; uint8 anim_status;
uint8 anim_speed; uint8 anim_speed;
uint16 anim_triggers; uint16 anim_triggers;
/**
* NUM_CARGO real cargo plus three pseudo cargo sprite groups.
* Used for obtaining the sprite offset of custom sprites, and for
* evaluating callbacks.
*/
const struct SpriteGroup *spritegroup[NUM_CARGO + 3];
}; };
/** Struct containing information relating to station classes. */ /** Struct containing information relating to station classes. */