xref hl optimization

This commit is contained in:
p.kosyh 2009-12-12 14:13:22 +00:00
parent a9c1df935d
commit e915bc5842
3 changed files with 12 additions and 5 deletions

View file

@ -1518,21 +1518,19 @@ int game_highlight(int x, int y, int on)
struct el *elem = NULL;
static struct el *oel = NULL;
static xref_t hxref = NULL;
xref_t xref = NULL;
int up = 0;
xref_t xref = NULL;
if (on) {
xref = look_xref(x, y, &elem);
if (xref && opt_hl) {
if (xref && opt_hl && !xref_get_active(xref)) {
xref_set_active(xref, 1);
game_xref_update(xref, elem->x, elem->y);
}
}
if (hxref != xref && oel) {
if (hxref != use_xref) {
if (hxref != use_xref && xref_get_active(hxref)) {
xref_set_active(hxref, 0);
game_xref_update(hxref, oel->x, oel->y);
up = 1;
}
hxref = NULL;
}

View file

@ -2626,6 +2626,14 @@ void xref_set_active(xref_t x, int val)
xref->active = val;
}
int xref_get_active(xref_t x)
{
struct xref *xref = (struct xref*)x;
if (!xref)
return 0;
return xref->active;
}
layout_t txt_layout(fnt_t fn, int align, int width, int height)
{

View file

@ -118,6 +118,7 @@ extern img_t txt_box_render(textbox_t tbox);
extern char *xref_get_text(xref_t x);
extern void xref_set_active(xref_t x, int val);
extern int xref_get_active(xref_t x);
extern xref_t xref_next(xref_t x);
extern xref_t xref_prev(xref_t x);