summaryrefslogtreecommitdiff
path: root/viewport.c
diff options
context:
space:
mode:
authortron <tron@openttd.org>2005-08-08 21:35:27 +0000
committertron <tron@openttd.org>2005-08-08 21:35:27 +0000
commiteb2dc7ef91499310c5b505a5c99fd7fa069f6d34 (patch)
tree141477785c427feae7e947288ef130ed6317e658 /viewport.c
parent4357fe0132834b0e6d498791e5a1c214574d983a (diff)
downloadopenttd-eb2dc7ef91499310c5b505a5c99fd7fa069f6d34.tar.xz
(svn r2845) Remove sprite size caching, it was unused
This makes GetSpriteDimension() superflous, because now it's just a thin wrapper around GetSprite() returning only part of the information, therefore remove it too
Diffstat (limited to 'viewport.c')
-rw-r--r--viewport.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/viewport.c b/viewport.c
index a7c82edf0..c3cc10834 100644
--- a/viewport.c
+++ b/viewport.c
@@ -403,12 +403,12 @@ static void AddCombinedSprite(uint32 image, int x, int y, byte z)
{
const ViewportDrawer *vd = _cur_vd;
Point pt = RemapCoords(x, y, z);
- const SpriteDimension *sd = GetSpriteDimension(image & SPRITE_MASK);
+ const Sprite* spr = GetSprite(image & SPRITE_MASK);
- if (pt.x + sd->xoffs >= vd->dpi.left + vd->dpi.width ||
- pt.x + sd->xoffs + sd->xsize <= vd->dpi.left ||
- pt.y + sd->yoffs >= vd->dpi.top + vd->dpi.height ||
- pt.y + sd->yoffs + sd->ysize <= vd->dpi.top)
+ if (pt.x + spr->x_offs >= vd->dpi.left + vd->dpi.width ||
+ pt.x + spr->x_offs + spr->width <= vd->dpi.left ||
+ pt.y + spr->y_offs >= vd->dpi.top + vd->dpi.height ||
+ pt.y + spr->y_offs + spr->height <= vd->dpi.top)
return;
AddChildSpriteScreen(image, pt.x - vd->parent_list[-1]->left, pt.y - vd->parent_list[-1]->top);
@@ -419,7 +419,7 @@ void AddSortableSpriteToDraw(uint32 image, int x, int y, int w, int h, byte dz,
{
ViewportDrawer *vd = _cur_vd;
ParentSpriteToDraw *ps;
- const SpriteDimension *sd;
+ const Sprite* spr;
Point pt;
assert((image & SPRITE_MASK) < MAX_SPRITES);
@@ -462,11 +462,11 @@ void AddSortableSpriteToDraw(uint32 image, int x, int y, int w, int h, byte dz,
pt = RemapCoords(x, y, z);
- sd = GetSpriteDimension(image & SPRITE_MASK);
- if ((ps->left = (pt.x += sd->xoffs)) >= vd->dpi.left + vd->dpi.width ||
- (ps->right = (pt.x + sd->xsize)) <= vd->dpi.left ||
- (ps->top = (pt.y += sd->yoffs)) >= vd->dpi.top + vd->dpi.height ||
- (ps->bottom = (pt.y + sd->ysize)) <= vd->dpi.top) {
+ 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;
}