Codechange: Replace custom linked list for GRF texts with STL vectors and strings.
This commit is contained in:
@@ -6720,11 +6720,11 @@ static void ScanInfo(ByteReader *buf)
|
||||
/* GRF IDs starting with 0xFF are reserved for internal TTDPatch use */
|
||||
if (GB(grfid, 0, 8) == 0xFF) SetBit(_cur.grfconfig->flags, GCF_SYSTEM);
|
||||
|
||||
AddGRFTextToList(&_cur.grfconfig->name->text, 0x7F, grfid, false, name);
|
||||
AddGRFTextToList(_cur.grfconfig->name, 0x7F, grfid, false, name);
|
||||
|
||||
if (buf->HasData()) {
|
||||
const char *info = buf->ReadString();
|
||||
AddGRFTextToList(&_cur.grfconfig->info->text, 0x7F, grfid, true, info);
|
||||
AddGRFTextToList(_cur.grfconfig->info, 0x7F, grfid, true, info);
|
||||
}
|
||||
|
||||
/* GLS_INFOSCAN only looks for the action 8, so we can skip the rest of the file */
|
||||
@@ -7806,21 +7806,21 @@ static void TranslateGRFStrings(ByteReader *buf)
|
||||
/** Callback function for 'INFO'->'NAME' to add a translation to the newgrf name. */
|
||||
static bool ChangeGRFName(byte langid, const char *str)
|
||||
{
|
||||
AddGRFTextToList(&_cur.grfconfig->name->text, langid, _cur.grfconfig->ident.grfid, false, str);
|
||||
AddGRFTextToList(_cur.grfconfig->name, langid, _cur.grfconfig->ident.grfid, false, str);
|
||||
return true;
|
||||
}
|
||||
|
||||
/** Callback function for 'INFO'->'DESC' to add a translation to the newgrf description. */
|
||||
static bool ChangeGRFDescription(byte langid, const char *str)
|
||||
{
|
||||
AddGRFTextToList(&_cur.grfconfig->info->text, langid, _cur.grfconfig->ident.grfid, true, str);
|
||||
AddGRFTextToList(_cur.grfconfig->info, langid, _cur.grfconfig->ident.grfid, true, str);
|
||||
return true;
|
||||
}
|
||||
|
||||
/** Callback function for 'INFO'->'URL_' to set the newgrf url. */
|
||||
static bool ChangeGRFURL(byte langid, const char *str)
|
||||
{
|
||||
AddGRFTextToList(&_cur.grfconfig->url->text, langid, _cur.grfconfig->ident.grfid, false, str);
|
||||
AddGRFTextToList(_cur.grfconfig->url, langid, _cur.grfconfig->ident.grfid, false, str);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -7922,14 +7922,14 @@ static GRFParameterInfo *_cur_parameter; ///< The parameter which info is curren
|
||||
/** Callback function for 'INFO'->'PARAM'->param_num->'NAME' to set the name of a parameter. */
|
||||
static bool ChangeGRFParamName(byte langid, const char *str)
|
||||
{
|
||||
AddGRFTextToList(&_cur_parameter->name, langid, _cur.grfconfig->ident.grfid, false, str);
|
||||
AddGRFTextToList(_cur_parameter->name, langid, _cur.grfconfig->ident.grfid, false, str);
|
||||
return true;
|
||||
}
|
||||
|
||||
/** Callback function for 'INFO'->'PARAM'->param_num->'DESC' to set the description of a parameter. */
|
||||
static bool ChangeGRFParamDescription(byte langid, const char *str)
|
||||
{
|
||||
AddGRFTextToList(&_cur_parameter->desc, langid, _cur.grfconfig->ident.grfid, true, str);
|
||||
AddGRFTextToList(_cur_parameter->desc, langid, _cur.grfconfig->ident.grfid, true, str);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -8113,12 +8113,12 @@ static bool ChangeGRFParamValueNames(ByteReader *buf)
|
||||
byte langid = buf->ReadByte();
|
||||
const char *name_string = buf->ReadString();
|
||||
|
||||
std::pair<uint32, GRFText *> *val_name = _cur_parameter->value_names.Find(id);
|
||||
std::pair<uint32, GRFTextList> *val_name = _cur_parameter->value_names.Find(id);
|
||||
if (val_name != _cur_parameter->value_names.End()) {
|
||||
AddGRFTextToList(&val_name->second, langid, _cur.grfconfig->ident.grfid, false, name_string);
|
||||
AddGRFTextToList(val_name->second, langid, _cur.grfconfig->ident.grfid, false, name_string);
|
||||
} else {
|
||||
GRFText *list = nullptr;
|
||||
AddGRFTextToList(&list, langid, _cur.grfconfig->ident.grfid, false, name_string);
|
||||
GRFTextList list;
|
||||
AddGRFTextToList(list, langid, _cur.grfconfig->ident.grfid, false, name_string);
|
||||
_cur_parameter->value_names.Insert(id, list);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user