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) {
|
plugins_context_->set_accessor("find_level", [this](const config& cfg) {
|
||||||
const std::string id = cfg["id"].str();
|
const std::string id = cfg["id"].str();
|
||||||
|
auto result = create_engine_.find_level_by_id(id);
|
||||||
return config {
|
return config {
|
||||||
"index", create_engine_.find_level_by_id(id).second,
|
"index", result.second,
|
||||||
"type", level_type::get_string(create_engine_.find_level_by_id(id).first),
|
"type", level_type::get_string(result.first),
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue