Merge branch 'master' into jgrpp

# Conflicts:
#	.github/workflows/ci-build.yml
#	.github/workflows/release-linux.yml
#	.github/workflows/release-macos.yml
#	.github/workflows/release-source.yml
#	.github/workflows/release.yml
#	CMakeLists.txt
#	COMPILING.md
#	src/ai/ai_core.cpp
#	src/ai/ai_gui.cpp
#	src/bridge_gui.cpp
#	src/company_gui.cpp
#	src/console_cmds.cpp
#	src/core/CMakeLists.txt
#	src/core/smallmap_type.hpp
#	src/disaster_vehicle.h
#	src/effectvehicle_base.h
#	src/fontcache.cpp
#	src/game/game_core.cpp
#	src/game/game_gui.cpp
#	src/gamelog.cpp
#	src/gamelog_internal.h
#	src/group_gui.cpp
#	src/linkgraph/linkgraph.h
#	src/misc.cpp
#	src/network/core/config.h
#	src/network/core/udp.cpp
#	src/network/network_chat_gui.cpp
#	src/network/network_content_gui.cpp
#	src/network/network_gui.cpp
#	src/newgrf.cpp
#	src/newgrf_gui.cpp
#	src/newgrf_profiling.cpp
#	src/newgrf_profiling.h
#	src/object_gui.cpp
#	src/openttd.cpp
#	src/openttd.h
#	src/order_gui.cpp
#	src/os/windows/font_win32.cpp
#	src/rail_gui.cpp
#	src/road.cpp
#	src/road_gui.cpp
#	src/saveload/afterload.cpp
#	src/saveload/saveload.h
#	src/script/api/script_controller.cpp
#	src/script/api/script_roadtypelist.cpp
#	src/script/script_config.cpp
#	src/script/script_config.hpp
#	src/script/script_instance.cpp
#	src/script/script_scanner.cpp
#	src/script/squirrel.cpp
#	src/script/squirrel_helper.hpp
#	src/settings_gui.cpp
#	src/settings_internal.h
#	src/settings_type.h
#	src/table/settings/network_private_settings.ini
#	src/timetable_gui.cpp
#	src/vehicle.cpp
#	src/vehicle_base.h
#	src/window_gui.h
This commit is contained in:
Jonathan G Rennison
2023-07-01 01:08:35 +01:00
246 changed files with 2023 additions and 1211 deletions

View File

@@ -132,7 +132,7 @@ struct NIExtraInfoOutput {
class NIHelper {
public:
/** Silence a warning. */
virtual ~NIHelper() {}
virtual ~NIHelper() = default;
/**
* Is the item with the given index inspectable?
@@ -1266,7 +1266,7 @@ struct SpriteAlignerWindow : Window {
SpriteID current_sprite; ///< The currently shown sprite.
Scrollbar *vscroll;
SmallMap<SpriteID, XyOffs> offs_start_map; ///< Mapping of starting offsets for the sprites which have been aligned in the sprite aligner window.
std::map<SpriteID, XyOffs> offs_start_map; ///< Mapping of starting offsets for the sprites which have been aligned in the sprite aligner window.
static bool centre;
static bool crosshair;
@@ -1302,7 +1302,7 @@ struct SpriteAlignerWindow : Window {
/* Relative offset is new absolute offset - starting absolute offset.
* Show 0, 0 as the relative offsets if entry is not in the map (meaning they have not been changed yet).
*/
const auto key_offs_pair = this->offs_start_map.Find(this->current_sprite);
const auto key_offs_pair = this->offs_start_map.find(this->current_sprite);
if (key_offs_pair != this->offs_start_map.end()) {
SetDParam(0, spr->x_offs - key_offs_pair->second.first);
SetDParam(1, spr->y_offs - key_offs_pair->second.second);
@@ -1411,12 +1411,9 @@ struct SpriteAlignerWindow : Window {
break;
case WID_SA_LIST: {
const NWidgetBase *nwid = this->GetWidget<NWidgetBase>(widget);
int step_size = nwid->resize_y;
uint i = this->vscroll->GetPosition() + (pt.y - nwid->pos_y) / step_size;
if (i < _newgrf_debug_sprite_picker.sprites.size()) {
SpriteID spr = _newgrf_debug_sprite_picker.sprites[i];
auto it = this->vscroll->GetScrolledItemFromWidget(_newgrf_debug_sprite_picker.sprites, pt.y, this, widget);
if (it != _newgrf_debug_sprite_picker.sprites.end()) {
SpriteID spr = *it;
if (GetSpriteType(spr) == SpriteType::Normal) this->current_sprite = spr;
}
this->SetDirty();
@@ -1443,8 +1440,8 @@ struct SpriteAlignerWindow : Window {
Sprite *spr = const_cast<Sprite *>(GetSprite(this->current_sprite, SpriteType::Normal));
/* Remember the original offsets of the current sprite, if not already in mapping. */
if (!(this->offs_start_map.Contains(this->current_sprite))) {
this->offs_start_map.Insert(this->current_sprite, XyOffs(spr->x_offs, spr->y_offs));
if (this->offs_start_map.count(this->current_sprite) == 0) {
this->offs_start_map[this->current_sprite] = XyOffs(spr->x_offs, spr->y_offs);
}
switch (widget) {
/* Move eight units at a time if ctrl is pressed. */
@@ -1461,7 +1458,7 @@ struct SpriteAlignerWindow : Window {
case WID_SA_RESET_REL:
/* Reset the starting offsets for the current sprite. */
this->offs_start_map.Erase(this->current_sprite);
this->offs_start_map.erase(this->current_sprite);
this->SetDirty();
break;