1
0
Fork 0

Compare commits

...

3 Commits

Author SHA1 Message Date
Kuhnovic 953cc0afee
Merge b8d966029c into 009b7cbc57 2025-07-27 15:05:56 +00:00
Peter Nelson 009b7cbc57
Fix #14480: Music player playlist buttons are clickable but non-operational in intro menu. (#14482)
In the intro menu the music is hardcoded to be the introduction track. Therefore, prevent these buttons being clickable.
2025-07-27 16:03:47 +01:00
Koen Bussemaker b8d966029c Change: Allow building rail over bridges / tunnels and through stations / waypoints. 2025-05-25 14:52:31 +02:00
2 changed files with 32 additions and 14 deletions

View File

@ -683,13 +683,16 @@ struct MusicWindow : public Window {
void UpdateDisabledButtons() void UpdateDisabledButtons()
{ {
/* Disable music control widgets if there is no music /* Disable stop and play if there is no music. */
* -- except Programme button! So you can still select a music set. */ this->SetWidgetsDisabledState(BaseMusic::GetUsedSet()->num_available == 0, WID_M_STOP, WID_M_PLAY);
/* Disable most music control widgets if there is no music, or we are in the intro menu. */
this->SetWidgetsDisabledState( this->SetWidgetsDisabledState(
BaseMusic::GetUsedSet()->num_available == 0, BaseMusic::GetUsedSet()->num_available == 0 || _game_mode == GM_MENU,
WID_M_PREV, WID_M_NEXT, WID_M_STOP, WID_M_PLAY, WID_M_SHUFFLE, WID_M_PREV, WID_M_NEXT, WID_M_SHUFFLE,
WID_M_ALL, WID_M_OLD, WID_M_NEW, WID_M_EZY, WID_M_CUSTOM1, WID_M_CUSTOM2 WID_M_ALL, WID_M_OLD, WID_M_NEW, WID_M_EZY, WID_M_CUSTOM1, WID_M_CUSTOM2
); );
/* Also disable programme button in the intro menu (not in game; it is desirable to allow change of music set.) */
this->SetWidgetsDisabledState(_game_mode == GM_MENU, WID_M_PROGRAMME);
} }
void UpdateWidgetSize(WidgetID widget, Dimension &size, [[maybe_unused]] const Dimension &padding, [[maybe_unused]] Dimension &fill, [[maybe_unused]] Dimension &resize) override void UpdateWidgetSize(WidgetID widget, Dimension &size, [[maybe_unused]] const Dimension &padding, [[maybe_unused]] Dimension &fill, [[maybe_unused]] Dimension &resize) override

View File

@ -884,11 +884,33 @@ static CommandCost CmdRailTrackHelper(DoCommandFlags flags, TileIndex tile, Tile
CommandCost ret = ValidateAutoDrag(&trackdir, tile, end_tile); CommandCost ret = ValidateAutoDrag(&trackdir, tile, end_tile);
if (ret.Failed()) return ret; if (ret.Failed()) return ret;
int distance_remaining = static_cast<int>(DistanceManhattan(tile, end_tile)) + 1;
auto advance = [&] {
distance_remaining--;
tile = TileAddByDiagDir(tile, TrackdirToExitdir(trackdir));
trackdir = NextTrackdir(trackdir);
};
bool had_success = false; bool had_success = false;
CommandCost last_error = CMD_ERROR; CommandCost last_error = CMD_ERROR;
for (;;) { for (; distance_remaining > 0; advance()) {
ret = remove ? Command<CMD_REMOVE_SINGLE_RAIL>::Do(flags, tile, TrackdirToTrack(trackdir)) : Command<CMD_BUILD_SINGLE_RAIL>::Do(flags, tile, railtype, TrackdirToTrack(trackdir), auto_remove_signals); if (!remove && !fail_on_obstacle && CheckTileOwnership(tile).Succeeded() && IsCompatibleRail(GetRailType(tile), railtype)) {
if (!remove && !fail_on_obstacle && last_error.GetErrorMessage() == STR_ERROR_ALREADY_BUILT) had_success = true; /* Skip stations and waypoints */
if (HasStationTileRail(tile) && GetRailStationTrack(tile) == track) continue;
/* Skip bridges and tunnels */
if (IsTileType(tile, MP_TUNNELBRIDGE) && GetTunnelBridgeTransportType(tile) == TRANSPORT_RAIL
&& DiagDirToDiagTrackdir(GetTunnelBridgeDirection(tile)) == trackdir ) {
const uint length = GetTunnelBridgeLength(tile, GetOtherTunnelBridgeEnd(tile));
for (uint i = 0; i <= length; ++i) advance();
continue;
}
}
ret = remove ? Command<CMD_REMOVE_SINGLE_RAIL>::Do(flags, tile, TrackdirToTrack(trackdir))
: Command<CMD_BUILD_SINGLE_RAIL>::Do(flags, tile, railtype, TrackdirToTrack(trackdir), auto_remove_signals);
if (!remove && !fail_on_obstacle && ret.GetErrorMessage() == STR_ERROR_ALREADY_BUILT) had_success = true;
if (ret.Failed()) { if (ret.Failed()) {
last_error = std::move(ret); last_error = std::move(ret);
@ -903,13 +925,6 @@ static CommandCost CmdRailTrackHelper(DoCommandFlags flags, TileIndex tile, Tile
had_success = true; had_success = true;
total_cost.AddCost(ret.GetCost()); total_cost.AddCost(ret.GetCost());
} }
if (tile == end_tile) break;
tile += ToTileIndexDiff(_trackdelta[trackdir]);
/* toggle railbit for the non-diagonal tracks */
if (!IsDiagonalTrackdir(trackdir)) ToggleBit(trackdir, 0);
} }
if (had_success) return total_cost; if (had_success) return total_cost;