mirror of https://github.com/OpenTTD/OpenTTD.git
(svn r12140) -Codechange: A bit of code style fixes(Geektoo).
This commit is contained in:
parent
859d768bb7
commit
739b118c6b
|
@ -284,8 +284,9 @@ static uint32 GetSpriteCacheUsage()
|
||||||
uint32 tot_size = 0;
|
uint32 tot_size = 0;
|
||||||
MemBlock* s;
|
MemBlock* s;
|
||||||
|
|
||||||
for (s = _spritecache_ptr; s->size != 0; s = NextBlock(s))
|
for (s = _spritecache_ptr; s->size != 0; s = NextBlock(s)) {
|
||||||
if (!(s->size & S_FREE_MASK)) tot_size += s->size;
|
if (!(s->size & S_FREE_MASK)) tot_size += s->size;
|
||||||
|
}
|
||||||
|
|
||||||
return tot_size;
|
return tot_size;
|
||||||
}
|
}
|
||||||
|
@ -454,6 +455,7 @@ const void *GetRawSprite(SpriteID sprite, bool real_sprite)
|
||||||
|
|
||||||
/* Load the sprite, if it is not loaded, yet */
|
/* Load the sprite, if it is not loaded, yet */
|
||||||
if (p == NULL) p = ReadSprite(sc, sprite, real_sprite);
|
if (p == NULL) p = ReadSprite(sc, sprite, real_sprite);
|
||||||
|
|
||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -361,7 +361,7 @@ ViewPort *IsPtInWindowViewport(const Window *w, int x, int y)
|
||||||
ViewPort *vp = w->viewport;
|
ViewPort *vp = w->viewport;
|
||||||
|
|
||||||
if (vp != NULL &&
|
if (vp != NULL &&
|
||||||
IsInsideMM(x, vp->left, vp->left + vp->width) &&
|
IsInsideMM(x, vp->left, vp->left + vp->width) &&
|
||||||
IsInsideMM(y, vp->top, vp->top + vp->height))
|
IsInsideMM(y, vp->top, vp->top + vp->height))
|
||||||
return vp;
|
return vp;
|
||||||
|
|
||||||
|
@ -689,6 +689,7 @@ void AddSortableSpriteToDraw(SpriteID image, SpriteID pal, int x, int y, int w,
|
||||||
top = ps->top = (pt.y += spr->y_offs);
|
top = ps->top = (pt.y += spr->y_offs);
|
||||||
bottom = (pt.y + spr->height);
|
bottom = (pt.y + spr->height);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_draw_bounding_boxes && (image != SPR_EMPTY_BOUNDING_BOX)) {
|
if (_draw_bounding_boxes && (image != SPR_EMPTY_BOUNDING_BOX)) {
|
||||||
/* Compute maximal extents of sprite and it's bounding box */
|
/* Compute maximal extents of sprite and it's bounding box */
|
||||||
left = min(left , RemapCoords(x + w , y + bb_offset_y, z + bb_offset_z).x);
|
left = min(left , RemapCoords(x + w , y + bb_offset_y, z + bb_offset_z).x);
|
||||||
|
@ -696,9 +697,10 @@ void AddSortableSpriteToDraw(SpriteID image, SpriteID pal, int x, int y, int w,
|
||||||
top = min(top , RemapCoords(x + bb_offset_x, y + bb_offset_y, z + dz ).y);
|
top = min(top , RemapCoords(x + bb_offset_x, y + bb_offset_y, z + dz ).y);
|
||||||
bottom = max(bottom, RemapCoords(x + w , y + h , z + bb_offset_z).y + 1);
|
bottom = max(bottom, RemapCoords(x + w , y + h , z + bb_offset_z).y + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Do not add the sprite to the viewport, if it is outside */
|
/* Do not add the sprite to the viewport, if it is outside */
|
||||||
if (left >= vd->dpi.left + vd->dpi.width ||
|
if (left >= vd->dpi.left + vd->dpi.width ||
|
||||||
right <= vd->dpi.left ||
|
right <= vd->dpi.left ||
|
||||||
top >= vd->dpi.top + vd->dpi.height ||
|
top >= vd->dpi.top + vd->dpi.height ||
|
||||||
bottom <= vd->dpi.top) {
|
bottom <= vd->dpi.top) {
|
||||||
return;
|
return;
|
||||||
|
@ -1592,6 +1594,7 @@ void ViewportDoDraw(const ViewPort *vp, int left, int top, int right, int bottom
|
||||||
|
|
||||||
ViewportSortParentSprites(parent_list);
|
ViewportSortParentSprites(parent_list);
|
||||||
ViewportDrawParentSprites(parent_list);
|
ViewportDrawParentSprites(parent_list);
|
||||||
|
|
||||||
if (_draw_bounding_boxes) ViewportDrawBoundingBoxes(parent_list);
|
if (_draw_bounding_boxes) ViewportDrawBoundingBoxes(parent_list);
|
||||||
|
|
||||||
if (vd.first_string != NULL) ViewportDrawStrings(&vd.dpi, vd.first_string);
|
if (vd.first_string != NULL) ViewportDrawStrings(&vd.dpi, vd.first_string);
|
||||||
|
@ -1706,6 +1709,7 @@ void UpdateViewportPosition(Window *w)
|
||||||
}
|
}
|
||||||
|
|
||||||
ClampViewportToMap(vp, WP(w, vp_d).scrollpos_x, WP(w, vp_d).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);
|
SetViewportPosition(w, WP(w, vp_d).scrollpos_x, WP(w, vp_d).scrollpos_y);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue