mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-05-10 20:46:55 +03:00
Merge branch 'fix_getall' into 'master'
Fix argument validation in Lua command `cell:getAll` See merge request OpenMW/openmw!3195
This commit is contained in:
commit
f4295cf67a
6 changed files with 29 additions and 19 deletions
|
@ -88,19 +88,15 @@ namespace MWLua
|
|||
return true;
|
||||
};
|
||||
|
||||
bool ok = false;
|
||||
sol::optional<uint32_t> typeId = sol::nullopt;
|
||||
if (type.has_value())
|
||||
typeId = ids[*type];
|
||||
bool ok = true;
|
||||
if (!type.has_value())
|
||||
cell.mStore->forEach(std::move(visitor));
|
||||
else if (ids[*type] == sol::nil)
|
||||
ok = false;
|
||||
else
|
||||
{
|
||||
ok = true;
|
||||
cell.mStore->forEach(std::move(visitor));
|
||||
}
|
||||
if (typeId.has_value())
|
||||
{
|
||||
ok = true;
|
||||
switch (*typeId)
|
||||
uint32_t typeId = ids[*type];
|
||||
switch (typeId)
|
||||
{
|
||||
case ESM::REC_INTERNAL_PLAYER:
|
||||
{
|
||||
|
|
|
@ -112,7 +112,7 @@ namespace MWLua
|
|||
{
|
||||
auto* lua = context.mLua;
|
||||
sol::table api(lua->sol(), sol::create);
|
||||
api["API_REVISION"] = 41;
|
||||
api["API_REVISION"] = 42;
|
||||
api["quit"] = [lua]() {
|
||||
Log(Debug::Warning) << "Quit requested by a Lua script.\n" << lua->debugTraceback();
|
||||
MWBase::Environment::get().getStateManager()->requestQuit();
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
#include <sol/sol.hpp>
|
||||
|
||||
#include "../../mwworld/class.hpp"
|
||||
|
||||
#include "types.hpp"
|
||||
|
||||
|
|
|
@ -51,7 +51,7 @@ namespace MWLua
|
|||
return &mDoorsInScene;
|
||||
if (typeid(cls) == typeid(MWClass::Container))
|
||||
return &mContainersInScene;
|
||||
if (cls.isItem(ptr))
|
||||
if (cls.isItem(ptr) || ptr.mRef->getType() == ESM::REC_LIGH)
|
||||
return &mItemsInScene;
|
||||
return nullptr;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue