srb2::music::TuneManager::insert: add optional field, to duplicate an existing tune's configuration

This commit is contained in:
James R 2023-12-04 20:17:17 -08:00
parent f7eddffdb4
commit 97a66a1856

View file

@ -44,9 +44,9 @@ public:
return it != map_.end() ? const_cast<Tune*>(&it->second) : nullptr; return it != map_.end() ? const_cast<Tune*>(&it->second) : nullptr;
} }
Tune& insert(const char* id) Tune& insert(const char* id, const Tune* original = nullptr)
{ {
auto res = map_.emplace(id, Tune{}); auto res = map_.emplace(id, original ? *original : Tune{});
SRB2_ASSERT(res.second); SRB2_ASSERT(res.second);