mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-03-06 22:28:56 +00:00
(svn r591) -newgrf: Store whole struct StationSpec in SetCustomStation(), not just the rendering data. This will be needed for variational stationspecs (pasky).
This commit is contained in:
parent
5663926aaf
commit
ccc496ba2c
11
grfspecial.c
11
grfspecial.c
@ -21,12 +21,6 @@ extern int _skip_sprites;
|
|||||||
extern int _replace_sprites_count[16];
|
extern int _replace_sprites_count[16];
|
||||||
extern int _replace_sprites_offset[16];
|
extern int _replace_sprites_offset[16];
|
||||||
|
|
||||||
struct StationSpec {
|
|
||||||
uint32 classid;
|
|
||||||
byte tiles;
|
|
||||||
DrawTileSprites renderdata[8];
|
|
||||||
};
|
|
||||||
|
|
||||||
struct GRFFile {
|
struct GRFFile {
|
||||||
char *filename;
|
char *filename;
|
||||||
uint32 grfid;
|
uint32 grfid;
|
||||||
@ -1225,10 +1219,7 @@ static void NewVehicle_SpriteGroupMapping(byte *buf, int len)
|
|||||||
seq->image += _cur_grffile->spritegroups[groupid].loading[0];
|
seq->image += _cur_grffile->spritegroups[groupid].loading[0];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* FIXME: This means several GRF files defining new stations
|
SetCustomStation(stid, stat);
|
||||||
* will override each other, but the stid should be GRF-specific
|
|
||||||
* instead! --pasky */
|
|
||||||
SetCustomStation(stat->classid, stid, stat->renderdata, stat->tiles);
|
|
||||||
stat->classid = 0;
|
stat->classid = 0;
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
|
@ -1544,7 +1544,7 @@ static void DrawTile_Track(TileInfo *ti)
|
|||||||
|
|
||||||
if (!IS_RAIL_DEPOT(m5) && IS_RAIL_WAYPOINT(m5) && _map3_lo[ti->tile]&16) {
|
if (!IS_RAIL_DEPOT(m5) && IS_RAIL_WAYPOINT(m5) && _map3_lo[ti->tile]&16) {
|
||||||
// look for customization
|
// look for customization
|
||||||
DrawTileSprites *cust = GetCustomStation('WAYP', _map3_hi[ti->tile]);
|
DrawTileSprites *cust = GetCustomStationRenderdata('WAYP', _map3_hi[ti->tile]);
|
||||||
|
|
||||||
if (cust) {
|
if (cust) {
|
||||||
DrawTileSeqStruct const *seq;
|
DrawTileSeqStruct const *seq;
|
||||||
@ -1623,7 +1623,7 @@ void DrawTrainDepotSprite(int x, int y, int image, int railtype)
|
|||||||
void DrawWaypointSprite(int x, int y, int stat_id)
|
void DrawWaypointSprite(int x, int y, int stat_id)
|
||||||
{
|
{
|
||||||
// TODO: We should use supersets with cargo-id FF, if available. --pasky
|
// TODO: We should use supersets with cargo-id FF, if available. --pasky
|
||||||
DrawTileSprites *cust = GetCustomStation('WAYP', stat_id);
|
DrawTileSprites *cust = GetCustomStationRenderdata('WAYP', stat_id);
|
||||||
DrawTileSeqStruct const *seq;
|
DrawTileSeqStruct const *seq;
|
||||||
uint32 ormod, img;
|
uint32 ormod, img;
|
||||||
|
|
||||||
|
12
station.h
12
station.h
@ -108,8 +108,16 @@ typedef struct DrawTileSprites {
|
|||||||
|
|
||||||
#define foreach_draw_tile_seq(idx, list) for (idx = list; ((byte) idx->delta_x) != 0x80; idx++)
|
#define foreach_draw_tile_seq(idx, list) for (idx = list; ((byte) idx->delta_x) != 0x80; idx++)
|
||||||
|
|
||||||
void SetCustomStation(uint32 classid, byte stid, DrawTileSprites *data, byte tiles);
|
|
||||||
DrawTileSprites *GetCustomStation(uint32 classid, byte stid);
|
struct StationSpec {
|
||||||
|
int globalidx;
|
||||||
|
uint32 classid;
|
||||||
|
byte tiles;
|
||||||
|
DrawTileSprites renderdata[8];
|
||||||
|
};
|
||||||
|
|
||||||
|
void SetCustomStation(byte stid, struct StationSpec *spec);
|
||||||
|
DrawTileSprites *GetCustomStationRenderdata(uint32 classid, byte stid);
|
||||||
int GetCustomStationsCount(uint32 classid);
|
int GetCustomStationsCount(uint32 classid);
|
||||||
|
|
||||||
#endif /* STATION_H */
|
#endif /* STATION_H */
|
||||||
|
@ -964,22 +964,22 @@ uint GetStationPlatforms(Station *st, uint tile)
|
|||||||
* file used non-contignuous station ids. --pasky */
|
* file used non-contignuous station ids. --pasky */
|
||||||
|
|
||||||
static int _waypoint_highest_id = -1;
|
static int _waypoint_highest_id = -1;
|
||||||
static DrawTileSprites _waypoint_data[256][8];
|
static struct StationSpec _waypoint_data[256];
|
||||||
|
|
||||||
void SetCustomStation(uint32 classid, byte stid, DrawTileSprites *data, byte tiles)
|
void SetCustomStation(byte stid, struct StationSpec *spec)
|
||||||
|
{
|
||||||
|
assert(spec->classid == 'WAYP');
|
||||||
|
if (stid > _waypoint_highest_id)
|
||||||
|
_waypoint_highest_id = stid;
|
||||||
|
memcpy(&_waypoint_data[stid], spec, sizeof(*spec));
|
||||||
|
}
|
||||||
|
|
||||||
|
DrawTileSprites *GetCustomStationRenderdata(uint32 classid, byte stid)
|
||||||
{
|
{
|
||||||
assert(classid == 'WAYP');
|
assert(classid == 'WAYP');
|
||||||
if (stid > _waypoint_highest_id)
|
if (stid > _waypoint_highest_id)
|
||||||
_waypoint_highest_id = stid;
|
|
||||||
memcpy(_waypoint_data[stid], data, sizeof(DrawTileSprites) * tiles);
|
|
||||||
}
|
|
||||||
|
|
||||||
DrawTileSprites *GetCustomStation(uint32 classid, byte stid)
|
|
||||||
{
|
|
||||||
assert(classid == 'WAYP');
|
|
||||||
if (stid > _waypoint_highest_id || !_waypoint_data || !_waypoint_data[stid])
|
|
||||||
return NULL;
|
return NULL;
|
||||||
return _waypoint_data[stid];
|
return _waypoint_data[stid].renderdata;
|
||||||
}
|
}
|
||||||
|
|
||||||
int GetCustomStationsCount(uint32 classid)
|
int GetCustomStationsCount(uint32 classid)
|
||||||
|
Loading…
Reference in New Issue
Block a user