mirror of https://github.com/OpenTTD/OpenTTD.git
(svn r4738) - Newstations: attach all sprite group cargo types, not just the default and purchase pseudo types, to a station spec.
This commit is contained in:
parent
0a16393ffe
commit
a55ac6efac
3
engine.h
3
engine.h
|
@ -156,8 +156,9 @@ enum GlobalCargo {
|
||||||
GC_UNDEFINED = 28, // undefined; unused slot in arctic climate
|
GC_UNDEFINED = 28, // undefined; unused slot in arctic climate
|
||||||
GC_DEFAULT = 29,
|
GC_DEFAULT = 29,
|
||||||
GC_PURCHASE = 30,
|
GC_PURCHASE = 30,
|
||||||
|
GC_DEFAULT_NA = 31, // New stations only
|
||||||
GC_INVALID = 255,
|
GC_INVALID = 255,
|
||||||
NUM_GLOBAL_CID = 31
|
NUM_GLOBAL_CID = 32
|
||||||
};
|
};
|
||||||
|
|
||||||
VARDEF const uint32 _default_refitmasks[NUM_VEHICLE_TYPES];
|
VARDEF const uint32 _default_refitmasks[NUM_VEHICLE_TYPES];
|
||||||
|
|
10
newgrf.c
10
newgrf.c
|
@ -1582,12 +1582,10 @@ static void NewVehicle_SpriteGroupMapping(byte *buf, int len)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ctype != 0xFF) {
|
if (ctype == 0xFE) ctype = GC_DEFAULT_NA;
|
||||||
/* TODO: No support for any other cargo. */
|
if (ctype == 0xFF) ctype = GC_PURCHASE;
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
statspec->spritegroup[1] = _cur_grffile->spritegroups[groupid];
|
statspec->spritegroup[ctype] = _cur_grffile->spritegroups[groupid];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1605,7 +1603,7 @@ static void NewVehicle_SpriteGroupMapping(byte *buf, int len)
|
||||||
uint8 stid = buf[3 + i];
|
uint8 stid = buf[3 + i];
|
||||||
StationSpec *statspec = &_cur_grffile->stations[stid];
|
StationSpec *statspec = &_cur_grffile->stations[stid];
|
||||||
|
|
||||||
statspec->spritegroup[0] = _cur_grffile->spritegroups[groupid];
|
statspec->spritegroup[GC_DEFAULT] = _cur_grffile->spritegroups[groupid];
|
||||||
statspec->grfid = _cur_grffile->grfid;
|
statspec->grfid = _cur_grffile->grfid;
|
||||||
statspec->localidx = stid;
|
statspec->localidx = stid;
|
||||||
SetCustomStationSpec(statspec);
|
SetCustomStationSpec(statspec);
|
||||||
|
|
|
@ -327,10 +327,14 @@ SpriteID GetCustomStationRelocation(const StationSpec *statspec, const Station *
|
||||||
{
|
{
|
||||||
const SpriteGroup *group;
|
const SpriteGroup *group;
|
||||||
ResolverObject object;
|
ResolverObject object;
|
||||||
|
ctype = (st == NULL) ? GC_PURCHASE : GC_DEFAULT_NA;
|
||||||
|
|
||||||
NewStationResolver(&object, statspec, st, tile);
|
NewStationResolver(&object, statspec, st, tile);
|
||||||
|
|
||||||
group = Resolve(statspec->spritegroup[ctype], &object);
|
group = Resolve(statspec->spritegroup[ctype], &object);
|
||||||
|
if ((group == NULL || group->type != SGT_RESULT) && ctype != GC_DEFAULT_NA) {
|
||||||
|
group = Resolve(statspec->spritegroup[GC_DEFAULT_NA], &object);
|
||||||
|
}
|
||||||
if ((group == NULL || group->type != SGT_RESULT) && ctype != GC_DEFAULT) {
|
if ((group == NULL || group->type != SGT_RESULT) && ctype != GC_DEFAULT) {
|
||||||
group = Resolve(statspec->spritegroup[GC_DEFAULT], &object);
|
group = Resolve(statspec->spritegroup[GC_DEFAULT], &object);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue