Lua API: Avoid looking up the requested scenario twice

This commit is contained in:
Celtic Minstrel 2024-09-15 00:37:50 -04:00
parent a1c78edda5
commit b9d8851338

View file

@ -416,9 +416,10 @@ void mp_create_game::pre_show()
plugins_context_->set_accessor("find_level", [this](const config& cfg) {
const std::string id = cfg["id"].str();
auto result = create_engine_.find_level_by_id(id);
return config {
"index", create_engine_.find_level_by_id(id).second,
"type", level_type::get_string(create_engine_.find_level_by_id(id).first),
"index", result.second,
"type", level_type::get_string(result.first),
};
});