mirror of
https://github.com/JGRennison/OpenTTD-patches.git
synced 2024-11-11 13:10:45 +00:00
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:
parent
6b5e4108a9
commit
c001ee507e
@ -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
|
||||
@ -316,7 +316,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
|
||||
|
@ -1824,7 +1824,7 @@ const char *GetNewGRFCallbackName(CallbackID cbid)
|
||||
CBID(CBID_VEHICLE_LENGTH)
|
||||
CBID(CBID_VEHICLE_LOAD_AMOUNT)
|
||||
CBID(CBID_STATION_AVAILABILITY)
|
||||
CBID(CBID_STATION_SPRITE_LAYOUT)
|
||||
CBID(CBID_STATION_DRAW_TILE_LAYOUT)
|
||||
CBID(CBID_VEHICLE_REFIT_CAPACITY)
|
||||
CBID(CBID_VEHICLE_ARTIC_ENGINE)
|
||||
CBID(CBID_HOUSE_ALLOW_CONSTRUCTION)
|
||||
@ -1840,7 +1840,7 @@ const char *GetNewGRFCallbackName(CallbackID cbid)
|
||||
CBID(CBID_HOUSE_DESTRUCTION)
|
||||
CBID(CBID_INDUSTRY_PROBABILITY)
|
||||
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_NEXT_FRAME)
|
||||
CBID(CBID_INDTILE_ANIMATION_SPEED)
|
||||
|
@ -812,8 +812,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, railtype);
|
||||
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, railtype);
|
||||
if (callback != CALLBACK_FAILED) tile = callback & ~1;
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
|
||||
/* 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 < 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);
|
||||
}
|
||||
}
|
||||
|
||||
@ -3370,8 +3370,8 @@ static void DrawTile_Station(TileInfo *ti, DrawTileProcParams params)
|
||||
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, INVALID_RAILTYPE);
|
||||
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, INVALID_RAILTYPE);
|
||||
if (callback != CALLBACK_FAILED) tile_layout = (callback & ~1) + GetRailStationAxis(ti->tile);
|
||||
}
|
||||
|
||||
|
@ -750,8 +750,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),
|
||||
|
Loading…
Reference in New Issue
Block a user