|
@@ -34,24 +34,29 @@ static int parse_intlist(const char *p,
|
|
|
if (*p != ',' && *p != ' ') return -1;
|
|
|
p++;
|
|
|
}
|
|
|
|
|
|
return n;
|
|
|
}
|
|
|
|
|
|
|
|
|
static void ShowNewGRFInfo(const GRFConfig *c, uint x, uint y, uint w, bool show_params)
|
|
|
{
|
|
|
char buff[256];
|
|
|
|
|
|
if (c->error != NULL) {
|
|
|
SetDParamStr(0, c->error);
|
|
|
y += DrawStringMultiLine(x, y, STR_NEWGRF_ERROR_MSG, w);
|
|
|
}
|
|
|
|
|
|
/* Draw filename or not if it is not known (GRF sent over internet) */
|
|
|
if (c->filename != NULL) {
|
|
|
SetDParamStr(0, c->filename);
|
|
|
y += DrawStringMultiLine(x, y, STR_NEWGRF_FILENAME, w);
|
|
|
}
|
|
|
|
|
|
/* Prepare and draw GRF ID */
|
|
|
snprintf(buff, lengthof(buff), "%08X", BSWAP32(c->grfid));
|
|
|
SetDParamStr(0, buff);
|
|
|
y += DrawStringMultiLine(x, y, STR_NEWGRF_GRF_ID, w);
|
|
|
|
|
|
/* Prepare and draw MD5 sum */
|
|
@@ -319,25 +324,26 @@ static void NewGRFWndProc(Window *w, Win
|
|
|
pal = PALETTE_TO_RED;
|
|
|
} else if (HASBIT(c->flags, GCF_STATIC)) {
|
|
|
pal = PALETTE_TO_GREY;
|
|
|
} else if (HASBIT(c->flags, GCF_COMPATIBLE)) {
|
|
|
pal = PALETTE_TO_ORANGE;
|
|
|
} else if (HASBIT(c->flags, GCF_ACTIVATED)) {
|
|
|
pal = PALETTE_TO_GREEN;
|
|
|
} else {
|
|
|
pal = PALETTE_TO_BLUE;
|
|
|
}
|
|
|
|
|
|
DrawSprite(SPR_SQUARE, pal, 5, y + 2);
|
|
|
DoDrawString(text, 25, y + 3, WP(w, newgrf_d).sel == c ? 0xC : 0x10);
|
|
|
if (c->error != NULL) DrawSprite(SPR_WARNING_SIGN, 0, 20, y + 2);
|
|
|
DoDrawString(text, c->error != NULL ? 35 : 25, y + 3, WP(w, newgrf_d).sel == c ? 0xC : 0x10);
|
|
|
y += 14;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
if (WP(w, newgrf_d).sel != NULL) {
|
|
|
/* Draw NewGRF file info */
|
|
|
const Widget *wi = &w->widget[SNGRFS_NEWGRF_INFO];
|
|
|
ShowNewGRFInfo(WP(w, newgrf_d).sel, wi->left + 2, wi->top + 2, wi->right - wi->left - 2, WP(w, newgrf_d).show_params);
|
|
|
}
|
|
|
|
|
|
break;
|
|
|
}
|