diff options
author | Michael Lutz <michi@icosahedron.de> | 2020-05-17 23:31:47 +0200 |
---|---|---|
committer | Michael Lutz <michi@icosahedron.de> | 2020-05-21 20:02:34 +0200 |
commit | 43cd892e0c2c012355d7eb6d47cfa4ad4b7e68eb (patch) | |
tree | 589c8791baba745a7dfc3a33b19a28c8b0046ea8 /src/newgrf.cpp | |
parent | f2b40f40aa7cbccaed20ec52b41d4704a45d8db1 (diff) | |
download | openttd-43cd892e0c2c012355d7eb6d47cfa4ad4b7e68eb.tar.xz |
Codechange: Replace custom linked list for GRF texts with STL vectors and strings.
Diffstat (limited to 'src/newgrf.cpp')
-rw-r--r-- | src/newgrf.cpp | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/src/newgrf.cpp b/src/newgrf.cpp index c1b836481..4ada53a0a 100644 --- a/src/newgrf.cpp +++ b/src/newgrf.cpp @@ -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); } |