1001 if (stid > _waypoint_highest_id) |
1004 if (stid > _waypoint_highest_id) |
1002 return NULL; |
1005 return NULL; |
1003 return &_waypoint_data[stid]; |
1006 return &_waypoint_data[stid]; |
1004 } |
1007 } |
1005 |
1008 |
1006 uint32 GetCustomStationRelocation(struct StationSpec *spec, byte ctype) |
1009 uint32 GetCustomStationRelocation(struct StationSpec *spec, struct Station *stat, byte ctype) |
1007 { |
1010 { |
|
1011 struct RealSpriteGroup *rsg; |
|
1012 |
1008 assert(spec->classid == 'WAYP'); |
1013 assert(spec->classid == 'WAYP'); |
1009 |
1014 |
1010 /* In the future, variational spritegroups will kick in through this |
1015 /* In the future, variational spritegroups will kick in through this |
1011 * accessor. */ |
1016 * accessor, using @stat. */ |
1012 |
1017 rsg = TriviallyGetRSG(&spec->spritegroup[ctype]); |
1013 if (spec->relocation[ctype].loading_count != 0) { |
1018 |
1014 return spec->relocation[ctype].loading[0]; |
1019 if (rsg->sprites_per_set != 0) { |
1015 } else if (spec->relocation[ctype].loading_count != 0) { |
1020 if (rsg->loading_count != 0) { |
1016 return spec->relocation[ctype].loaded[0]; |
1021 return rsg->loading[0]; |
1017 } else { |
1022 } else if (rsg->loading_count != 0) { |
1018 error("Custom station 0x%08x::0x%02x has no sprites associated.", |
1023 return rsg->loaded[0]; |
1019 spec->grfid, spec->localidx); |
1024 } |
1020 /* This is what gets subscribed of dtss->image in grfspecial.c, |
1025 } |
1021 * so it's probably kinda "default offset". Try to use it as |
1026 |
1022 * emergency measure. */ |
1027 error("Custom station 0x%08x::0x%02x has no sprites associated.", |
1023 return 0x42D; |
1028 spec->grfid, spec->localidx); |
1024 } |
1029 /* This is what gets subscribed of dtss->image in grfspecial.c, |
|
1030 * so it's probably kinda "default offset". Try to use it as |
|
1031 * emergency measure. */ |
|
1032 return 0x42D; |
1025 } |
1033 } |
1026 |
1034 |
1027 int GetCustomStationsCount(uint32 classid) |
1035 int GetCustomStationsCount(uint32 classid) |
1028 { |
1036 { |
1029 assert(classid == 'WAYP'); |
1037 assert(classid == 'WAYP'); |