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.

(cherry picked from commit 70a2ed062d)

# Conflicts:
#	src/newgrf_station.cpp
#	src/station_cmd.cpp
This commit is contained in:
Peter Nelson 2024-04-21 14:25:37 +01:00 committed by Jonathan G Rennison
parent 6b5e4108a9
commit c001ee507e
5 changed files with 14 additions and 14 deletions

View File

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

View File

@ -1824,7 +1824,7 @@ const char *GetNewGRFCallbackName(CallbackID cbid)
CBID(CBID_VEHICLE_LENGTH) CBID(CBID_VEHICLE_LENGTH)
CBID(CBID_VEHICLE_LOAD_AMOUNT) CBID(CBID_VEHICLE_LOAD_AMOUNT)
CBID(CBID_STATION_AVAILABILITY) CBID(CBID_STATION_AVAILABILITY)
CBID(CBID_STATION_SPRITE_LAYOUT) CBID(CBID_STATION_DRAW_TILE_LAYOUT)
CBID(CBID_VEHICLE_REFIT_CAPACITY) CBID(CBID_VEHICLE_REFIT_CAPACITY)
CBID(CBID_VEHICLE_ARTIC_ENGINE) CBID(CBID_VEHICLE_ARTIC_ENGINE)
CBID(CBID_HOUSE_ALLOW_CONSTRUCTION) CBID(CBID_HOUSE_ALLOW_CONSTRUCTION)
@ -1840,7 +1840,7 @@ const char *GetNewGRFCallbackName(CallbackID cbid)
CBID(CBID_HOUSE_DESTRUCTION) CBID(CBID_HOUSE_DESTRUCTION)
CBID(CBID_INDUSTRY_PROBABILITY) CBID(CBID_INDUSTRY_PROBABILITY)
CBID(CBID_VEHICLE_ADDITIONAL_TEXT) CBID(CBID_VEHICLE_ADDITIONAL_TEXT)
CBID(CBID_STATION_TILE_LAYOUT) CBID(CBID_STATION_BUILD_TILE_LAYOUT)
CBID(CBID_INDTILE_ANIM_START_STOP) CBID(CBID_INDTILE_ANIM_START_STOP)
CBID(CBID_INDTILE_ANIM_NEXT_FRAME) CBID(CBID_INDTILE_ANIM_NEXT_FRAME)
CBID(CBID_INDTILE_ANIMATION_SPEED) CBID(CBID_INDTILE_ANIMATION_SPEED)

View File

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

View File

@ -1666,12 +1666,12 @@ CommandCost CmdBuildRailStation(TileIndex tile_org, DoCommandFlag flags, uint32_
uint32_t platinfo = GetPlatformInfo(AXIS_X, GetStationGfx(tile), plat_len, numtracks_orig, plat_len - w, numtracks_orig - numtracks, false); 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. */ /* 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, rt); uint16_t callback = GetStationCallback(CBID_STATION_BUILD_TILE_LAYOUT, platinfo, 0, statspec, nullptr, tile, rt);
if (callback != CALLBACK_FAILED) { if (callback != CALLBACK_FAILED) {
if (callback < 8) { if (callback < 8) {
SetStationGfx(tile, (callback & ~1) + axis); SetStationGfx(tile, (callback & ~1) + axis);
} else { } else {
ErrorUnknownCallbackResult(statspec->grf_prop.grffile->grfid, CBID_STATION_TILE_LAYOUT, callback); ErrorUnknownCallbackResult(statspec->grf_prop.grffile->grfid, CBID_STATION_BUILD_TILE_LAYOUT, callback);
} }
} }
@ -3370,8 +3370,8 @@ static void DrawTile_Station(TileInfo *ti, DrawTileProcParams params)
if (statspec != nullptr) { if (statspec != nullptr) {
tile_layout = GetStationGfx(ti->tile); tile_layout = GetStationGfx(ti->tile);
if (HasBit(statspec->callback_mask, CBM_STATION_SPRITE_LAYOUT)) { if (HasBit(statspec->callback_mask, CBM_STATION_DRAW_TILE_LAYOUT)) {
uint16_t callback = GetStationCallback(CBID_STATION_SPRITE_LAYOUT, 0, 0, statspec, st, ti->tile, INVALID_RAILTYPE); uint16_t callback = GetStationCallback(CBID_STATION_DRAW_TILE_LAYOUT, 0, 0, statspec, st, ti->tile, INVALID_RAILTYPE);
if (callback != CALLBACK_FAILED) tile_layout = (callback & ~1) + GetRailStationAxis(ti->tile); if (callback != CALLBACK_FAILED) tile_layout = (callback & ~1) + GetRailStationAxis(ti->tile);
} }

View File

@ -750,8 +750,8 @@ static const NIFeature _nif_vehicle = {
#define NICS(cb_id, bit) NIC(cb_id, StationSpec, callback_mask, bit) #define NICS(cb_id, bit) NIC(cb_id, StationSpec, callback_mask, bit)
static const NICallback _nic_stations[] = { static const NICallback _nic_stations[] = {
NICS(CBID_STATION_AVAILABILITY, CBM_STATION_AVAIL), NICS(CBID_STATION_AVAILABILITY, CBM_STATION_AVAIL),
NICS(CBID_STATION_SPRITE_LAYOUT, CBM_STATION_SPRITE_LAYOUT), NICS(CBID_STATION_DRAW_TILE_LAYOUT, CBM_STATION_DRAW_TILE_LAYOUT),
NICS(CBID_STATION_TILE_LAYOUT, CBM_NO_BIT), NICS(CBID_STATION_BUILD_TILE_LAYOUT,CBM_NO_BIT),
NICS(CBID_STATION_ANIM_START_STOP, 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_ANIM_NEXT_FRAME, CBM_STATION_ANIMATION_NEXT_FRAME),
NICS(CBID_STATION_ANIMATION_SPEED, CBM_STATION_ANIMATION_SPEED), NICS(CBID_STATION_ANIMATION_SPEED, CBM_STATION_ANIMATION_SPEED),