mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-05-10 12:36:53 +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;
|
return true;
|
||||||
};
|
};
|
||||||
|
|
||||||
bool ok = false;
|
bool ok = true;
|
||||||
sol::optional<uint32_t> typeId = sol::nullopt;
|
if (!type.has_value())
|
||||||
if (type.has_value())
|
cell.mStore->forEach(std::move(visitor));
|
||||||
typeId = ids[*type];
|
else if (ids[*type] == sol::nil)
|
||||||
|
ok = false;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ok = true;
|
uint32_t typeId = ids[*type];
|
||||||
cell.mStore->forEach(std::move(visitor));
|
switch (typeId)
|
||||||
}
|
|
||||||
if (typeId.has_value())
|
|
||||||
{
|
|
||||||
ok = true;
|
|
||||||
switch (*typeId)
|
|
||||||
{
|
{
|
||||||
case ESM::REC_INTERNAL_PLAYER:
|
case ESM::REC_INTERNAL_PLAYER:
|
||||||
{
|
{
|
||||||
|
|
|
@ -112,7 +112,7 @@ namespace MWLua
|
||||||
{
|
{
|
||||||
auto* lua = context.mLua;
|
auto* lua = context.mLua;
|
||||||
sol::table api(lua->sol(), sol::create);
|
sol::table api(lua->sol(), sol::create);
|
||||||
api["API_REVISION"] = 41;
|
api["API_REVISION"] = 42;
|
||||||
api["quit"] = [lua]() {
|
api["quit"] = [lua]() {
|
||||||
Log(Debug::Warning) << "Quit requested by a Lua script.\n" << lua->debugTraceback();
|
Log(Debug::Warning) << "Quit requested by a Lua script.\n" << lua->debugTraceback();
|
||||||
MWBase::Environment::get().getStateManager()->requestQuit();
|
MWBase::Environment::get().getStateManager()->requestQuit();
|
||||||
|
|
|
@ -1,3 +1,6 @@
|
||||||
|
#include <sol/sol.hpp>
|
||||||
|
|
||||||
|
#include "../../mwworld/class.hpp"
|
||||||
|
|
||||||
#include "types.hpp"
|
#include "types.hpp"
|
||||||
|
|
||||||
|
|
|
@ -51,7 +51,7 @@ namespace MWLua
|
||||||
return &mDoorsInScene;
|
return &mDoorsInScene;
|
||||||
if (typeid(cls) == typeid(MWClass::Container))
|
if (typeid(cls) == typeid(MWClass::Container))
|
||||||
return &mContainersInScene;
|
return &mContainersInScene;
|
||||||
if (cls.isItem(ptr))
|
if (cls.isItem(ptr) || ptr.mRef->getType() == ESM::REC_LIGH)
|
||||||
return &mItemsInScene;
|
return &mItemsInScene;
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
-- @field [parent=#nearby] openmw.core#ObjectList doors
|
-- @field [parent=#nearby] openmw.core#ObjectList doors
|
||||||
|
|
||||||
---
|
---
|
||||||
-- Everything that can be picked up in the nearby.
|
-- Everything in the nearby that is derived from @{openmw.types#Item}.
|
||||||
-- @field [parent=#nearby] openmw.core#ObjectList items
|
-- @field [parent=#nearby] openmw.core#ObjectList items
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
|
@ -592,10 +592,11 @@
|
||||||
-- @field #SkillStats skills
|
-- @field #SkillStats skills
|
||||||
|
|
||||||
|
|
||||||
--- @{#Item} functions (all pickable items that can be placed to an inventory or container)
|
--------------------------------------------------------------------------------
|
||||||
|
-- @{#Item} functions (all items that can be placed to an inventory or container)
|
||||||
-- @field [parent=#types] #Item Item
|
-- @field [parent=#types] #Item Item
|
||||||
|
|
||||||
--- Functions for pickable items that can be placed to an inventory or container
|
--- Functions for items that can be placed to an inventory or container
|
||||||
-- @type Item
|
-- @type Item
|
||||||
|
|
||||||
---
|
---
|
||||||
|
@ -607,16 +608,26 @@
|
||||||
---
|
---
|
||||||
-- Get this item's current enchantment charge.
|
-- Get this item's current enchantment charge.
|
||||||
-- @function [parent=#Item] getEnchantmentCharge
|
-- @function [parent=#Item] getEnchantmentCharge
|
||||||
-- @param #Item item
|
-- @param openmw.core#GameObject item
|
||||||
-- @return #number The charge remaining. -1 if the enchantment has never been used, implying the charge is full. Unenchanted items will always return a value of -1.
|
-- @return #number The charge remaining. -1 if the enchantment has never been used, implying the charge is full. Unenchanted items will always return a value of -1.
|
||||||
|
|
||||||
---
|
---
|
||||||
-- Set this item's enchantment charge.
|
-- Set this item's enchantment charge.
|
||||||
-- @function [parent=#Item] setEnchantmentCharge
|
-- @function [parent=#Item] setEnchantmentCharge
|
||||||
-- @param #Item item
|
-- @param openmw.core#GameObject item
|
||||||
-- @param #number charge
|
-- @param #number charge
|
||||||
|
|
||||||
--- @{#Creature} functions
|
---
|
||||||
|
-- Whether the object is supposed to be carriable. It is true for all items except
|
||||||
|
-- lights without the Carry flag. Non-carriable lights can still be put into
|
||||||
|
-- an inventory with an explicit `object:moveInto` call.
|
||||||
|
-- @function [parent=#Item] isCarriable
|
||||||
|
-- @param openmw.core#GameObject object
|
||||||
|
-- @return #boolean
|
||||||
|
|
||||||
|
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
-- @{#Creature} functions
|
||||||
-- @field [parent=#types] #Creature Creature
|
-- @field [parent=#types] #Creature Creature
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue