Merge branch 'master' into jgrpp
# Conflicts: # cmake/CompileFlags.cmake # src/aircraft_cmd.cpp # src/blitter/32bpp_anim.cpp # src/cargopacket.cpp # src/cheat_gui.cpp # src/company_cmd.cpp # src/company_gui.cpp # src/core/pool_func.hpp # src/date.cpp # src/economy.cpp # src/error_gui.cpp # src/ground_vehicle.cpp # src/ground_vehicle.hpp # src/group_gui.cpp # src/industry_cmd.cpp # src/lang/dutch.txt # src/lang/french.txt # src/lang/german.txt # src/linkgraph/linkgraph_gui.cpp # src/linkgraph/mcf.cpp # src/network/network_content.cpp # src/network/network_server.cpp # src/network/network_udp.cpp # src/newgrf_engine.cpp # src/newgrf_station.cpp # src/order_cmd.cpp # src/order_gui.cpp # src/pathfinder/follow_track.hpp # src/pathfinder/yapf/yapf_common.hpp # src/saveload/saveload.cpp # src/settings_gui.cpp # src/station_cmd.cpp # src/station_kdtree.h # src/string_func.h # src/table/settings.ini # src/tgp.cpp # src/timetable_cmd.cpp # src/timetable_gui.cpp # src/toolbar_gui.cpp # src/town_cmd.cpp # src/train_cmd.cpp # src/train_gui.cpp # src/tree_gui.cpp # src/tunnelbridge_cmd.cpp # src/vehicle.cpp # src/vehicle_gui.cpp # src/video/sdl2_v.cpp # src/video/sdl_v.cpp # src/video/win32_v.cpp # src/viewport.cpp # src/viewport_sprite_sorter_sse4.cpp # src/window.cpp
This commit is contained in:
@@ -101,7 +101,7 @@ static void FindStationsAroundSelection()
|
||||
uint y = TileY(location.tile);
|
||||
|
||||
int max_c = 1;
|
||||
TileArea ta(TileXY(max<int>(0, x - max_c), max<int>(0, y - max_c)), TileXY(min<int>(MapMaxX(), x + location.w + max_c), min<int>(MapMaxY(), y + location.h + max_c)));
|
||||
TileArea ta(TileXY(std::max<int>(0, x - max_c), std::max<int>(0, y - max_c)), TileXY(std::min<int>(MapMaxX(), x + location.w + max_c), std::min<int>(MapMaxY(), y + location.h + max_c)));
|
||||
|
||||
Station *adjacent = nullptr;
|
||||
|
||||
@@ -170,7 +170,7 @@ static void StationsWndShowStationRating(int left, int right, int y, CargoID typ
|
||||
|
||||
int colour = cs->rating_colour;
|
||||
TextColour tc = GetContrastColour(colour);
|
||||
uint w = (minu(amount, units_full) + 5) / 36;
|
||||
uint w = (std::min(amount, units_full) + 5) / 36;
|
||||
|
||||
int height = GetCharacterHeight(FS_SMALL);
|
||||
|
||||
@@ -192,7 +192,7 @@ static void StationsWndShowStationRating(int left, int right, int y, CargoID typ
|
||||
/* Draw green/red ratings bar (fits into 14 pixels) */
|
||||
y += height + 2;
|
||||
GfxFillRect(left + 1, y, left + 14, y, PC_RED);
|
||||
rating = minu(rating, rating_full) / 16;
|
||||
rating = std::min<uint>(rating, rating_full) / 16;
|
||||
if (rating != 0) GfxFillRect(left + 1, y, left + rating, y, PC_GREEN);
|
||||
}
|
||||
|
||||
@@ -306,8 +306,8 @@ protected:
|
||||
|
||||
CargoID j;
|
||||
FOR_EACH_SET_CARGO_ID(j, cargo_filter) {
|
||||
if (a->goods[j].HasRating()) maxr1 = max(maxr1, a->goods[j].rating);
|
||||
if (b->goods[j].HasRating()) maxr2 = max(maxr2, b->goods[j].rating);
|
||||
if (a->goods[j].HasRating()) maxr1 = std::max(maxr1, a->goods[j].rating);
|
||||
if (b->goods[j].HasRating()) maxr2 = std::max(maxr2, b->goods[j].rating);
|
||||
}
|
||||
|
||||
return maxr1 < maxr2;
|
||||
@@ -321,8 +321,8 @@ protected:
|
||||
|
||||
for (CargoID j = 0; j < NUM_CARGO; j++) {
|
||||
if (!HasBit(cargo_filter, j)) continue;
|
||||
if (a->goods[j].HasRating()) minr1 = min(minr1, a->goods[j].rating);
|
||||
if (b->goods[j].HasRating()) minr2 = min(minr2, b->goods[j].rating);
|
||||
if (a->goods[j].HasRating()) minr1 = std::min(minr1, a->goods[j].rating);
|
||||
if (b->goods[j].HasRating()) minr2 = std::min(minr2, b->goods[j].rating);
|
||||
}
|
||||
|
||||
return minr1 > minr2;
|
||||
@@ -404,7 +404,7 @@ public:
|
||||
case WID_STL_BUS:
|
||||
case WID_STL_AIRPLANE:
|
||||
case WID_STL_SHIP:
|
||||
size->height = max<uint>(FONT_HEIGHT_SMALL, 10) + padding.height;
|
||||
size->height = std::max<uint>(FONT_HEIGHT_SMALL, 10) + padding.height;
|
||||
break;
|
||||
|
||||
case WID_STL_CARGOALL:
|
||||
@@ -446,7 +446,7 @@ public:
|
||||
|
||||
case WID_STL_LIST: {
|
||||
bool rtl = _current_text_dir == TD_RTL;
|
||||
int max = min(this->vscroll->GetPosition() + this->vscroll->GetCapacity(), (uint)this->stations.size());
|
||||
int max = std::min<size_t>(this->vscroll->GetPosition() + this->vscroll->GetCapacity(), this->stations.size());
|
||||
int y = r.top + WD_FRAMERECT_TOP;
|
||||
for (int i = this->vscroll->GetPosition(); i < max; ++i) { // do until max number of stations of owner
|
||||
const Station *st = this->stations[i];
|
||||
@@ -843,7 +843,7 @@ static const NWidgetPart _nested_station_view_widgets[] = {
|
||||
static void DrawCargoIcons(CargoID i, uint waiting, int left, int right, int y)
|
||||
{
|
||||
int width = ScaleGUITrad(10);
|
||||
uint num = min((waiting + (width / 2)) / width, (right - left) / width); // maximum is width / 10 icons so it won't overflow
|
||||
uint num = std::min<uint>((waiting + (width / 2)) / width, (right - left) / width); // maximum is width / 10 icons so it won't overflow
|
||||
if (num == 0) return;
|
||||
|
||||
SpriteID sprite = CargoSpec::Get(i)->GetCargoIcon();
|
||||
@@ -1401,7 +1401,7 @@ struct StationViewWindow : public Window {
|
||||
case WID_SV_WAITING:
|
||||
resize->height = FONT_HEIGHT_NORMAL;
|
||||
size->height = WD_FRAMERECT_TOP + 4 * resize->height + WD_FRAMERECT_BOTTOM;
|
||||
this->expand_shrink_width = max(GetStringBoundingBox("-").width, GetStringBoundingBox("+").width) + WD_FRAMERECT_LEFT + WD_FRAMERECT_RIGHT;
|
||||
this->expand_shrink_width = std::max(GetStringBoundingBox("-").width, GetStringBoundingBox("+").width) + WD_FRAMERECT_LEFT + WD_FRAMERECT_RIGHT;
|
||||
break;
|
||||
|
||||
case WID_SV_ACCEPT_RATING_LIST:
|
||||
@@ -2267,7 +2267,7 @@ static const T *FindStationsNearby(TileArea ta, bool distant_join)
|
||||
for (const BaseStation *st : BaseStation::Iterate()) {
|
||||
if (T::IsExpected(st) && !st->IsInUse() && st->owner == _local_company) {
|
||||
/* Include only within station spread (yes, it is strictly less than) */
|
||||
if (max(DistanceMax(ta.tile, st->xy), DistanceMax(TILE_ADDXY(ta.tile, ta.w - 1, ta.h - 1), st->xy)) < _settings_game.station.station_spread) {
|
||||
if (std::max(DistanceMax(ta.tile, st->xy), DistanceMax(TILE_ADDXY(ta.tile, ta.w - 1, ta.h - 1), st->xy)) < _settings_game.station.station_spread) {
|
||||
_deleted_stations_nearby.push_back({st->xy, st->index});
|
||||
|
||||
/* Add the station when it's within where we're going to build */
|
||||
@@ -2282,8 +2282,8 @@ static const T *FindStationsNearby(TileArea ta, bool distant_join)
|
||||
/* Only search tiles where we have a chance to stay within the station spread.
|
||||
* The complete check needs to be done in the callback as we don't know the
|
||||
* extent of the found station, yet. */
|
||||
if (distant_join && min(ta.w, ta.h) >= _settings_game.station.station_spread) return nullptr;
|
||||
uint max_dist = distant_join ? _settings_game.station.station_spread - min(ta.w, ta.h) : 1;
|
||||
if (distant_join && std::min(ta.w, ta.h) >= _settings_game.station.station_spread) return nullptr;
|
||||
uint max_dist = distant_join ? _settings_game.station.station_spread - std::min(ta.w, ta.h) : 1;
|
||||
|
||||
TileIndex tile = TileAddByDir(ctx.tile, DIR_N);
|
||||
CircularTileSearch(&tile, max_dist, ta.w, ta.h, AddNearbyStation<T>, &ctx);
|
||||
@@ -2367,7 +2367,7 @@ struct SelectStationWindow : Window {
|
||||
y += this->resize.step_height;
|
||||
}
|
||||
|
||||
for (uint i = max<uint>(1, this->vscroll->GetPosition()); i <= _stations_nearby_list.size(); ++i, y += this->resize.step_height) {
|
||||
for (uint i = std::max<uint>(1, this->vscroll->GetPosition()); i <= _stations_nearby_list.size(); ++i, y += this->resize.step_height) {
|
||||
/* Don't draw anything if it extends past the end of the window. */
|
||||
if (i - this->vscroll->GetPosition() >= this->vscroll->GetCapacity()) break;
|
||||
|
||||
|
Reference in New Issue
Block a user