1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-18 20:43:04 +01:00

Merge branch 'develop' into HEAD

This commit is contained in:
duncanspumpkin
2021-09-19 07:20:35 +01:00
3 changed files with 18 additions and 21 deletions

View File

@@ -3655,6 +3655,7 @@ STR_6454 :Ne povas renomi rubandon…
STR_6455 :Ne povas renomi surskribaĵon…
STR_6456 :Giganta Ekrankopio
STR_6457 :Raporti cimon sur GitHub
STR_6458 :Sekvi ĉi tion en Ĉefa Vido
#############
# Scenarios #

View File

@@ -413,7 +413,7 @@ STR_1023 :{POP16}{POP16}{POP16}{COMMA16} voitures par train
STR_1024 :{COMMA16} voiture par train
STR_1025 :{COMMA16} voitures par train
STR_1026 :Le quai est trop long!
STR_1027 :Localiser sur la vue générale
STR_1027 :Localiser sur la vue principale
STR_1028 :En dehors de la carte!
STR_1029 :Impossible de construire à la fois au-dessus et en-dessous de leau!
STR_1030 :Ne peut être construit que sous leau!
@@ -3662,6 +3662,7 @@ STR_6454 :Impossible de renommer la bannière…
STR_6455 :Impossible de renommer le panneau…
STR_6456 :Capture décran géante
STR_6457 :Signaler un bug sur GitHub
STR_6458 :Suivre sur la vue principale
#############
# Scenarios #

View File

@@ -781,7 +781,7 @@ static std::unique_ptr<TrackDesign> _trackDesign;
// Cached overall view for each ride
// (Re)calculated when the ride window is opened
struct ride_overall_view {
int32_t x, y, z;
CoordsXYZ loc;
uint8_t zoom;
};
@@ -1167,10 +1167,10 @@ static void window_ride_update_overall_view(Ride* ride)
tile_element_iterator_begin(&it);
int32_t minx = std::numeric_limits<int32_t>::max(), miny = std::numeric_limits<int32_t>::max(),
minz = std::numeric_limits<int32_t>::max();
int32_t maxx = std::numeric_limits<int32_t>::min(), maxy = std::numeric_limits<int32_t>::min(),
maxz = std::numeric_limits<int32_t>::min();
CoordsXYZ min = { std::numeric_limits<int32_t>::max(), std::numeric_limits<int32_t>::max(),
std::numeric_limits<int32_t>::max() };
CoordsXYZ max = { std::numeric_limits<int32_t>::min(), std::numeric_limits<int32_t>::min(),
std::numeric_limits<int32_t>::min() };
while (tile_element_iterator_next(&it))
{
@@ -1184,13 +1184,13 @@ static void window_ride_update_overall_view(Ride* ride)
int32_t baseZ = it.element->GetBaseZ();
int32_t clearZ = it.element->GetClearanceZ();
minx = std::min(minx, location.x);
miny = std::min(miny, location.y);
minz = std::min(minz, baseZ);
min.x = std::min(min.x, location.x);
min.y = std::min(min.y, location.y);
min.z = std::min(min.z, baseZ);
maxx = std::max(maxx, location.x);
maxy = std::max(maxy, location.y);
maxz = std::max(maxz, clearZ);
max.x = std::max(max.x, location.x);
max.y = std::max(max.y, location.y);
max.z = std::max(max.z, clearZ);
}
const auto rideIndex = EnumValue(ride->id);
@@ -1200,16 +1200,12 @@ static void window_ride_update_overall_view(Ride* ride)
}
auto& view = ride_overall_views[rideIndex];
view.x = (minx + maxx) / 2 + 16;
view.y = (miny + maxy) / 2 + 16;
view.z = (minz + maxz) / 2 - 8;
view.loc = CoordsXYZ{ (min.x + max.x) / 2, (min.y + max.y) / 2, (min.z + max.z) / 2 } + CoordsXYZ{ 16, 16, -8 };
// Calculate size to determine from how far away to view the ride
int32_t dx = maxx - minx;
int32_t dy = maxy - miny;
int32_t dz = maxz - minz;
const auto diff = max - min;
int32_t size = static_cast<int32_t>(std::sqrt(dx * dx + dy * dy + dz * dz));
const int32_t size = static_cast<int32_t>(std::sqrt(diff.x * diff.x + diff.y * diff.y + diff.z * diff.z));
if (size >= 80)
{
@@ -1634,8 +1630,7 @@ static void window_ride_init_viewport(rct_window* w)
if (w->number < ride_overall_views.size())
{
const auto& view = ride_overall_views[w->number];
CoordsXYZ loc = { view.x, view.y, view.z };
focus = Focus2(loc, view.zoom);
focus = Focus2(view.loc, view.zoom);
}
}