From e043c6cef7b8afb694a528218c18a15bae3b5315 Mon Sep 17 00:00:00 2001 From: tron Date: Sat, 13 Jan 2007 15:00:16 +0000 Subject: (svn r8097) Replace strlen() {==,!=,>} 0 by the more concise {,!}StrEmpty(). Additionally the test takes O(1) instead of O(n) now --- src/newgrf_gui.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/newgrf_gui.cpp') diff --git a/src/newgrf_gui.cpp b/src/newgrf_gui.cpp index c02ffb701..0854b18f6 100644 --- a/src/newgrf_gui.cpp +++ b/src/newgrf_gui.cpp @@ -75,7 +75,7 @@ static void ShowNewGRFInfo(const GRFConfig *c, uint x, uint y, uint w, bool show if (HASBIT(c->flags, GCF_DISABLED)) y += DrawStringMultiLine(x, y, STR_NEWGRF_DISABLED, w); /* Draw GRF info if it exists */ - if (c->info != NULL && strlen(c->info) != 0) { + if (c->info != NULL && !StrEmpty(c->info)) { SetDParamStr(0, c->info); y += DrawStringMultiLine(x, y, STR_02BD, w); } else { @@ -116,7 +116,7 @@ static void NewGRFAddDlgWndProc(Window *w, WindowEvent *e) for (c = _all_grfs; c != NULL; c = c->next) { if (n >= w->vscroll.pos && n < w->vscroll.pos + w->vscroll.cap) { bool h = c == WP(w, newgrf_add_d).sel; - const char *text = (c->name != NULL && strlen(c->name) != 0) ? c->name : c->filename; + const char *text = (c->name != NULL && !StrEmpty(c->name)) ? c->name : c->filename; /* Draw selection background */ if (h) GfxFillRect(3, y, w->width - 15, y + 9, 156); @@ -310,7 +310,7 @@ static void NewGRFWndProc(Window *w, WindowEvent *e) y = w->widget[SNGRFS_FILE_LIST].top; for (c = *WP(w, newgrf_d).list, i = 0; c != NULL; c = c->next, i++) { if (i >= w->vscroll.pos && i < w->vscroll.pos + w->vscroll.cap) { - const char *text = (c->name != NULL && strlen(c->name) != 0) ? c->name : c->filename; + const char *text = (c->name != NULL && !StrEmpty(c->name)) ? c->name : c->filename; PalSpriteID pal; /* Pick a colour */ -- cgit v1.2.3-70-g09d2