Merge branch 'master' into jgrpp
# Conflicts: # .github/workflows/ci-build.yml # src/ai/ai_gui.cpp # src/blitter/32bpp_optimized.cpp # src/blitter/32bpp_simple.cpp # src/blitter/32bpp_sse2.cpp # src/blitter/8bpp_optimized.cpp # src/blitter/8bpp_simple.cpp # src/blitter/null.cpp # src/blitter/null.hpp # src/company_gui.cpp # src/game/game_gui.cpp # src/genworld_gui.cpp # src/gfx.cpp # src/gfx_func.h # src/graph_gui.cpp # src/industry_gui.cpp # src/linkgraph/linkgraphjob.cpp # src/network/network_gui.cpp # src/newgrf_debug_gui.cpp # src/openttd.cpp # src/pathfinder/npf/aystar.h # src/road_gui.cpp # src/saveload/order_sl.cpp # src/saveload/saveload.cpp # src/saveload/saveload.h # src/script/api/script_log.cpp # src/script/api/script_town.cpp # src/script/script_gui.cpp # src/settings.cpp # src/settings_gui.cpp # src/settings_table.cpp # src/settings_type.h # src/smallmap_gui.cpp # src/sortlist_type.h # src/spritecache.cpp # src/spriteloader/grf.cpp # src/spriteloader/grf.hpp # src/spriteloader/spriteloader.hpp # src/station_cmd.cpp # src/station_cmd.h # src/station_gui.cpp # src/strings.cpp # src/toolbar_gui.cpp # src/town_cmd.cpp # src/town_gui.cpp # src/vehicle_gui.cpp # src/vehicle_gui_base.h # src/video/opengl.cpp # src/video/opengl.h # src/widgets/dropdown.cpp # src/widgets/dropdown_type.h # src/window_gui.h
This commit is contained in:
@@ -9,6 +9,8 @@
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "cargotype.h"
|
||||
#include "core/geometry_func.hpp"
|
||||
#include "gfx_func.h"
|
||||
#include "newgrf_cargo.h"
|
||||
#include "string_func.h"
|
||||
#include "strings_func.h"
|
||||
@@ -70,6 +72,19 @@ void SetupCargoForClimate(LandscapeID l)
|
||||
std::fill(insert, std::end(CargoSpec::array), CargoSpec{});
|
||||
}
|
||||
|
||||
/**
|
||||
* Get dimensions of largest cargo icon.
|
||||
* @return Dimensions of largest cargo icon.
|
||||
*/
|
||||
Dimension GetLargestCargoIconSize()
|
||||
{
|
||||
Dimension size = {0, 0};
|
||||
for (const CargoSpec *cs : _sorted_cargo_specs) {
|
||||
size = maxdim(size, GetSpriteSize(cs->GetCargoIcon()));
|
||||
}
|
||||
return size;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the cargo ID of a default cargo, if present.
|
||||
* @param l Landscape
|
||||
@@ -179,7 +194,7 @@ static bool CargoSpecClassSorter(const CargoSpec * const &a, const CargoSpec * c
|
||||
void InitializeSortedCargoSpecs()
|
||||
{
|
||||
_sorted_cargo_specs.clear();
|
||||
/* Add each cargo spec to the list. */
|
||||
/* Add each cargo spec to the list, and determine the largest cargo icon size. */
|
||||
for (const CargoSpec *cargo : CargoSpec::Iterate()) {
|
||||
_sorted_cargo_specs.push_back(cargo);
|
||||
}
|
||||
|
Reference in New Issue
Block a user