Update to 12.0-beta1
This commit is contained in:
@@ -245,8 +245,8 @@ void InitializeWindowViewport(Window *w, int x, int y,
|
||||
veh = Vehicle::Get(vp->follow_vehicle);
|
||||
pt = MapXYZToViewport(vp, veh->x_pos, veh->y_pos, veh->z_pos);
|
||||
} else {
|
||||
uint x = TileX(follow_flags) * TILE_SIZE;
|
||||
uint y = TileY(follow_flags) * TILE_SIZE;
|
||||
x = TileX(follow_flags) * TILE_SIZE;
|
||||
y = TileY(follow_flags) * TILE_SIZE;
|
||||
|
||||
vp->follow_vehicle = INVALID_VEHICLE;
|
||||
pt = MapXYZToViewport(vp, x, y, GetSlopePixelZ(x, y));
|
||||
@@ -266,35 +266,36 @@ void InitializeWindowViewport(Window *w, int x, int y,
|
||||
|
||||
static Point _vp_move_offs;
|
||||
|
||||
static void DoSetViewportPosition(const Window *w, int left, int top, int width, int height)
|
||||
static void DoSetViewportPosition(Window::IteratorToFront it, int left, int top, int width, int height)
|
||||
{
|
||||
FOR_ALL_WINDOWS_FROM_BACK_FROM(w, w) {
|
||||
for (; !it.IsEnd(); ++it) {
|
||||
const Window *w = *it;
|
||||
if (left + width > w->left &&
|
||||
w->left + w->width > left &&
|
||||
top + height > w->top &&
|
||||
w->top + w->height > top) {
|
||||
|
||||
if (left < w->left) {
|
||||
DoSetViewportPosition(w, left, top, w->left - left, height);
|
||||
DoSetViewportPosition(w, left + (w->left - left), top, width - (w->left - left), height);
|
||||
DoSetViewportPosition(it, left, top, w->left - left, height);
|
||||
DoSetViewportPosition(it, left + (w->left - left), top, width - (w->left - left), height);
|
||||
return;
|
||||
}
|
||||
|
||||
if (left + width > w->left + w->width) {
|
||||
DoSetViewportPosition(w, left, top, (w->left + w->width - left), height);
|
||||
DoSetViewportPosition(w, left + (w->left + w->width - left), top, width - (w->left + w->width - left), height);
|
||||
DoSetViewportPosition(it, left, top, (w->left + w->width - left), height);
|
||||
DoSetViewportPosition(it, left + (w->left + w->width - left), top, width - (w->left + w->width - left), height);
|
||||
return;
|
||||
}
|
||||
|
||||
if (top < w->top) {
|
||||
DoSetViewportPosition(w, left, top, width, (w->top - top));
|
||||
DoSetViewportPosition(w, left, top + (w->top - top), width, height - (w->top - top));
|
||||
DoSetViewportPosition(it, left, top, width, (w->top - top));
|
||||
DoSetViewportPosition(it, left, top + (w->top - top), width, height - (w->top - top));
|
||||
return;
|
||||
}
|
||||
|
||||
if (top + height > w->top + w->height) {
|
||||
DoSetViewportPosition(w, left, top, width, (w->top + w->height - top));
|
||||
DoSetViewportPosition(w, left, top + (w->top + w->height - top), width, height - (w->top + w->height - top));
|
||||
DoSetViewportPosition(it, left, top, width, (w->top + w->height - top));
|
||||
DoSetViewportPosition(it, left, top + (w->top + w->height - top), width, height - (w->top + w->height - top));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -380,7 +381,11 @@ static void SetViewportPosition(Window *w, int x, int y)
|
||||
i = top + height - _screen.height;
|
||||
if (i >= 0) height -= i;
|
||||
|
||||
if (height > 0) DoSetViewportPosition(w->z_front, left, top, width, height);
|
||||
if (height > 0) {
|
||||
Window::IteratorToFront it(w);
|
||||
++it;
|
||||
DoSetViewportPosition(it, left, top, width, height);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1475,8 +1480,7 @@ void ViewportSign::MarkDirty(ZoomLevel maxzoom) const
|
||||
zoomlevels[zoom].bottom = this->top + ScaleByZoom(VPSM_TOP + FONT_HEIGHT_NORMAL + VPSM_BOTTOM + 1, zoom);
|
||||
}
|
||||
|
||||
Window *w;
|
||||
FOR_ALL_WINDOWS_FROM_BACK(w) {
|
||||
for (const Window *w : Window::Iterate()) {
|
||||
Viewport *vp = w->viewport;
|
||||
if (vp != nullptr && vp->zoom <= maxzoom) {
|
||||
assert(vp->width != 0);
|
||||
@@ -1949,8 +1953,7 @@ bool MarkAllViewportsDirty(int left, int top, int right, int bottom)
|
||||
{
|
||||
bool dirty = false;
|
||||
|
||||
Window *w;
|
||||
FOR_ALL_WINDOWS_FROM_BACK(w) {
|
||||
for (const Window *w : Window::Iterate()) {
|
||||
Viewport *vp = w->viewport;
|
||||
if (vp != nullptr) {
|
||||
assert(vp->width != 0);
|
||||
@@ -1963,8 +1966,7 @@ bool MarkAllViewportsDirty(int left, int top, int right, int bottom)
|
||||
|
||||
void ConstrainAllViewportsZoom()
|
||||
{
|
||||
Window *w;
|
||||
FOR_ALL_WINDOWS_FROM_FRONT(w) {
|
||||
for (Window *w : Window::Iterate()) {
|
||||
if (w->viewport == nullptr) continue;
|
||||
|
||||
ZoomLevel zoom = static_cast<ZoomLevel>(Clamp(w->viewport->zoom, _settings_client.gui.zoom_min, _settings_client.gui.zoom_max));
|
||||
@@ -2361,7 +2363,7 @@ bool HandleViewportClicked(const Viewport *vp, int x, int y)
|
||||
bool result = CheckClickOnLandscape(vp, x, y);
|
||||
|
||||
if (v != nullptr) {
|
||||
DEBUG(misc, 2, "Vehicle %d (index %d) at %p", v->unitnumber, v->index, v);
|
||||
Debug(misc, 2, "Vehicle {} (index {}) at {}", v->unitnumber, v->index, fmt::ptr(v));
|
||||
if (IsCompanyBuildableVehicleType(v)) {
|
||||
v = v->First();
|
||||
if (_ctrl_pressed && v->owner == _local_company) {
|
||||
@@ -2645,7 +2647,7 @@ static inline void ShowMeasurementTooltips(StringID str, uint paramcount, const
|
||||
|
||||
static void HideMeasurementTooltips()
|
||||
{
|
||||
DeleteWindowById(WC_TOOLTIPS, 0);
|
||||
CloseWindowById(WC_TOOLTIPS, 0);
|
||||
}
|
||||
|
||||
/** highlighting tiles while only going over them with the mouse */
|
||||
@@ -3470,7 +3472,7 @@ void InitializeSpriteSorter()
|
||||
* @param text unused
|
||||
* @return the cost of this operation or an error
|
||||
*/
|
||||
CommandCost CmdScrollViewport(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
|
||||
CommandCost CmdScrollViewport(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
|
||||
{
|
||||
if (_current_company != OWNER_DEITY) return CMD_ERROR;
|
||||
ViewportScrollTarget target = (ViewportScrollTarget)p1;
|
||||
|
||||
Reference in New Issue
Block a user