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:
@@ -669,8 +669,8 @@ bool AfterLoadGame()
|
||||
int dx = TileX(t) - TileX(st->train_station.tile);
|
||||
int dy = TileY(t) - TileY(st->train_station.tile);
|
||||
assert(dx >= 0 && dy >= 0);
|
||||
st->train_station.w = max<uint>(st->train_station.w, dx + 1);
|
||||
st->train_station.h = max<uint>(st->train_station.h, dy + 1);
|
||||
st->train_station.w = std::max<uint>(st->train_station.w, dx + 1);
|
||||
st->train_station.h = std::max<uint>(st->train_station.h, dy + 1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -843,12 +843,7 @@ bool AfterLoadGame()
|
||||
_settings_game.linkgraph.distribution_default = DT_MANUAL;
|
||||
}
|
||||
|
||||
if (IsSavegameVersionBefore(SLV_105)) {
|
||||
extern int32 _old_ending_year_slv_105; // in date.cpp
|
||||
_settings_game.game_creation.ending_year = _old_ending_year_slv_105 - 1;
|
||||
} else if (IsSavegameVersionBefore(SLV_ENDING_YEAR)) {
|
||||
/* Ending year was a GUI setting before SLV_105, was removed in revision 683b65ee1 (svn r14755). */
|
||||
/* This also converts scenarios, both when loading them into the editor, and when starting a new game. */
|
||||
if (IsSavegameVersionBefore(SLV_ENDING_YEAR)) {
|
||||
_settings_game.game_creation.ending_year = DEF_END_YEAR;
|
||||
}
|
||||
|
||||
@@ -2745,7 +2740,7 @@ bool AfterLoadGame()
|
||||
uint per_proc = _me[t].m7;
|
||||
_me[t].m7 = GB(_me[t].m6, 2, 6) | (GB(_m[t].m3, 5, 1) << 6);
|
||||
SB(_m[t].m3, 5, 1, 0);
|
||||
SB(_me[t].m6, 2, 6, min(per_proc, 63));
|
||||
SB(_me[t].m6, 2, 6, std::min(per_proc, 63U));
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -3001,7 +2996,7 @@ bool AfterLoadGame()
|
||||
_settings_game.pf.reverse_at_signals = IsSavegameVersionBefore(SLV_100) || (_settings_game.pf.wait_oneway_signal != 255 && _settings_game.pf.wait_twoway_signal != 255 && _settings_game.pf.wait_for_pbs_path != 255);
|
||||
|
||||
for (Train *t : Train::Iterate()) {
|
||||
_settings_game.vehicle.max_train_length = max<uint8>(_settings_game.vehicle.max_train_length, CeilDiv(t->gcache.cached_total_length, TILE_SIZE));
|
||||
_settings_game.vehicle.max_train_length = std::max<uint8>(_settings_game.vehicle.max_train_length, CeilDiv(t->gcache.cached_total_length, TILE_SIZE));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3127,7 +3122,7 @@ bool AfterLoadGame()
|
||||
* Set it to the reliability of the front engine or the maximum, whichever is lower. */
|
||||
const Engine *e = Engine::Get(v->engine_type);
|
||||
v->reliability_spd_dec = e->reliability_spd_dec;
|
||||
v->reliability = min(v->First()->reliability, e->reliability);
|
||||
v->reliability = std::min(v->First()->reliability, e->reliability);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3158,7 +3153,7 @@ bool AfterLoadGame()
|
||||
switch(v->type) {
|
||||
case VEH_AIRCRAFT:
|
||||
if (v->breakdown_type == BREAKDOWN_AIRCRAFT_SPEED && v->breakdown_severity == 0) {
|
||||
v->breakdown_severity = max(1, min(v->vcache.cached_max_speed >> 4, 255));
|
||||
v->breakdown_severity = std::max(1, std::min(v->vcache.cached_max_speed >> 4, 255));
|
||||
}
|
||||
break;
|
||||
|
||||
|
@@ -62,7 +62,7 @@ CompanyManagerFace ConvertFromOldCompanyManagerFace(uint32 face)
|
||||
uint lips = GB(face, 10, 4);
|
||||
if (!HasBit(ge, GENDER_FEMALE) && lips < 4) {
|
||||
SetCompanyManagerFaceBits(cmf, CMFV_HAS_MOUSTACHE, ge, true);
|
||||
SetCompanyManagerFaceBits(cmf, CMFV_MOUSTACHE, ge, max(lips, 1U) - 1);
|
||||
SetCompanyManagerFaceBits(cmf, CMFV_MOUSTACHE, ge, std::max(lips, 1U) - 1);
|
||||
} else {
|
||||
if (!HasBit(ge, GENDER_FEMALE)) {
|
||||
lips = lips * 15 / 16;
|
||||
|
@@ -53,7 +53,7 @@ void ResetViewportAfterLoadGame()
|
||||
w->viewport->dest_scrollpos_y = _saved_scrollpos_y;
|
||||
|
||||
Viewport *vp = w->viewport;
|
||||
vp->zoom = (ZoomLevel)min(_saved_scrollpos_zoom, ZOOM_LVL_MAX);
|
||||
vp->zoom = std::min(_saved_scrollpos_zoom, ZOOM_LVL_MAX);
|
||||
vp->virtual_width = ScaleByZoom(vp->width, vp->zoom);
|
||||
vp->virtual_height = ScaleByZoom(vp->height, vp->zoom);
|
||||
|
||||
|
@@ -393,7 +393,7 @@ static bool FixTTOEngines()
|
||||
for (uint i = 0; i < lengthof(_orig_ship_vehicle_info); i++, j++) new (GetTempDataEngine(j)) Engine(VEH_SHIP, i);
|
||||
for (uint i = 0; i < lengthof(_orig_aircraft_vehicle_info); i++, j++) new (GetTempDataEngine(j)) Engine(VEH_AIRCRAFT, i);
|
||||
|
||||
Date aging_date = min(_date + DAYS_TILL_ORIGINAL_BASE_YEAR, ConvertYMDToDate(2050, 0, 1));
|
||||
Date aging_date = std::min(_date + DAYS_TILL_ORIGINAL_BASE_YEAR, ConvertYMDToDate(2050, 0, 1));
|
||||
|
||||
for (EngineID i = 0; i < 256; i++) {
|
||||
int oi = ttd_to_tto[i];
|
||||
@@ -1824,7 +1824,7 @@ bool LoadTTOMain(LoadgameState *ls)
|
||||
* "increase them to compensate for the faster time advance in TTD compared to TTO
|
||||
* which otherwise would cause much less income while the annual running costs of
|
||||
* the vehicles stay the same" */
|
||||
_economy.inflation_payment = min(_economy.inflation_payment * 124 / 74, MAX_INFLATION);
|
||||
_economy.inflation_payment = std::min(_economy.inflation_payment * 124 / 74, MAX_INFLATION);
|
||||
|
||||
DEBUG(oldloader, 3, "Finished converting game data");
|
||||
DEBUG(oldloader, 1, "TTO savegame successfully converted");
|
||||
|
@@ -996,7 +996,7 @@ void SlSaveLoadConv(void *ptr, VarType conv)
|
||||
static inline size_t SlCalcNetStringLen(const char *ptr, size_t length)
|
||||
{
|
||||
if (ptr == nullptr) return 0;
|
||||
return min(strlen(ptr), length - 1);
|
||||
return std::min(strlen(ptr), length - 1);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -117,7 +117,7 @@ struct ReadBuffer {
|
||||
if (unlikely(this->bufp == this->bufe)) {
|
||||
this->AcquireBytes();
|
||||
}
|
||||
size_t to_copy = min<size_t>(this->bufe - this->bufp, length);
|
||||
size_t to_copy = std::min<size_t>(this->bufe - this->bufp, length);
|
||||
memcpy(ptr, this->bufp, to_copy);
|
||||
this->bufp += to_copy;
|
||||
ptr += to_copy;
|
||||
@@ -201,7 +201,7 @@ struct MemoryDumper {
|
||||
if (unlikely(this->buf == this->bufe)) {
|
||||
this->AllocateBuffer();
|
||||
}
|
||||
size_t to_copy = min<size_t>(this->bufe - this->buf, length);
|
||||
size_t to_copy = std::min<size_t>(this->bufe - this->buf, length);
|
||||
memcpy(this->buf, ptr, to_copy);
|
||||
this->buf += to_copy;
|
||||
ptr += to_copy;
|
||||
|
Reference in New Issue
Block a user