Lua API: Avoid looking up the requested scenario twice
This commit is contained in:
parent
a1c78edda5
commit
b9d8851338
1 changed files with 3 additions and 2 deletions
|
@ -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),
|
||||
};
|
||||
});
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue