changeset 4189:ccc4c4455d07 draft

(svn r5631) Don't allocate memory for information about a sprite which isn't drawn
author tron <tron@openttd.org>
date Sat, 29 Jul 2006 13:06:00 +0000
parents cb56cb3830ce
children 34c2b20fbb67
files viewport.c
diffstat 1 files changed, 9 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/viewport.c
+++ b/viewport.c
@@ -463,6 +463,15 @@
 		return;
 	}
 
+	pt = RemapCoords(x, y, z);
+	spr = GetSprite(image & SPRITE_MASK);
+	if ((ps->left   = (pt.x += spr->x_offs)) >= vd->dpi.left + vd->dpi.width ||
+			(ps->right  = (pt.x +  spr->width )) <= vd->dpi.left ||
+			(ps->top    = (pt.y += spr->y_offs)) >= vd->dpi.top + vd->dpi.height ||
+			(ps->bottom = (pt.y +  spr->height)) <= vd->dpi.top) {
+		return;
+	}
+
 	vd->spritelist_mem += sizeof(ParentSpriteToDraw);
 
 	ps->image = image;
@@ -475,16 +484,6 @@
 	ps->zmin = z;
 	ps->zmax = z + dz - 1;
 
-	pt = RemapCoords(x, y, z);
-
-	spr = GetSprite(image & SPRITE_MASK);
-	if ((ps->left   = (pt.x += spr->x_offs)) >= vd->dpi.left + vd->dpi.width ||
-			(ps->right  = (pt.x +  spr->width )) <= vd->dpi.left ||
-			(ps->top    = (pt.y += spr->y_offs)) >= vd->dpi.top + vd->dpi.height ||
-			(ps->bottom = (pt.y +  spr->height)) <= vd->dpi.top) {
-		return;
-	}
-
 	ps->unk16 = 0;
 	ps->child = NULL;
 	vd->last_child = &ps->child;