Merge branch 'master' into jgrpp
# Conflicts: # .github/workflows/release-windows.yml # src/company_base.h # src/company_cmd.cpp # src/company_gui.cpp # src/console_cmds.cpp # src/economy.cpp # src/economy_cmd.h # src/fios.h # src/goal.cpp # src/group_gui.cpp # src/network/core/config.h # src/network/network_admin.cpp # src/newgrf_config.cpp # src/os/windows/win32.cpp # src/saveload/afterload.cpp # src/saveload/company_sl.cpp # src/saveload/saveload.cpp # src/saveload/saveload_error.hpp # src/settings_gui.cpp # src/ship_cmd.cpp # src/stdafx.h # src/story.cpp # src/story_base.h # src/string.cpp # src/table/settings/economy_settings.ini # src/tests/CMakeLists.txt # src/tests/math_func.cpp
This commit is contained in:
@@ -1434,7 +1434,7 @@ private:
|
||||
/** Sort grfs by name. */
|
||||
static bool NameSorter(const GRFConfig * const &a, const GRFConfig * const &b)
|
||||
{
|
||||
int i = strnatcmp(a->GetName(), b->GetName(), true); // Sort by name (natural sorting).
|
||||
int i = StrNaturalCompare(a->GetName(), b->GetName(), true); // Sort by name (natural sorting).
|
||||
if (i != 0) return i < 0;
|
||||
|
||||
i = a->version - b->version;
|
||||
@@ -2208,21 +2208,15 @@ static WindowDesc _scan_progress_desc(
|
||||
|
||||
/** Window for showing the progress of NewGRF scanning. */
|
||||
struct ScanProgressWindow : public Window {
|
||||
char *last_name; ///< The name of the last 'seen' NewGRF.
|
||||
int scanned; ///< The number of NewGRFs that we have seen.
|
||||
std::string last_name; ///< The name of the last 'seen' NewGRF.
|
||||
int scanned; ///< The number of NewGRFs that we have seen.
|
||||
|
||||
/** Create the window. */
|
||||
ScanProgressWindow() : Window(&_scan_progress_desc), last_name(nullptr), scanned(0)
|
||||
ScanProgressWindow() : Window(&_scan_progress_desc), scanned(0)
|
||||
{
|
||||
this->InitNested(1);
|
||||
}
|
||||
|
||||
/** Free the last name buffer. */
|
||||
~ScanProgressWindow()
|
||||
{
|
||||
free(last_name);
|
||||
}
|
||||
|
||||
void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override
|
||||
{
|
||||
switch (widget) {
|
||||
@@ -2265,7 +2259,7 @@ struct ScanProgressWindow : public Window {
|
||||
SetDParam(1, _settings_client.gui.last_newgrf_count);
|
||||
DrawString(r.left, r.right, r.top, STR_NEWGRF_SCAN_STATUS, TC_FROMSTRING, SA_HOR_CENTER);
|
||||
|
||||
DrawString(r.left, r.right, r.top + FONT_HEIGHT_NORMAL + WidgetDimensions::scaled.vsep_normal, this->last_name == nullptr ? "" : this->last_name, TC_BLACK, SA_HOR_CENTER);
|
||||
DrawString(r.left, r.right, r.top + FONT_HEIGHT_NORMAL + WidgetDimensions::scaled.vsep_normal, this->last_name, TC_BLACK, SA_HOR_CENTER);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -2277,13 +2271,10 @@ struct ScanProgressWindow : public Window {
|
||||
*/
|
||||
void UpdateNewGRFScanStatus(uint num, const char *name)
|
||||
{
|
||||
free(this->last_name);
|
||||
if (name == nullptr) {
|
||||
char buf[256];
|
||||
GetString(buf, STR_NEWGRF_SCAN_ARCHIVES, lastof(buf));
|
||||
this->last_name = stredup(buf);
|
||||
this->last_name = GetString(STR_NEWGRF_SCAN_ARCHIVES);
|
||||
} else {
|
||||
this->last_name = stredup(name);
|
||||
this->last_name = name;
|
||||
}
|
||||
this->scanned = num;
|
||||
if (num > _settings_client.gui.last_newgrf_count) _settings_client.gui.last_newgrf_count = num;
|
||||
|
Reference in New Issue
Block a user