diff --git a/src/strings.cpp b/src/strings.cpp --- a/src/strings.cpp +++ b/src/strings.cpp @@ -1270,8 +1270,8 @@ static char *FormatString(char *buff, co const Company *c = Company::GetIfValid(args->GetInt32()); if (c == nullptr) break; - if (c->name != nullptr) { - int64 args_array[] = {(int64)(size_t)c->name}; + if (!c->name.empty()) { + int64 args_array[] = {(int64)(size_t)c->name.c_str()}; StringParameters tmp_params(args_array); buff = GetStringWithArgs(buff, STR_JUST_RAW_STRING, &tmp_params, last); } else { @@ -1305,8 +1305,8 @@ static char *FormatString(char *buff, co } const Depot *d = Depot::Get(args->GetInt32()); - if (d->name != nullptr) { - int64 args_array[] = {(int64)(size_t)d->name}; + if (!d->name.empty()) { + int64 args_array[] = {(int64)(size_t)d->name.c_str()}; StringParameters tmp_params(args_array); buff = GetStringWithArgs(buff, STR_JUST_RAW_STRING, &tmp_params, last); } else { @@ -1321,8 +1321,8 @@ static char *FormatString(char *buff, co const Engine *e = Engine::GetIfValid(args->GetInt32(SCC_ENGINE_NAME)); if (e == nullptr) break; - if (e->name != nullptr && e->IsEnabled()) { - int64 args_array[] = {(int64)(size_t)e->name}; + if (!e->name.empty() && e->IsEnabled()) { + int64 args_array[] = {(int64)(size_t)e->name.c_str()}; StringParameters tmp_params(args_array); buff = GetStringWithArgs(buff, STR_JUST_RAW_STRING, &tmp_params, last); } else { @@ -1336,8 +1336,8 @@ static char *FormatString(char *buff, co const Group *g = Group::GetIfValid(args->GetInt32()); if (g == nullptr) break; - if (g->name != nullptr) { - int64 args_array[] = {(int64)(size_t)g->name}; + if (!g->name.empty()) { + int64 args_array[] = {(int64)(size_t)g->name.c_str()}; StringParameters tmp_params(args_array); buff = GetStringWithArgs(buff, STR_JUST_RAW_STRING, &tmp_params, last); } else { @@ -1373,8 +1373,8 @@ static char *FormatString(char *buff, co const Company *c = Company::GetIfValid(args->GetInt32(SCC_PRESIDENT_NAME)); if (c == nullptr) break; - if (c->president_name != nullptr) { - int64 args_array[] = {(int64)(size_t)c->president_name}; + if (!c->president_name.empty()) { + int64 args_array[] = {(int64)(size_t)c->president_name.c_str()}; StringParameters tmp_params(args_array); buff = GetStringWithArgs(buff, STR_JUST_RAW_STRING, &tmp_params, last); } else { @@ -1398,8 +1398,8 @@ static char *FormatString(char *buff, co break; } - if (st->name != nullptr) { - int64 args_array[] = {(int64)(size_t)st->name}; + if (!st->name.empty()) { + int64 args_array[] = {(int64)(size_t)st->name.c_str()}; StringParameters tmp_params(args_array); buff = GetStringWithArgs(buff, STR_JUST_RAW_STRING, &tmp_params, last); } else { @@ -1428,8 +1428,8 @@ static char *FormatString(char *buff, co const Town *t = Town::GetIfValid(args->GetInt32(SCC_TOWN_NAME)); if (t == nullptr) break; - if (t->name != nullptr) { - int64 args_array[] = {(int64)(size_t)t->name}; + if (!t->name.empty()) { + int64 args_array[] = {(int64)(size_t)t->name.c_str()}; StringParameters tmp_params(args_array); buff = GetStringWithArgs(buff, STR_JUST_RAW_STRING, &tmp_params, last); } else { @@ -1442,8 +1442,8 @@ static char *FormatString(char *buff, co Waypoint *wp = Waypoint::GetIfValid(args->GetInt32(SCC_WAYPOINT_NAME)); if (wp == nullptr) break; - if (wp->name != nullptr) { - int64 args_array[] = {(int64)(size_t)wp->name}; + if (!wp->name.empty()) { + int64 args_array[] = {(int64)(size_t)wp->name.c_str()}; StringParameters tmp_params(args_array); buff = GetStringWithArgs(buff, STR_JUST_RAW_STRING, &tmp_params, last); } else { @@ -1460,8 +1460,8 @@ static char *FormatString(char *buff, co const Vehicle *v = Vehicle::GetIfValid(args->GetInt32(SCC_VEHICLE_NAME)); if (v == nullptr) break; - if (v->name != nullptr) { - int64 args_array[] = {(int64)(size_t)v->name}; + if (!v->name.empty()) { + int64 args_array[] = {(int64)(size_t)v->name.c_str()}; StringParameters tmp_params(args_array); buff = GetStringWithArgs(buff, STR_JUST_RAW_STRING, &tmp_params, last); } else { @@ -1486,8 +1486,8 @@ static char *FormatString(char *buff, co const Sign *si = Sign::GetIfValid(args->GetInt32()); if (si == nullptr) break; - if (si->name != nullptr) { - int64 args_array[] = {(int64)(size_t)si->name}; + if (!si->name.empty()) { + int64 args_array[] = {(int64)(size_t)si->name.c_str()}; StringParameters tmp_params(args_array); buff = GetStringWithArgs(buff, STR_JUST_RAW_STRING, &tmp_params, last); } else {