diff --git a/projects/dpi_aware.manifest b/projects/dpi_aware.manifest new file mode 100644 index 0000000000..6f04161596 --- /dev/null +++ b/projects/dpi_aware.manifest @@ -0,0 +1,7 @@ + + + + True/PM + + + diff --git a/projects/openttd_vs100.vcxproj b/projects/openttd_vs100.vcxproj index 59e087ee70..9c3b107866 100644 --- a/projects/openttd_vs100.vcxproj +++ b/projects/openttd_vs100.vcxproj @@ -145,6 +145,9 @@ MachineX86 true + + dpi_aware.manifest + @@ -188,6 +191,9 @@ MachineX86 + + dpi_aware.manifest + @@ -244,6 +250,9 @@ MachineX64 true + + dpi_aware.manifest + @@ -289,6 +298,9 @@ 1048576 MachineX64 + + dpi_aware.manifest + diff --git a/projects/openttd_vs100.vcxproj.in b/projects/openttd_vs100.vcxproj.in index c6b16455a9..c8e71c4234 100644 --- a/projects/openttd_vs100.vcxproj.in +++ b/projects/openttd_vs100.vcxproj.in @@ -145,6 +145,9 @@ MachineX86 true + + dpi_aware.manifest + @@ -188,6 +191,9 @@ MachineX86 + + dpi_aware.manifest + @@ -244,6 +250,9 @@ MachineX64 true + + dpi_aware.manifest + @@ -289,6 +298,9 @@ 1048576 MachineX64 + + dpi_aware.manifest + !!FILES!! diff --git a/projects/openttd_vs140.vcxproj b/projects/openttd_vs140.vcxproj index 8d8b980649..eb8494167d 100644 --- a/projects/openttd_vs140.vcxproj +++ b/projects/openttd_vs140.vcxproj @@ -151,6 +151,9 @@ true 5.01 + + PerMonitorHighDPIAware + @@ -198,6 +201,9 @@ MachineX86 5.01 + + PerMonitorHighDPIAware + @@ -257,6 +263,9 @@ true 5.02 + + PerMonitorHighDPIAware + @@ -306,6 +315,9 @@ MachineX64 5.02 + + PerMonitorHighDPIAware + diff --git a/projects/openttd_vs140.vcxproj.in b/projects/openttd_vs140.vcxproj.in index 76b16b5109..9d873283fa 100644 --- a/projects/openttd_vs140.vcxproj.in +++ b/projects/openttd_vs140.vcxproj.in @@ -151,6 +151,9 @@ true 5.01 + + PerMonitorHighDPIAware + @@ -198,6 +201,9 @@ MachineX86 5.01 + + PerMonitorHighDPIAware + @@ -257,6 +263,9 @@ true 5.02 + + PerMonitorHighDPIAware + @@ -306,6 +315,9 @@ MachineX64 5.02 + + PerMonitorHighDPIAware + !!FILES!! diff --git a/src/ai/ai_gui.cpp b/src/ai/ai_gui.cpp index a0720e2ea5..101a97d0a9 100644 --- a/src/ai/ai_gui.cpp +++ b/src/ai/ai_gui.cpp @@ -306,7 +306,6 @@ struct AISettingsWindow : public Window { timeout(0) { this->ai_config = GetConfig(slot); - this->RebuildVisibleSettings(); this->CreateNestedTree(); this->vscroll = this->GetScrollbar(WID_AIS_SCROLLBAR); @@ -314,7 +313,7 @@ struct AISettingsWindow : public Window { this->SetWidgetDisabledState(WID_AIS_RESET, _game_mode != GM_MENU && Company::IsValidID(this->slot)); - this->vscroll->SetCount((int)this->visible_settings.size()); + this->RebuildVisibleSettings(); } virtual void SetStringParameters(int widget) const @@ -342,6 +341,8 @@ struct AISettingsWindow : public Window { visible_settings.push_back(&(*it)); } } + + this->vscroll->SetCount((int)this->visible_settings.size()); } virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) @@ -531,21 +532,23 @@ struct AISettingsWindow : public Window { virtual void OnQueryTextFinished(char *str) { if (StrEmpty(str)) return; - ScriptConfigItemList::const_iterator it = this->ai_config->GetConfigList()->begin(); + VisibleSettingsList::const_iterator it = this->visible_settings.begin(); for (int i = 0; i < this->clicked_row; i++) it++; - if (_game_mode == GM_NORMAL && ((this->slot == OWNER_DEITY) || Company::IsValidID(this->slot)) && (it->flags & SCRIPTCONFIG_INGAME) == 0) return; + const ScriptConfigItem config_item = **it; + if (_game_mode == GM_NORMAL && ((this->slot == OWNER_DEITY) || Company::IsValidID(this->slot)) && (config_item.flags & SCRIPTCONFIG_INGAME) == 0) return; int32 value = atoi(str); - this->ai_config->SetSetting((*it).name, value); + this->ai_config->SetSetting(config_item.name, value); this->SetDirty(); } virtual void OnDropdownSelect(int widget, int index) { assert(this->clicked_dropdown); - ScriptConfigItemList::const_iterator it = this->ai_config->GetConfigList()->begin(); + VisibleSettingsList::const_iterator it = this->visible_settings.begin(); for (int i = 0; i < this->clicked_row; i++) it++; - if (_game_mode == GM_NORMAL && ((this->slot == OWNER_DEITY) || Company::IsValidID(this->slot)) && (it->flags & SCRIPTCONFIG_INGAME) == 0) return; - this->ai_config->SetSetting((*it).name, index); + const ScriptConfigItem config_item = **it; + if (_game_mode == GM_NORMAL && ((this->slot == OWNER_DEITY) || Company::IsValidID(this->slot)) && (config_item.flags & SCRIPTCONFIG_INGAME) == 0) return; + this->ai_config->SetSetting(config_item.name, index); this->SetDirty(); } diff --git a/src/economy.cpp b/src/economy.cpp index cdfa059e86..7461d34b77 100644 --- a/src/economy.cpp +++ b/src/economy.cpp @@ -1643,13 +1643,11 @@ static void LoadUnloadVehicle(Vehicle *front) if (v->cargo_cap == 0) continue; artic_part++; - uint load_amount = GetLoadAmount(v); - GoodsEntry *ge = &st->goods[v->cargo_type]; if (HasBit(v->vehicle_flags, VF_CARGO_UNLOADING) && (front->current_order.GetUnloadType() & OUFB_NO_UNLOAD) == 0) { uint cargo_count = v->cargo.UnloadCount(); - uint amount_unloaded = _settings_game.order.gradual_loading ? min(cargo_count, load_amount) : cargo_count; + uint amount_unloaded = _settings_game.order.gradual_loading ? min(cargo_count, GetLoadAmount(v)) : cargo_count; bool remaining = false; // Are there cargo entities in this vehicle that can still be unloaded here? assert(payment != NULL); @@ -1754,8 +1752,8 @@ static void LoadUnloadVehicle(Vehicle *front) * has capacity for it, load it on the vehicle. */ uint cap_left = v->cargo_cap - v->cargo.StoredCount(); if (cap_left > 0 && (v->cargo.ActionCount(VehicleCargoList::MTA_LOAD) > 0 || ge->cargo.AvailableCount() > 0)) { - if (_settings_game.order.gradual_loading) cap_left = min(cap_left, load_amount); if (v->cargo.StoredCount() == 0) TriggerVehicle(v, VEHICLE_TRIGGER_NEW_CARGO); + if (_settings_game.order.gradual_loading) cap_left = min(cap_left, GetLoadAmount(v)); uint loaded = ge->cargo.Load(cap_left, &v->cargo, st->xy, next_station); if (v->cargo.ActionCount(VehicleCargoList::MTA_LOAD) > 0) { diff --git a/src/rail_cmd.cpp b/src/rail_cmd.cpp index a5face14c5..5582666b1c 100644 --- a/src/rail_cmd.cpp +++ b/src/rail_cmd.cpp @@ -1603,7 +1603,7 @@ CommandCost CmdConvertRail(TileIndex tile, DoCommandFlag flags, uint32 p1, uint3 * Tunnels and bridges have special check later */ if (tt != MP_TUNNELBRIDGE) { if (!IsCompatibleRail(type, totype)) { - CommandCost ret = EnsureNoVehicleOnGround(tile); + CommandCost ret = IsPlainRailTile(tile) ? EnsureNoTrainOnTrackBits(tile, GetTrackBits(tile)) : EnsureNoVehicleOnGround(tile); if (ret.Failed()) { error = ret; continue; diff --git a/src/saveload/saveload.cpp b/src/saveload/saveload.cpp index 5a09906bda..dfa3be7219 100644 --- a/src/saveload/saveload.cpp +++ b/src/saveload/saveload.cpp @@ -1994,7 +1994,7 @@ struct LZOLoadFilter : LoadFilter { byte out[LZO_BUFFER_SIZE + LZO_BUFFER_SIZE / 16 + 64 + 3 + sizeof(uint32) * 2]; uint32 tmp[2]; uint32 size; - lzo_uint len; + lzo_uint len = ssize; /* Read header*/ if (this->chain->Read((byte*)tmp, sizeof(tmp)) != sizeof(tmp)) SlError(STR_GAME_SAVELOAD_ERROR_FILE_NOT_READABLE, "File read failed"); @@ -2016,7 +2016,8 @@ struct LZOLoadFilter : LoadFilter { if (tmp[0] != lzo_adler32(0, out, size + sizeof(uint32))) SlErrorCorrupt("Bad checksum"); /* Decompress */ - lzo1x_decompress_safe(out + sizeof(uint32) * 1, size, buf, &len, NULL); + int ret = lzo1x_decompress_safe(out + sizeof(uint32) * 1, size, buf, &len, NULL); + if (ret != LZO_E_OK) SlError(STR_GAME_SAVELOAD_ERROR_FILE_NOT_READABLE); return len; } }; diff --git a/src/waypoint_cmd.cpp b/src/waypoint_cmd.cpp index efa48003f2..54489fa457 100644 --- a/src/waypoint_cmd.cpp +++ b/src/waypoint_cmd.cpp @@ -324,6 +324,7 @@ CommandCost CmdBuildBuoy(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 if (wp->town == NULL) MakeDefaultName(wp); MakeBuoy(tile, wp->index, GetWaterClass(tile)); + MarkTileDirtyByTile(tile); wp->UpdateVirtCoord(); InvalidateWindowData(WC_WAYPOINT_VIEW, wp->index);