1
0
mirror of https://github.com/OpenTTD/OpenTTD synced 2026-01-23 04:04:09 +01:00

Codechange: Replace atoi and atoll with ParseInteger.

This commit is contained in:
frosch
2025-04-29 16:12:54 +02:00
committed by frosch
parent 3973199879
commit cdafc50c94
17 changed files with 108 additions and 47 deletions

View File

@@ -134,7 +134,12 @@ bool MusicSet::FillSetDetails(const IniFile &ini, const std::string &path, const
if (item != nullptr && item->value.has_value() && !item->value->empty()) {
/* Song has a CAT file index, assume it's MPS MIDI format */
this->songinfo[i].filetype = MTT_MPSMIDI;
this->songinfo[i].cat_index = atoi(item->value->c_str());
auto value = ParseInteger(*item->value);
if (!value.has_value()) {
Debug(grf, 0, "Invalid base music set song index: {}/{}", filename, *item->value);
continue;
}
this->songinfo[i].cat_index = *value;
auto songname = GetMusicCatEntryName(filename, this->songinfo[i].cat_index);
if (!songname.has_value()) {
Debug(grf, 0, "Base music set song missing from CAT file: {}/{}", filename, this->songinfo[i].cat_index);