mirror of https://github.com/OpenTTD/OpenTTD.git
(svn r19094) -Codechange: don't check for NULL values before calling StrEmpty
This commit is contained in:
parent
07409e6741
commit
6406b75b8f
|
@ -106,7 +106,7 @@ public:
|
||||||
delete *GetActiveBlitter();
|
delete *GetActiveBlitter();
|
||||||
*GetActiveBlitter() = newb;
|
*GetActiveBlitter() = newb;
|
||||||
|
|
||||||
DEBUG(driver, 1, "Successfully %s blitter '%s'",StrEmpty(name) ? "probed" : "loaded", bname);
|
DEBUG(driver, 1, "Successfully %s blitter '%s'", StrEmpty(name) ? "probed" : "loaded", bname);
|
||||||
return newb;
|
return newb;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -190,7 +190,7 @@ DEF_UDP_RECEIVE_COMMAND(Server, PACKET_UDP_CLIENT_GET_NEWGRFS)
|
||||||
* the current list and do not send the other data.
|
* the current list and do not send the other data.
|
||||||
* The name could be an empty string, if so take the filename. */
|
* The name could be an empty string, if so take the filename. */
|
||||||
packet_len += sizeof(c.grfid) + sizeof(c.md5sum) +
|
packet_len += sizeof(c.grfid) + sizeof(c.md5sum) +
|
||||||
min(strlen((f->name != NULL && !StrEmpty(f->name)) ? f->name : f->filename) + 1, (size_t)NETWORK_GRF_NAME_LENGTH);
|
min(strlen((!StrEmpty(f->name)) ? f->name : f->filename) + 1, (size_t)NETWORK_GRF_NAME_LENGTH);
|
||||||
if (packet_len > SEND_MTU - 4) { // 4 is 3 byte header + grf count in reply
|
if (packet_len > SEND_MTU - 4) { // 4 is 3 byte header + grf count in reply
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -206,8 +206,7 @@ DEF_UDP_RECEIVE_COMMAND(Server, PACKET_UDP_CLIENT_GET_NEWGRFS)
|
||||||
char name[NETWORK_GRF_NAME_LENGTH];
|
char name[NETWORK_GRF_NAME_LENGTH];
|
||||||
|
|
||||||
/* The name could be an empty string, if so take the filename */
|
/* The name could be an empty string, if so take the filename */
|
||||||
strecpy(name, (in_reply[i]->name != NULL && !StrEmpty(in_reply[i]->name)) ?
|
strecpy(name, (!StrEmpty(in_reply[i]->name)) ? in_reply[i]->name : in_reply[i]->filename, lastof(name));
|
||||||
in_reply[i]->name : in_reply[i]->filename, lastof(name));
|
|
||||||
this->Send_GRFIdentifier(&packet, in_reply[i]);
|
this->Send_GRFIdentifier(&packet, in_reply[i]);
|
||||||
packet.Send_string(name);
|
packet.Send_string(name);
|
||||||
}
|
}
|
||||||
|
|
|
@ -131,7 +131,7 @@ static void ShowNewGRFInfo(const GRFConfig *c, uint x, uint y, uint right, uint
|
||||||
if (HasBit(c->flags, GCF_COMPATIBLE)) y = DrawStringMultiLine(x, right, y, bottom, STR_NEWGRF_COMPATIBLE_LOADED);
|
if (HasBit(c->flags, GCF_COMPATIBLE)) y = DrawStringMultiLine(x, right, y, bottom, STR_NEWGRF_COMPATIBLE_LOADED);
|
||||||
|
|
||||||
/* Draw GRF info if it exists */
|
/* Draw GRF info if it exists */
|
||||||
if (c->info != NULL && !StrEmpty(c->info)) {
|
if (!StrEmpty(c->info)) {
|
||||||
SetDParam(0, STR_JUST_RAW_STRING);
|
SetDParam(0, STR_JUST_RAW_STRING);
|
||||||
SetDParamStr(1, c->info);
|
SetDParamStr(1, c->info);
|
||||||
y = DrawStringMultiLine(x, right, y, bottom, STR_BLACK_STRING);
|
y = DrawStringMultiLine(x, right, y, bottom, STR_BLACK_STRING);
|
||||||
|
@ -326,7 +326,7 @@ public:
|
||||||
{
|
{
|
||||||
const GRFConfig *c = this->grfs[i];
|
const GRFConfig *c = this->grfs[i];
|
||||||
bool h = c == this->sel;
|
bool h = c == this->sel;
|
||||||
const char *text = (c->name != NULL && !StrEmpty(c->name)) ? c->name : c->filename;
|
const char *text = (!StrEmpty(c->name)) ? c->name : c->filename;
|
||||||
|
|
||||||
/* Draw selection background */
|
/* Draw selection background */
|
||||||
if (h) GfxFillRect(r.left + 1, y, r.right - 1, y + this->resize.step_height - 1, 156);
|
if (h) GfxFillRect(r.left + 1, y, r.right - 1, y + this->resize.step_height - 1, 156);
|
||||||
|
@ -657,7 +657,7 @@ struct NewGRFWindow : public Window {
|
||||||
int i = 0;
|
int i = 0;
|
||||||
for (const GRFConfig *c = this->list; c != NULL; c = c->next, i++) {
|
for (const GRFConfig *c = this->list; c != NULL; c = c->next, i++) {
|
||||||
if (this->vscroll.IsVisible(i)) {
|
if (this->vscroll.IsVisible(i)) {
|
||||||
const char *text = (c->name != NULL && !StrEmpty(c->name)) ? c->name : c->filename;
|
const char *text = (!StrEmpty(c->name)) ? c->name : c->filename;
|
||||||
PaletteID pal;
|
PaletteID pal;
|
||||||
|
|
||||||
/* Pick a colour */
|
/* Pick a colour */
|
||||||
|
|
Loading…
Reference in New Issue