1
0
Fork 0

Codechange: Make use of emplace_back's return value.

pull/13879/head
Peter Nelson 2025-03-19 23:50:05 +00:00
parent 828e808444
commit 4cbb23f6ad
No known key found for this signature in database
GPG Key ID: 8EF8F0A467DF75ED
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());
}
}
}