1
0
Fork 0

Codechange: Make use of emplace_back's return value. (#13879)

pull/13882/head
Peter Nelson 2025-03-23 18:34:04 +00:00 committed by GitHub
parent 5aa4ad5135
commit 42eb513897
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 6 additions and 6 deletions

View File

@ -301,8 +301,8 @@ void GameStrings::Compile()
translation_reader.ParseFile();
if (_errors != 0) throw std::exception();
this->compiled_strings.emplace_back(p.language);
TranslationWriter writer(this->compiled_strings.back().lines);
auto &strings = this->compiled_strings.emplace_back(p.language);
TranslationWriter writer(strings.lines);
writer.WriteLang(data);
}
}

View File

@ -786,8 +786,8 @@ struct MpsMachine {
this->tempo_ticks = this->current_tempo;
/* Always reset percussion channel to program 0 */
this->target.blocks.push_back(MidiFile::DataBlock());
AddMidiData(this->target.blocks.back(), MIDIST_PROGCHG + 9, 0x00);
auto &data_block = this->target.blocks.emplace_back();
AddMidiData(data_block, MIDIST_PROGCHG + 9, 0x00);
/* Technically should be an endless loop, but having
* a maximum (about 10 minutes) avoids getting stuck,

View File

@ -86,8 +86,8 @@ public:
/* Edge data is now a simple vector and not any kind of matrix. */
size_t size = SlGetStructListLength(UINT16_MAX);
for (size_t i = 0; i < size; i++) {
bn->edges.emplace_back();
SlObject(&bn->edges.back(), this->GetLoadDescription());
auto &edge = bn->edges.emplace_back();
SlObject(&edge, this->GetLoadDescription());
}
}
}