Codechange: Rename CBID_STATION_SPRITE_LAYOUT and CBID_STATION_TILE_LAYOUT.

These callbacks both select rail station tile layouts, the difference is one happens when drawing, the other happens when building. Change the names to make this clearer.
This commit is contained in:
Peter Nelson 2024-04-21 14:25:37 +01:00
parent c073165e34
commit 6e98c5c26a
No known key found for this signature in database
GPG Key ID: 8EF8F0A467DF75ED
4 changed files with 12 additions and 12 deletions

View File

@ -38,8 +38,8 @@ enum CallbackID {
/** Determine whether a newstation should be made available to build. */
CBID_STATION_AVAILABILITY = 0x13, // 8 bit callback
/** Choose a sprite layout to draw, instead of the standard 0-7 range. */
CBID_STATION_SPRITE_LAYOUT = 0x14,
/** Choose a tile layout to draw, instead of the standard 0-7 range. */
CBID_STATION_DRAW_TILE_LAYOUT = 0x14,
/**
* Refit capacity, the passed vehicle needs to have its ->cargo_type set to
@ -93,7 +93,7 @@ enum CallbackID {
CBID_VEHICLE_ADDITIONAL_TEXT = 0x23,
/** Called when building a station to customize the tile layout */
CBID_STATION_TILE_LAYOUT = 0x24, // 15 bit callback
CBID_STATION_BUILD_TILE_LAYOUT = 0x24, // 15 bit callback
/** Called for periodically starting or stopping the animation. */
CBID_INDTILE_ANIM_START_STOP = 0x25, // 15 bit callback
@ -308,7 +308,7 @@ enum VehicleCallbackMask {
*/
enum StationCallbackMask {
CBM_STATION_AVAIL = 0, ///< Availability of station in construction window
CBM_STATION_SPRITE_LAYOUT = 1, ///< Use callback to select a sprite layout to use
CBM_STATION_DRAW_TILE_LAYOUT = 1, ///< Use callback to select a tile layout to use when drawing.
CBM_STATION_ANIMATION_NEXT_FRAME = 2, ///< Use a custom next frame callback
CBM_STATION_ANIMATION_SPEED = 3, ///< Customize the animation speed of the station
CBM_STATION_SLOPE_CHECK = 4, ///< Check slope of new station tiles

View File

@ -782,8 +782,8 @@ bool DrawStationTile(int x, int y, RailType railtype, Axis axis, StationClassID
const StationSpec *statspec = StationClass::Get(sclass)->GetSpec(station);
if (statspec == nullptr) return false;
if (HasBit(statspec->callback_mask, CBM_STATION_SPRITE_LAYOUT)) {
uint16_t callback = GetStationCallback(CBID_STATION_SPRITE_LAYOUT, 0, 0, statspec, nullptr, INVALID_TILE);
if (HasBit(statspec->callback_mask, CBM_STATION_DRAW_TILE_LAYOUT)) {
uint16_t callback = GetStationCallback(CBID_STATION_DRAW_TILE_LAYOUT, 0, 0, statspec, nullptr, INVALID_TILE);
if (callback != CALLBACK_FAILED) tile = callback & ~1;
}

View File

@ -1461,12 +1461,12 @@ CommandCost CmdBuildRailStation(DoCommandFlag flags, TileIndex tile_org, RailTyp
uint32_t platinfo = GetPlatformInfo(AXIS_X, GetStationGfx(tile), plat_len, numtracks_orig, plat_len - w, numtracks_orig - numtracks, false);
/* As the station is not yet completely finished, the station does not yet exist. */
uint16_t callback = GetStationCallback(CBID_STATION_TILE_LAYOUT, platinfo, 0, statspec, nullptr, tile);
uint16_t callback = GetStationCallback(CBID_STATION_BUILD_TILE_LAYOUT, platinfo, 0, statspec, nullptr, tile);
if (callback != CALLBACK_FAILED) {
if (callback < 8) {
SetStationGfx(tile, (callback & ~1) + axis);
} else {
ErrorUnknownCallbackResult(statspec->grf_prop.grffile->grfid, CBID_STATION_TILE_LAYOUT, callback);
ErrorUnknownCallbackResult(statspec->grf_prop.grffile->grfid, CBID_STATION_BUILD_TILE_LAYOUT, callback);
}
}
@ -2978,8 +2978,8 @@ static void DrawTile_Station(TileInfo *ti)
if (statspec != nullptr) {
tile_layout = GetStationGfx(ti->tile);
if (HasBit(statspec->callback_mask, CBM_STATION_SPRITE_LAYOUT)) {
uint16_t callback = GetStationCallback(CBID_STATION_SPRITE_LAYOUT, 0, 0, statspec, st, ti->tile);
if (HasBit(statspec->callback_mask, CBM_STATION_DRAW_TILE_LAYOUT)) {
uint16_t callback = GetStationCallback(CBID_STATION_DRAW_TILE_LAYOUT, 0, 0, statspec, st, ti->tile);
if (callback != CALLBACK_FAILED) tile_layout = (callback & ~1) + GetRailStationAxis(ti->tile);
}

View File

@ -99,8 +99,8 @@ static const NIFeature _nif_vehicle = {
#define NICS(cb_id, bit) NIC(cb_id, StationSpec, callback_mask, bit)
static const NICallback _nic_stations[] = {
NICS(CBID_STATION_AVAILABILITY, CBM_STATION_AVAIL),
NICS(CBID_STATION_SPRITE_LAYOUT, CBM_STATION_SPRITE_LAYOUT),
NICS(CBID_STATION_TILE_LAYOUT, CBM_NO_BIT),
NICS(CBID_STATION_DRAW_TILE_LAYOUT, CBM_STATION_DRAW_TILE_LAYOUT),
NICS(CBID_STATION_BUILD_TILE_LAYOUT,CBM_NO_BIT),
NICS(CBID_STATION_ANIM_START_STOP, CBM_NO_BIT),
NICS(CBID_STATION_ANIM_NEXT_FRAME, CBM_STATION_ANIMATION_NEXT_FRAME),
NICS(CBID_STATION_ANIMATION_SPEED, CBM_STATION_ANIMATION_SPEED),