Changeset - r6905:87640b15e5e6
[Not reviewed]
master
0 1 0
rubidium - 17 years ago 2007-06-13 23:43:00
rubidium@openttd.org
(svn r10154) -Fix [FS#870]: some vehicles were not drawn when having a high resolution and a high zoom-out level. Patch by B. N. SmatZ!.
1 file changed with 23 insertions and 11 deletions:
0 comments (0 inline, 0 general)
src/vehicle.cpp
Show inline comments
 
@@ -889,17 +889,29 @@ void ViewportAddVehicles(DrawPixelInfo *
 
	const int b = dpi->top + dpi->height;
 

	
 
	/* The hash area to scan */
 
	const int xl = GB(l - 70, 7, 6);
 
	const int xu = GB(r,      7, 6);
 
	const int yl = GB(t - 70, 6, 6) << 6;
 
	const int yu = GB(b,      6, 6) << 6;
 

	
 
	int x;
 
	int y;
 

	
 
	for (y = yl;; y = (y + (1 << 6)) & (0x3F << 6)) {
 
		for (x = xl;; x = (x + 1) & 0x3F) {
 
			const Vehicle *v = _vehicle_position_hash[(x + y) & 0xFFFF];
 
	int xl, xu, yl, yu;
 

	
 
	if (dpi->width + 70 < (1 << (7 + 6))) {
 
		xl = GB(l - 70, 7, 6);
 
		xu = GB(r,      7, 6);
 
	} else {
 
		/* scan whole hash row */
 
		xl = 0;
 
		xu = 0x3F;
 
	}
 

	
 
	if (dpi->height + 70 < (1 << (6 + 6))) {
 
		yl = GB(t - 70, 6, 6) << 6;
 
		yu = GB(b,      6, 6) << 6;
 
	} else {
 
		/* scan whole column */
 
		yl = 0;
 
		yu = 0x3F << 6;
 
	}
 

	
 
	for (int y = yl;; y = (y + (1 << 6)) & (0x3F << 6)) {
 
		for (int x = xl;; x = (x + 1) & 0x3F) {
 
			const Vehicle *v = _vehicle_position_hash[x + y]; // already masked & 0xFFF
 

	
 
			while (v != NULL) {
 
				if (!(v->vehstatus & VS_HIDDEN) &&
0 comments (0 inline, 0 general)