|
|
@ -1,4 +1,4 @@
|
|
|
|
/*
|
|
|
|
/*
|
|
|
|
https://github.com/peterix/dfhack
|
|
|
|
https://github.com/peterix/dfhack
|
|
|
|
Copyright (c) 2009-2011 Petr Mrázek (peterix@gmail.com)
|
|
|
|
Copyright (c) 2009-2011 Petr Mrázek (peterix@gmail.com)
|
|
|
|
|
|
|
|
|
|
|
@ -430,7 +430,7 @@ int32_t Items::getItemOwnerID(const df::item * item)
|
|
|
|
for (uint32_t i = 0; i < item->itemrefs.size(); i++)
|
|
|
|
for (uint32_t i = 0; i < item->itemrefs.size(); i++)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
df::general_ref *ref = item->itemrefs[i];
|
|
|
|
df::general_ref *ref = item->itemrefs[i];
|
|
|
|
if (ref->getType() == df::general_ref_type::unit_itemowner)
|
|
|
|
if (ref->getType() == df::general_ref_type::UNIT_ITEMOWNER)
|
|
|
|
return ref->getID();
|
|
|
|
return ref->getID();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return -1;
|
|
|
|
return -1;
|
|
|
@ -441,7 +441,7 @@ int32_t Items::getItemContainerID(const df::item * item)
|
|
|
|
for (uint32_t i = 0; i < item->itemrefs.size(); i++)
|
|
|
|
for (uint32_t i = 0; i < item->itemrefs.size(); i++)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
df::general_ref *ref = item->itemrefs[i];
|
|
|
|
df::general_ref *ref = item->itemrefs[i];
|
|
|
|
if (ref->getType() == df::general_ref_type::contained_in_item)
|
|
|
|
if (ref->getType() == df::general_ref_type::CONTAINED_IN_ITEM)
|
|
|
|
return ref->getID();
|
|
|
|
return ref->getID();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return -1;
|
|
|
|
return -1;
|
|
|
@ -449,7 +449,7 @@ int32_t Items::getItemContainerID(const df::item * item)
|
|
|
|
|
|
|
|
|
|
|
|
bool Items::getContainedItems(const df::item * item, std::vector<int32_t> &items)
|
|
|
|
bool Items::getContainedItems(const df::item * item, std::vector<int32_t> &items)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
return readItemRefs(item, df::general_ref_type::contains_item, items);
|
|
|
|
return readItemRefs(item, df::general_ref_type::CONTAINS_ITEM, items);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool Items::readItemRefs(const df::item * item, df::general_ref_type type, std::vector<int32_t> &values)
|
|
|
|
bool Items::readItemRefs(const df::item * item, df::general_ref_type type, std::vector<int32_t> &values)
|
|
|
@ -471,7 +471,7 @@ bool Items::removeItemOwner(df::item * item, Units *creatures)
|
|
|
|
for (uint32_t i = 0; i < item->itemrefs.size(); i++)
|
|
|
|
for (uint32_t i = 0; i < item->itemrefs.size(); i++)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
df::general_ref *ref = item->itemrefs[i];
|
|
|
|
df::general_ref *ref = item->itemrefs[i];
|
|
|
|
if (ref->getType() != df::general_ref_type::unit_itemowner)
|
|
|
|
if (ref->getType() != df::general_ref_type::UNIT_ITEMOWNER)
|
|
|
|
continue;
|
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|
|
|
df_unit *unit = (df_unit *)ref->getUnit();
|
|
|
|
df_unit *unit = (df_unit *)ref->getUnit();
|
|
|
|