diff --git a/src/airport_gui.cpp b/src/airport_gui.cpp index 408dbc50c2..4ad4789ff6 100644 --- a/src/airport_gui.cpp +++ b/src/airport_gui.cpp @@ -44,7 +44,7 @@ void CcBuildAirport(const CommandCost &result, TileIndex tile, uint32 p1, uint32 { if (result.Failed()) return; - if (_settings_client.sound.confirm) SndPlayTileFx(SND_1F_SPLAT, tile); + if (_settings_client.sound.confirm) SndPlayTileFx(SND_1F_SPLAT_OTHER, tile); if (!_settings_client.gui.persistent_buildingtools) ResetObjectToPlace(); } diff --git a/src/company_gui.cpp b/src/company_gui.cpp index 1cf38fc521..bbbf0950b5 100644 --- a/src/company_gui.cpp +++ b/src/company_gui.cpp @@ -2013,7 +2013,7 @@ struct CompanyWindow : Window NWidgetStacked *wi = this->GetWidget(WID_C_SELECT_BUTTONS); if (plane != wi->shown_plane) { wi->SetDisplayedPlane(plane); - this->SetDirty(); + this->InvalidateData(); return; } diff --git a/src/dock_gui.cpp b/src/dock_gui.cpp index 03c661dd0b..059aef6b5f 100644 --- a/src/dock_gui.cpp +++ b/src/dock_gui.cpp @@ -41,13 +41,13 @@ void CcBuildDocks(const CommandCost &result, TileIndex tile, uint32 p1, uint32 p { if (result.Failed()) return; - if (_settings_client.sound.confirm) SndPlayTileFx(SND_02_SPLAT, tile); + if (_settings_client.sound.confirm) SndPlayTileFx(SND_02_SPLAT_WATER, tile); if (!_settings_client.gui.persistent_buildingtools) ResetObjectToPlace(); } void CcBuildCanal(const CommandCost &result, TileIndex tile, uint32 p1, uint32 p2) { - if (result.Succeeded() && _settings_client.sound.confirm) SndPlayTileFx(SND_02_SPLAT, tile); + if (result.Succeeded() && _settings_client.sound.confirm) SndPlayTileFx(SND_02_SPLAT_WATER, tile); } diff --git a/src/fios.cpp b/src/fios.cpp index b2ed1ec50e..ff7153af3f 100644 --- a/src/fios.cpp +++ b/src/fios.cpp @@ -400,6 +400,10 @@ FiosType FiosGetSavegameListCallback(SaveLoadDialogMode mode, const char *file, * .SS1 Transport Tycoon Deluxe preset game * .SV1 Transport Tycoon Deluxe (Patch) saved game * .SV2 Transport Tycoon Deluxe (Patch) saved 2-player game */ + + /* Don't crash if we supply no extension */ + if (ext == NULL) return FIOS_TYPE_INVALID; + if (strcasecmp(ext, ".sav") == 0) { GetFileTitle(file, title, last, SAVE_DIR); return FIOS_TYPE_FILE; diff --git a/src/goal_gui.cpp b/src/goal_gui.cpp index caa04e544c..b2e591ffdd 100644 --- a/src/goal_gui.cpp +++ b/src/goal_gui.cpp @@ -273,6 +273,8 @@ struct GoalListWindow : public Window { { this->DrawWidgets(); + if (this->IsShaded()) return; // Don't draw anything when the window is shaded. + /* Calculate progress column width. */ uint max_width = 0; Goal *s; diff --git a/src/linkgraph/demands.cpp b/src/linkgraph/demands.cpp index 87426326a3..80a0f56772 100644 --- a/src/linkgraph/demands.cpp +++ b/src/linkgraph/demands.cpp @@ -271,7 +271,7 @@ void DemandCalculator::CalcDemand(LinkGraphJob &job, Tscaler scaler) * @param job Job to calculate the demands for. */ DemandCalculator::DemandCalculator(LinkGraphJob &job) : - max_distance(MapSizeX() + MapSizeY() - 2) + max_distance(DistanceMaxPlusManhattan(TileXY(0,0), TileXY(MapMaxX(), MapMaxY()))) { const LinkGraphSettings &settings = job.Settings(); CargoID cargo = job.Cargo(); diff --git a/src/linkgraph/linkgraph.cpp b/src/linkgraph/linkgraph.cpp index e8c792c37d..d41c3494d1 100644 --- a/src/linkgraph/linkgraph.cpp +++ b/src/linkgraph/linkgraph.cpp @@ -155,7 +155,7 @@ void LinkGraph::UpdateDistances(NodeID id, TileIndex xy) for (NodeID other = 0; other < this->Size(); ++other) { if (other == id) continue; this->edges[id][other].distance = this->edges[other][id].distance = - DistanceManhattan(xy, Station::Get(this->nodes[other].station)->xy); + DistanceMaxPlusManhattan(xy, Station::Get(this->nodes[other].station)->xy); } } @@ -187,7 +187,7 @@ NodeID LinkGraph::AddNode(const Station *st) new_edges[new_node].next_edge = INVALID_NODE; for (NodeID i = 0; i <= new_node; ++i) { - uint distance = DistanceManhattan(st->xy, Station::Get(this->nodes[i].station)->xy); + uint distance = DistanceMaxPlusManhattan(st->xy, Station::Get(this->nodes[i].station)->xy); new_edges[i].Init(distance); this->edges[i][new_node].Init(distance); } diff --git a/src/rail_gui.cpp b/src/rail_gui.cpp index 1808164c50..6fb08e7ca7 100644 --- a/src/rail_gui.cpp +++ b/src/rail_gui.cpp @@ -86,7 +86,7 @@ static bool IsStationAvailable(const StationSpec *statspec) void CcPlaySound1E(const CommandCost &result, TileIndex tile, uint32 p1, uint32 p2) { - if (result.Succeeded() && _settings_client.sound.confirm) SndPlayTileFx(SND_20_SPLAT_2, tile); + if (result.Succeeded() && _settings_client.sound.confirm) SndPlayTileFx(SND_20_SPLAT_RAIL, tile); } static void GenericPlaceRail(TileIndex tile, int cmd) @@ -133,7 +133,7 @@ void CcRailDepot(const CommandCost &result, TileIndex tile, uint32 p1, uint32 p2 DiagDirection dir = (DiagDirection)p2; - if (_settings_client.sound.confirm) SndPlayTileFx(SND_20_SPLAT_2, tile); + if (_settings_client.sound.confirm) SndPlayTileFx(SND_20_SPLAT_RAIL, tile); if (!_settings_client.gui.persistent_buildingtools) ResetObjectToPlace(); tile += TileOffsByDiagDir(dir); @@ -171,7 +171,7 @@ void CcStation(const CommandCost &result, TileIndex tile, uint32 p1, uint32 p2) { if (result.Failed()) return; - if (_settings_client.sound.confirm) SndPlayTileFx(SND_20_SPLAT_2, tile); + if (_settings_client.sound.confirm) SndPlayTileFx(SND_20_SPLAT_RAIL, tile); /* Only close the station builder window if the default station and non persistent building is chosen. */ if (_railstation.station_class == STAT_CLASS_DFLT && _railstation.station_type == 0 && !_settings_client.gui.persistent_buildingtools) ResetObjectToPlace(); } @@ -272,7 +272,7 @@ static void PlaceRail_Bridge(TileIndex tile, Window *w) void CcBuildRailTunnel(const CommandCost &result, TileIndex tile, uint32 p1, uint32 p2) { if (result.Succeeded()) { - if (_settings_client.sound.confirm) SndPlayTileFx(SND_20_SPLAT_2, tile); + if (_settings_client.sound.confirm) SndPlayTileFx(SND_20_SPLAT_RAIL, tile); if (!_settings_client.gui.persistent_buildingtools) ResetObjectToPlace(); } else { SetRedErrorSquare(_build_tunnel_endtile); diff --git a/src/road_gui.cpp b/src/road_gui.cpp index a35dab23c6..181c920019 100644 --- a/src/road_gui.cpp +++ b/src/road_gui.cpp @@ -63,7 +63,7 @@ static DiagDirection _road_station_picker_orientation; void CcPlaySound1D(const CommandCost &result, TileIndex tile, uint32 p1, uint32 p2) { - if (result.Succeeded() && _settings_client.sound.confirm) SndPlayTileFx(SND_1F_SPLAT, tile); + if (result.Succeeded() && _settings_client.sound.confirm) SndPlayTileFx(SND_1F_SPLAT_OTHER, tile); } /** @@ -93,7 +93,7 @@ static void PlaceRoad_Bridge(TileIndex tile, Window *w) void CcBuildRoadTunnel(const CommandCost &result, TileIndex start_tile, uint32 p1, uint32 p2) { if (result.Succeeded()) { - if (_settings_client.sound.confirm) SndPlayTileFx(SND_20_SPLAT_2, start_tile); + if (_settings_client.sound.confirm) SndPlayTileFx(SND_1F_SPLAT_OTHER, start_tile); if (!_settings_client.gui.persistent_buildingtools) ResetObjectToPlace(); DiagDirection start_direction = ReverseDiagDir(GetTunnelBridgeDirection(start_tile)); @@ -174,7 +174,7 @@ void CcRoadDepot(const CommandCost &result, TileIndex tile, uint32 p1, uint32 p2 if (result.Failed()) return; DiagDirection dir = (DiagDirection)GB(p1, 0, 2); - if (_settings_client.sound.confirm) SndPlayTileFx(SND_1F_SPLAT, tile); + if (_settings_client.sound.confirm) SndPlayTileFx(SND_1F_SPLAT_OTHER, tile); if (!_settings_client.gui.persistent_buildingtools) ResetObjectToPlace(); ConnectRoadToStructure(tile, dir); } @@ -198,7 +198,7 @@ void CcRoadStop(const CommandCost &result, TileIndex tile, uint32 p1, uint32 p2) if (result.Failed()) return; DiagDirection dir = (DiagDirection)GB(p2, 6, 2); - if (_settings_client.sound.confirm) SndPlayTileFx(SND_1F_SPLAT, tile); + if (_settings_client.sound.confirm) SndPlayTileFx(SND_1F_SPLAT_OTHER, tile); if (!_settings_client.gui.persistent_buildingtools) ResetObjectToPlace(); TileArea roadstop_area(tile, GB(p1, 0, 8), GB(p1, 8, 8)); TILE_AREA_LOOP(cur_tile, roadstop_area) { diff --git a/src/sound_type.h b/src/sound_type.h index b014c26943..799c7a8879 100644 --- a/src/sound_type.h +++ b/src/sound_type.h @@ -26,7 +26,7 @@ struct SoundEntry { enum SoundFx { SND_BEGIN = 0, - SND_02_SPLAT = 0, // 0 == 0x00 ! + SND_02_SPLAT_WATER = 0, ///< Water construction. SND_03_FACTORY_WHISTLE, SND_04_TRAIN, SND_05_TRAIN_THROUGH_TUNNEL, @@ -55,8 +55,8 @@ enum SoundFx { SND_1C_TRUCK_START_2, SND_1D_APPLAUSE, SND_1E_OOOOH, - SND_1F_SPLAT, // 29 == 0x1D - SND_20_SPLAT_2, // 30 == 0x1E + SND_1F_SPLAT_OTHER, ///< Non-water non-rail construction. + SND_20_SPLAT_RAIL, ///< Rail construction. SND_21_JACKHAMMER, SND_22_CAR_HORN, SND_23_CAR_HORN_2, diff --git a/src/terraform_gui.cpp b/src/terraform_gui.cpp index d1815ca9b2..399b0a073b 100644 --- a/src/terraform_gui.cpp +++ b/src/terraform_gui.cpp @@ -40,7 +40,7 @@ void CcTerraform(const CommandCost &result, TileIndex tile, uint32 p1, uint32 p2) { if (result.Succeeded()) { - if (_settings_client.sound.confirm) SndPlayTileFx(SND_1F_SPLAT, tile); + if (_settings_client.sound.confirm) SndPlayTileFx(SND_1F_SPLAT_OTHER, tile); } else { extern TileIndex _terraform_err_tile; SetRedErrorSquare(_terraform_err_tile); @@ -88,7 +88,7 @@ static void GenerateRockyArea(TileIndex end, TileIndex start) success = true; } - if (success && _settings_client.sound.confirm) SndPlayTileFx(SND_1F_SPLAT, end); + if (success && _settings_client.sound.confirm) SndPlayTileFx(SND_1F_SPLAT_OTHER, end); } /** @@ -409,7 +409,7 @@ static void CommonRaiseLowerBigLand(TileIndex tile, int mode) if (ta.w == 0 || ta.h == 0) return; - if (_settings_client.sound.confirm) SndPlayTileFx(SND_1F_SPLAT, tile); + if (_settings_client.sound.confirm) SndPlayTileFx(SND_1F_SPLAT_OTHER, tile); uint h; if (mode != 0) { diff --git a/src/town_gui.cpp b/src/town_gui.cpp index a36919ad98..b1fdace35e 100644 --- a/src/town_gui.cpp +++ b/src/town_gui.cpp @@ -958,7 +958,7 @@ void CcFoundTown(const CommandCost &result, TileIndex tile, uint32 p1, uint32 p2 { if (result.Failed()) return; - if (_settings_client.sound.confirm) SndPlayTileFx(SND_1F_SPLAT, tile); + if (_settings_client.sound.confirm) SndPlayTileFx(SND_1F_SPLAT_OTHER, tile); if (!_settings_client.gui.persistent_buildingtools) ResetObjectToPlace(); }