Merge branch 'master' into jgrpp

# Conflicts:
#	src/company_cmd.cpp
#	src/core/overflowsafe_type.hpp
#	src/economy.cpp
#	src/engine_base.h
#	src/ground_vehicle.cpp
#	src/group_gui.cpp
#	src/industry_cmd.cpp
#	src/industry_gui.cpp
#	src/newgrf_commons.cpp
#	src/newgrf_engine.cpp
#	src/newgrf_industries.cpp
#	src/newgrf_object.cpp
#	src/newgrf_roadstop.cpp
#	src/newgrf_station.cpp
#	src/rail_gui.cpp
#	src/road_cmd.h
#	src/road_gui.cpp
#	src/saveload/afterload.cpp
#	src/script/api/script_log.cpp
#	src/script/api/script_log.hpp
#	src/settings_gui.cpp
#	src/settingsgen/settingsgen.cpp
#	src/station_cmd.cpp
#	src/station_cmd.h
#	src/station_gui.cpp
#	src/strgen/strgen.cpp
#	src/string_func.h
#	src/string_type.h
#	src/table/settings/network_private_settings.ini
#	src/tests/math_func.cpp
#	src/textfile_gui.cpp
#	src/timetable_gui.cpp
#	src/town_cmd.cpp
#	src/vehicle.cpp
#	src/waypoint_cmd.cpp
#	src/waypoint_cmd.h
#	src/widgets/dropdown.cpp
This commit is contained in:
Jonathan G Rennison
2023-06-03 19:16:42 +01:00
101 changed files with 987 additions and 964 deletions

View File

@@ -730,10 +730,11 @@ public:
* Set the distance to scroll when using the buttons or the wheel.
* @param stepsize Scrolling speed.
*/
void SetStepSize(uint16 stepsize)
void SetStepSize(size_t stepsize)
{
assert(stepsize > 0);
this->stepsize = stepsize;
this->stepsize = ClampTo<uint16_t>(stepsize);
}
/**
@@ -741,15 +742,13 @@ public:
* @param num the number of elements in the list
* @note updates the position if needed
*/
void SetCount(int num)
void SetCount(size_t num)
{
assert(num >= 0);
assert(num <= MAX_UVALUE(uint16));
this->count = num;
num -= this->cap;
if (num < 0) num = 0;
if (num < this->pos) this->pos = num;
this->count = ClampTo<uint16_t>(num);
/* Ensure position is within bounds */
this->SetPosition(this->pos);
}
/**
@@ -757,13 +756,13 @@ public:
* @param capacity the new capacity
* @note updates the position if needed
*/
void SetCapacity(int capacity)
void SetCapacity(size_t capacity)
{
assert(capacity > 0);
assert(capacity <= MAX_UVALUE(uint16));
this->cap = capacity;
if (this->cap + this->pos > this->count) this->pos = std::max(0, this->count - this->cap);
this->cap = ClampTo<uint16_t>(capacity);
/* Ensure position is within bounds */
this->SetPosition(this->pos);
}
void SetCapacityFromWidget(Window *w, int widget, int padding = 0);