Changeset - r9184:cdb864f70553
[Not reviewed]
master
0 10 0
glx - 16 years ago 2008-05-11 15:08:44
glx@openttd.org
(svn r13047) -Codechange: remove vp_d
10 files changed with 98 insertions and 99 deletions:
0 comments (0 inline, 0 general)
src/industry_gui.cpp
Show inline comments
 
@@ -433,7 +433,7 @@ enum IndustryViewWidgets {
 
};
 

	
 
/** Information to store about the industry window */
 
struct indview_d : public vp_d {
 
struct indview_d {
 
	byte editbox_line;        ///< The line clicked to open the edit box
 
	byte clicked_line;        ///< The line of the button that has been clicked
 
	byte clicked_button;      ///< The button that has been clicked (to raise)
 
@@ -601,8 +601,8 @@ static void IndustryViewWndProc(Window *
 
			w->viewport->height          += e->we.sizing.diff.y;
 
			w->viewport->virtual_width   += e->we.sizing.diff.x;
 
			w->viewport->virtual_height  += e->we.sizing.diff.y;
 
			WP(w, vp_d).dest_scrollpos_x -= e->we.sizing.diff.x;
 
			WP(w, vp_d).dest_scrollpos_y -= e->we.sizing.diff.y;
 
			w->viewport->dest_scrollpos_x -= e->we.sizing.diff.x;
 
			w->viewport->dest_scrollpos_y -= e->we.sizing.diff.y;
 
			UpdateViewportPosition(w);
 
			break;
 

	
src/main_gui.cpp
Show inline comments
 
@@ -166,27 +166,27 @@ bool DoZoomInOutWindow(int how, Window *
 
			vp->virtual_width >>= 1;
 
			vp->virtual_height >>= 1;
 

	
 
			WP(w, vp_d).scrollpos_x += vp->virtual_width >> 1;
 
			WP(w, vp_d).scrollpos_y += vp->virtual_height >> 1;
 
			WP(w, vp_d).dest_scrollpos_x = WP(w,vp_d).scrollpos_x;
 
			WP(w, vp_d).dest_scrollpos_y = WP(w,vp_d).scrollpos_y;
 
			w->viewport->scrollpos_x += vp->virtual_width >> 1;
 
			w->viewport->scrollpos_y += vp->virtual_height >> 1;
 
			w->viewport->dest_scrollpos_x = w->viewport->scrollpos_x;
 
			w->viewport->dest_scrollpos_y = w->viewport->scrollpos_y;
 
			break;
 
		case ZOOM_OUT:
 
			if (vp->zoom == ZOOM_LVL_MAX) return false;
 
			vp->zoom = (ZoomLevel)((int)vp->zoom + 1);
 

	
 
			WP(w, vp_d).scrollpos_x -= vp->virtual_width >> 1;
 
			WP(w, vp_d).scrollpos_y -= vp->virtual_height >> 1;
 
			WP(w, vp_d).dest_scrollpos_x = WP(w,vp_d).scrollpos_x;
 
			WP(w, vp_d).dest_scrollpos_y = WP(w,vp_d).scrollpos_y;
 
			w->viewport->scrollpos_x -= vp->virtual_width >> 1;
 
			w->viewport->scrollpos_y -= vp->virtual_height >> 1;
 
			w->viewport->dest_scrollpos_x = w->viewport->scrollpos_x;
 
			w->viewport->dest_scrollpos_y = w->viewport->scrollpos_y;
 

	
 
			vp->virtual_width <<= 1;
 
			vp->virtual_height <<= 1;
 
			break;
 
	}
 
	if (vp != NULL) { // the vp can be null when how == ZOOM_NONE
 
		vp->virtual_left = WP(w, vp_d).scrollpos_x;
 
		vp->virtual_top = WP(w, vp_d).scrollpos_y;
 
		vp->virtual_left = w->viewport->scrollpos_x;
 
		vp->virtual_top = w->viewport->scrollpos_y;
 
	}
 
	w->SetDirty();
 
	/* Update the windows that have zoom-buttons to perhaps disable their buttons */
 
@@ -380,10 +380,10 @@ static void MainWindowWndProc(Window *w,
 
				_scrolling_viewport = false;
 
			}
 

	
 
			WP(w, vp_d).scrollpos_x += ScaleByZoom(e->we.scroll.delta.x, vp->zoom);
 
			WP(w, vp_d).scrollpos_y += ScaleByZoom(e->we.scroll.delta.y, vp->zoom);
 
			WP(w, vp_d).dest_scrollpos_x = WP(w, vp_d).scrollpos_x;
 
			WP(w, vp_d).dest_scrollpos_y = WP(w, vp_d).scrollpos_y;
 
			w->viewport->scrollpos_x += ScaleByZoom(e->we.scroll.delta.x, vp->zoom);
 
			w->viewport->scrollpos_y += ScaleByZoom(e->we.scroll.delta.y, vp->zoom);
 
			w->viewport->dest_scrollpos_x = w->viewport->scrollpos_x;
 
			w->viewport->dest_scrollpos_y = w->viewport->scrollpos_y;
 
		} break;
 

	
 
		case WE_MOUSEWHEEL:
src/news_gui.cpp
Show inline comments
 
@@ -60,7 +60,7 @@ static NewsID _current_news = INVALID_NE
 
static NewsID _oldest_news = 0;             ///< points to first item in fifo queue
 
static NewsID _latest_news = INVALID_NEWS;  ///< points to last item in fifo queue
 

	
 
struct news_d : vp_d {
 
struct news_d {
 
	uint16 chat_height;
 
	NewsItem *ni;
 
};
src/openttd.cpp
Show inline comments
 
@@ -1092,8 +1092,8 @@ static void ScrollMainViewport(int x, in
 
		Window *w = FindWindowById(WC_MAIN_WINDOW, 0);
 
		assert(w);
 

	
 
		WP(w, vp_d).dest_scrollpos_x += ScaleByZoom(x, w->viewport->zoom);
 
		WP(w, vp_d).dest_scrollpos_y += ScaleByZoom(y, w->viewport->zoom);
 
		w->viewport->dest_scrollpos_x += ScaleByZoom(x, w->viewport->zoom);
 
		w->viewport->dest_scrollpos_y += ScaleByZoom(y, w->viewport->zoom);
 
	}
 
}
 

	
 
@@ -1203,8 +1203,8 @@ void BeforeSaveGame()
 
	const Window *w = FindWindowById(WC_MAIN_WINDOW, 0);
 

	
 
	if (w != NULL) {
 
		_saved_scrollpos_x = WP(w, const vp_d).scrollpos_x;
 
		_saved_scrollpos_y = WP(w, const vp_d).scrollpos_y;
 
		_saved_scrollpos_x = w->viewport->scrollpos_x;
 
		_saved_scrollpos_y = w->viewport->scrollpos_y;
 
		_saved_scrollpos_zoom = w->viewport->zoom;
 
	}
 
}
 
@@ -1316,10 +1316,10 @@ static bool InitializeWindowsAndCaches()
 

	
 
	Window *w = FindWindowById(WC_MAIN_WINDOW, 0);
 

	
 
	WP(w, vp_d).scrollpos_x = _saved_scrollpos_x;
 
	WP(w, vp_d).scrollpos_y = _saved_scrollpos_y;
 
	WP(w, vp_d).dest_scrollpos_x = _saved_scrollpos_x;
 
	WP(w, vp_d).dest_scrollpos_y = _saved_scrollpos_y;
 
	w->viewport->scrollpos_x = _saved_scrollpos_x;
 
	w->viewport->scrollpos_y = _saved_scrollpos_y;
 
	w->viewport->dest_scrollpos_x = _saved_scrollpos_x;
 
	w->viewport->dest_scrollpos_y = _saved_scrollpos_y;
 

	
 
	ViewPort *vp = w->viewport;
 
	vp->zoom = min(_saved_scrollpos_zoom, ZOOM_LVL_MAX);
src/smallmap_gui.cpp
Show inline comments
 
@@ -884,8 +884,8 @@ static void SmallMapWindowProc(Window *w
 
					_left_button_clicked = false;
 

	
 
					pt = RemapCoords(WP(w, smallmap_d).scroll_x, WP(w,smallmap_d).scroll_y, 0);
 
					WP(w2, vp_d).dest_scrollpos_x = pt.x + ((_cursor.pos.x - w->left + 2) << 4) - (w2->viewport->virtual_width >> 1);
 
					WP(w2, vp_d).dest_scrollpos_y = pt.y + ((_cursor.pos.y - w->top - 16) << 4) - (w2->viewport->virtual_height >> 1);
 
					w2->viewport->dest_scrollpos_x = pt.x + ((_cursor.pos.x - w->left + 2) << 4) - (w2->viewport->virtual_width >> 1);
 
					w2->viewport->dest_scrollpos_y = pt.y + ((_cursor.pos.y - w->top - 16) << 4) - (w2->viewport->virtual_height >> 1);
 

	
 
					w->SetDirty();
 
				} break;
 
@@ -1138,21 +1138,21 @@ static void ExtraViewPortWndProc(Window 
 

	
 
		case 7: { // location button (move main view to same spot as this view) 'Paste Location'
 
			Window *w2 = FindWindowById(WC_MAIN_WINDOW, 0);
 
			int x = WP(w, vp_d).scrollpos_x; // Where is the main looking at
 
			int y = WP(w, vp_d).scrollpos_y;
 
			int x = w->viewport->scrollpos_x; // Where is the main looking at
 
			int y = w->viewport->scrollpos_y;
 

	
 
			/* set this view to same location. Based on the center, adjusting for zoom */
 
			WP(w2, vp_d).dest_scrollpos_x =  x - (w2->viewport->virtual_width -  w->viewport->virtual_width) / 2;
 
			WP(w2, vp_d).dest_scrollpos_y =  y - (w2->viewport->virtual_height - w->viewport->virtual_height) / 2;
 
			w2->viewport->dest_scrollpos_x =  x - (w2->viewport->virtual_width -  w->viewport->virtual_width) / 2;
 
			w2->viewport->dest_scrollpos_y =  y - (w2->viewport->virtual_height - w->viewport->virtual_height) / 2;
 
		} break;
 

	
 
		case 8: { // inverse location button (move this view to same spot as main view) 'Copy Location'
 
			const Window *w2 = FindWindowById(WC_MAIN_WINDOW, 0);
 
			int x = WP(w2, const vp_d).scrollpos_x;
 
			int y = WP(w2, const vp_d).scrollpos_y;
 
			int x = w2->viewport->scrollpos_x;
 
			int y = w2->viewport->scrollpos_y;
 

	
 
			WP(w, vp_d).dest_scrollpos_x =  x + (w2->viewport->virtual_width -  w->viewport->virtual_width) / 2;
 
			WP(w, vp_d).dest_scrollpos_y =  y + (w2->viewport->virtual_height - w->viewport->virtual_height) / 2;
 
			w->viewport->dest_scrollpos_x =  x + (w2->viewport->virtual_width -  w->viewport->virtual_width) / 2;
 
			w->viewport->dest_scrollpos_y =  y + (w2->viewport->virtual_height - w->viewport->virtual_height) / 2;
 
		} break;
 
		}
 
		break;
 
@@ -1172,10 +1172,10 @@ static void ExtraViewPortWndProc(Window 
 
				_scrolling_viewport = false;
 
			}
 

	
 
			WP(w, vp_d).scrollpos_x += ScaleByZoom(e->we.scroll.delta.x, vp->zoom);
 
			WP(w, vp_d).scrollpos_y += ScaleByZoom(e->we.scroll.delta.y, vp->zoom);
 
			WP(w, vp_d).dest_scrollpos_x = WP(w, vp_d).scrollpos_x;
 
			WP(w, vp_d).dest_scrollpos_y = WP(w, vp_d).scrollpos_y;
 
			w->viewport->scrollpos_x += ScaleByZoom(e->we.scroll.delta.x, vp->zoom);
 
			w->viewport->scrollpos_y += ScaleByZoom(e->we.scroll.delta.y, vp->zoom);
 
			w->viewport->dest_scrollpos_x = w->viewport->scrollpos_x;
 
			w->viewport->dest_scrollpos_y = w->viewport->scrollpos_y;
 
		} break;
 

	
 
		case WE_MOUSEWHEEL:
 
@@ -1213,15 +1213,15 @@ void ShowExtraViewPortWindow(TileIndex t
 
			const Window *v = FindWindowById(WC_MAIN_WINDOW, 0);
 

	
 
			/* center on same place as main window (zoom is maximum, no adjustment needed) */
 
			pt.x = WP(v, vp_d).scrollpos_x + v->viewport->virtual_height / 2;
 
			pt.y = WP(v, vp_d).scrollpos_y + v->viewport->virtual_height / 2;
 
			pt.x = v->viewport->scrollpos_x + v->viewport->virtual_height / 2;
 
			pt.y = v->viewport->scrollpos_y + v->viewport->virtual_height / 2;
 
		} else {
 
			pt = RemapCoords(TileX(tile) * TILE_SIZE + TILE_SIZE / 2, TileY(tile) * TILE_SIZE + TILE_SIZE / 2, TileHeight(tile));
 
		}
 

	
 
		WP(w, vp_d).scrollpos_x = pt.x - ((w->widget[4].right - w->widget[4].left) - 1) / 2;
 
		WP(w, vp_d).scrollpos_y = pt.y - ((w->widget[4].bottom - w->widget[4].top) - 1) / 2;
 
		WP(w, vp_d).dest_scrollpos_x = WP(w, vp_d).scrollpos_x;
 
		WP(w, vp_d).dest_scrollpos_y = WP(w, vp_d).scrollpos_y;
 
		w->viewport->scrollpos_x = pt.x - ((w->widget[4].right - w->widget[4].left) - 1) / 2;
 
		w->viewport->scrollpos_y = pt.y - ((w->widget[4].bottom - w->widget[4].top) - 1) / 2;
 
		w->viewport->dest_scrollpos_x = w->viewport->scrollpos_x;
 
		w->viewport->dest_scrollpos_y = w->viewport->scrollpos_y;
 
	}
 
}
src/vehicle.cpp
Show inline comments
 
@@ -591,9 +591,9 @@ void Vehicle::PreDestructor()
 
	}
 

	
 
	Window *w = FindWindowById(WC_MAIN_WINDOW, 0);
 
	if (w != NULL && WP(w, vp_d).follow_vehicle == this->index) {
 
	if (w != NULL && w->viewport->follow_vehicle == this->index) {
 
		ScrollMainWindowTo(this->x_pos, this->y_pos, true); // lock the main view on the vehicle's last position
 
		WP(w, vp_d).follow_vehicle = INVALID_VEHICLE;
 
		w->viewport->follow_vehicle = INVALID_VEHICLE;
 
	}
 
}
 

	
src/vehicle_gui.cpp
Show inline comments
 
@@ -738,7 +738,7 @@ void ChangeVehicleViewWindow(VehicleID f
 

	
 
	if (w != NULL) {
 
		w->window_number = to_index;
 
		WP(w, vp_d).follow_vehicle = to_index;
 
		w->viewport->follow_vehicle = to_index;
 
		w->SetDirty();
 

	
 
		w = FindWindowById(WC_VEHICLE_ORDERS, from_index);
 
@@ -2091,7 +2091,7 @@ static void VehicleViewWndProc(Window *w
 
					const Window *mainwindow = FindWindowById(WC_MAIN_WINDOW, 0);
 
					/* code to allow the main window to 'follow' the vehicle if the ctrl key is pressed */
 
					if (_ctrl_pressed && mainwindow->viewport->zoom == ZOOM_LVL_NORMAL) {
 
						WP(mainwindow, vp_d).follow_vehicle = v->index;
 
						mainwindow->viewport->follow_vehicle = v->index;
 
					} else {
 
						ScrollMainWindowTo(v->x_pos, v->y_pos);
 
					}
src/viewport.cpp
Show inline comments
 
@@ -156,7 +156,7 @@ static Point MapXYZToViewport(const View
 

	
 
void DeleteWindowViewport(Window *w)
 
{
 
	w->viewport->width = 0;
 
	free(w->viewport);
 
	w->viewport = NULL;
 
}
 

	
 
@@ -177,7 +177,7 @@ void InitializeWindowViewport(Window *w,
 
{
 
	assert(w->viewport == NULL);
 

	
 
	ViewPort *vp = &(WP(w, vp_d).vp_data);
 
	ViewportData *vp = CallocT<ViewportData>(1);
 

	
 
	vp->left = x + w->left;
 
	vp->top = y + w->top;
 
@@ -194,21 +194,21 @@ void InitializeWindowViewport(Window *w,
 
	if (follow_flags & 0x80000000) {
 
		const Vehicle *veh;
 

	
 
		WP(w, vp_d).follow_vehicle = (VehicleID)(follow_flags & 0xFFFF);
 
		veh = GetVehicle(WP(w, vp_d).follow_vehicle);
 
		vp->follow_vehicle = (VehicleID)(follow_flags & 0xFFFF);
 
		veh = GetVehicle(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;
 

	
 
		WP(w, vp_d).follow_vehicle = INVALID_VEHICLE;
 
		vp->follow_vehicle = INVALID_VEHICLE;
 
		pt = MapXYZToViewport(vp, x, y, GetSlopeZ(x, y));
 
	}
 

	
 
	WP(w, vp_d).scrollpos_x = pt.x;
 
	WP(w, vp_d).scrollpos_y = pt.y;
 
	WP(w, vp_d).dest_scrollpos_x = pt.x;
 
	WP(w, vp_d).dest_scrollpos_y = pt.y;
 
	vp->scrollpos_x = pt.x;
 
	vp->scrollpos_y = pt.y;
 
	vp->dest_scrollpos_x = pt.x;
 
	vp->dest_scrollpos_y = pt.y;
 

	
 
	w->viewport = vp;
 
	vp->virtual_left = 0;//pt.x;
 
@@ -426,9 +426,7 @@ Point GetTileBelowCursor()
 
Point GetTileZoomCenterWindow(bool in, Window * w)
 
{
 
	int x, y;
 
	ViewPort * vp;
 

	
 
	vp = w->viewport;
 
	ViewPort *vp = w->viewport;
 

	
 
	if (in) {
 
		x = ((_cursor.pos.x - vp->left) >> 1) + (vp->width >> 2);
 
@@ -1581,33 +1579,33 @@ void UpdateViewportPosition(Window *w)
 
{
 
	const ViewPort *vp = w->viewport;
 

	
 
	if (WP(w, vp_d).follow_vehicle != INVALID_VEHICLE) {
 
		const Vehicle* veh = GetVehicle(WP(w, vp_d).follow_vehicle);
 
	if (w->viewport->follow_vehicle != INVALID_VEHICLE) {
 
		const Vehicle* veh = GetVehicle(w->viewport->follow_vehicle);
 
		Point pt = MapXYZToViewport(vp, veh->x_pos, veh->y_pos, veh->z_pos);
 

	
 
		SetViewportPosition(w, pt.x, pt.y);
 
	} else {
 
		/* Ensure the destination location is within the map */
 
		ClampViewportToMap(vp, WP(w, vp_d).dest_scrollpos_x, WP(w, vp_d).dest_scrollpos_y);
 

	
 
		int delta_x = WP(w, vp_d).dest_scrollpos_x - WP(w, vp_d).scrollpos_x;
 
		int delta_y = WP(w, vp_d).dest_scrollpos_y - WP(w, vp_d).scrollpos_y;
 
		ClampViewportToMap(vp, w->viewport->dest_scrollpos_x, w->viewport->dest_scrollpos_y);
 

	
 
		int delta_x = w->viewport->dest_scrollpos_x - w->viewport->scrollpos_x;
 
		int delta_y = w->viewport->dest_scrollpos_y - w->viewport->scrollpos_y;
 

	
 
		if (delta_x != 0 || delta_y != 0) {
 
			if (_patches.smooth_scroll) {
 
				int max_scroll = ScaleByMapSize1D(512);
 
				/* Not at our desired positon yet... */
 
				WP(w, vp_d).scrollpos_x += Clamp(delta_x / 4, -max_scroll, max_scroll);
 
				WP(w, vp_d).scrollpos_y += Clamp(delta_y / 4, -max_scroll, max_scroll);
 
				w->viewport->scrollpos_x += Clamp(delta_x / 4, -max_scroll, max_scroll);
 
				w->viewport->scrollpos_y += Clamp(delta_y / 4, -max_scroll, max_scroll);
 
			} else {
 
				WP(w, vp_d).scrollpos_x = WP(w, vp_d).dest_scrollpos_x;
 
				WP(w, vp_d).scrollpos_y = WP(w, vp_d).dest_scrollpos_y;
 
				w->viewport->scrollpos_x = w->viewport->dest_scrollpos_x;
 
				w->viewport->scrollpos_y = w->viewport->dest_scrollpos_y;
 
			}
 
		}
 

	
 
		ClampViewportToMap(vp, WP(w, vp_d).scrollpos_x, WP(w, vp_d).scrollpos_y);
 

	
 
		SetViewportPosition(w, WP(w, vp_d).scrollpos_x, WP(w, vp_d).scrollpos_y);
 
		ClampViewportToMap(vp, w->viewport->scrollpos_x, w->viewport->scrollpos_y);
 

	
 
		SetViewportPosition(w, w->viewport->scrollpos_x, w->viewport->scrollpos_y);
 
	}
 
}
 

	
 
@@ -2066,18 +2064,18 @@ bool ScrollWindowTo(int x , int y, Windo
 
{
 
	/* The slope cannot be acquired outside of the map, so make sure we are always within the map. */
 
	Point pt = MapXYZToViewport(w->viewport, x, y, GetSlopeZ(Clamp(x, 0, MapSizeX()), Clamp(y, 0, MapSizeY())));
 
	WP(w, vp_d).follow_vehicle = INVALID_VEHICLE;
 

	
 
	if (WP(w, vp_d).dest_scrollpos_x == pt.x && WP(w, vp_d).dest_scrollpos_y == pt.y)
 
	w->viewport->follow_vehicle = INVALID_VEHICLE;
 

	
 
	if (w->viewport->dest_scrollpos_x == pt.x && w->viewport->dest_scrollpos_y == pt.y)
 
		return false;
 

	
 
	if (instant) {
 
		WP(w, vp_d).scrollpos_x = pt.x;
 
		WP(w, vp_d).scrollpos_y = pt.y;
 
		w->viewport->scrollpos_x = pt.x;
 
		w->viewport->scrollpos_y = pt.y;
 
	}
 

	
 
	WP(w, vp_d).dest_scrollpos_x = pt.x;
 
	WP(w, vp_d).dest_scrollpos_y = pt.y;
 
	w->viewport->dest_scrollpos_x = pt.x;
 
	w->viewport->dest_scrollpos_y = pt.y;
 
	return true;
 
}
 

	
src/window.cpp
Show inline comments
 
@@ -1713,9 +1713,9 @@ static bool HandleViewportScroll()
 
		return true;
 
	}
 

	
 
	if (WP(w, vp_d).follow_vehicle != INVALID_VEHICLE && w == FindWindowById(WC_MAIN_WINDOW, 0)) {
 
	if (w == FindWindowById(WC_MAIN_WINDOW, 0) && w->viewport->follow_vehicle != INVALID_VEHICLE) {
 
		/* If the main window is following a vehicle, then first let go of it! */
 
		const Vehicle *veh = GetVehicle(WP(w, vp_d).follow_vehicle);
 
		const Vehicle *veh = GetVehicle(w->viewport->follow_vehicle);
 
		ScrollMainWindowTo(veh->x_pos, veh->y_pos, true); /* This also resets follow_vehicle */
 
		return true;
 
	}
 
@@ -1915,14 +1915,14 @@ static void HandleAutoscroll()
 
			/* here allows scrolling in both x and y axis */
 
#define scrollspeed 3
 
			if (x - 15 < 0) {
 
				WP(w, vp_d).dest_scrollpos_x += ScaleByZoom((x - 15) * scrollspeed, vp->zoom);
 
				w->viewport->dest_scrollpos_x += ScaleByZoom((x - 15) * scrollspeed, vp->zoom);
 
			} else if (15 - (vp->width - x) > 0) {
 
				WP(w, vp_d).dest_scrollpos_x += ScaleByZoom((15 - (vp->width - x)) * scrollspeed, vp->zoom);
 
				w->viewport->dest_scrollpos_x += ScaleByZoom((15 - (vp->width - x)) * scrollspeed, vp->zoom);
 
			}
 
			if (y - 15 < 0) {
 
				WP(w, vp_d).dest_scrollpos_y += ScaleByZoom((y - 15) * scrollspeed, vp->zoom);
 
				w->viewport->dest_scrollpos_y += ScaleByZoom((y - 15) * scrollspeed, vp->zoom);
 
			} else if (15 - (vp->height - y) > 0) {
 
				WP(w, vp_d).dest_scrollpos_y += ScaleByZoom((15 - (vp->height - y)) * scrollspeed, vp->zoom);
 
				w->viewport->dest_scrollpos_y += ScaleByZoom((15 - (vp->height - y)) * scrollspeed, vp->zoom);
 
			}
 
#undef scrollspeed
 
		}
src/window_gui.h
Show inline comments
 
@@ -271,6 +271,17 @@ struct ResizeInfo {
 
};
 

	
 
/**
 
 * Data structure for a window viewport
 
 */
 
struct ViewportData : ViewPort {
 
	VehicleID follow_vehicle;
 
	int32 scrollpos_x;
 
	int32 scrollpos_y;
 
	int32 dest_scrollpos_x;
 
	int32 dest_scrollpos_y;
 
};
 

	
 
	/**
 
 * Data structure for an opened window
 
 */
 
struct Window : ZeroedMemoryAllocator {
 
@@ -306,7 +317,7 @@ public:
 

	
 
	byte caption_color; ///< Background color of the window caption, contains PlayerID
 

	
 
	ViewPort *viewport;    ///< Pointer to viewport, if present
 
	ViewportData *viewport;      ///< Pointer to viewport data, if present
 
	const Widget *original_widget; ///< Original widget layout, copied from WindowDesc
 
	Widget *widget;        ///< Widgets of the window
 
	uint widget_count;     ///< Number of widgets of the window
 
@@ -540,16 +551,6 @@ struct depot_d {
 
};
 
assert_compile(WINDOW_CUSTOM_SIZE >= sizeof(depot_d));
 

	
 
struct vp_d {
 
	VehicleID follow_vehicle;
 
	int32 scrollpos_x;
 
	int32 scrollpos_y;
 
	int32 dest_scrollpos_x;
 
	int32 dest_scrollpos_y;
 
	ViewPort vp_data;          ///< Screen position and zoom of the viewport
 
};
 
assert_compile(WINDOW_CUSTOM_SIZE >= sizeof(vp_d));
 

	
 
enum SortListFlags {
 
	VL_NONE    = 0,      ///< no sort
 
	VL_DESC    = 1 << 0, ///< sort descending or ascending
0 comments (0 inline, 0 general)