Skip to content

Commit

Permalink
Merge pull request #4368 from myk002/myk_use_mode
Browse files Browse the repository at this point in the history
use new building item mode enum
  • Loading branch information
myk002 authored Mar 14, 2024
2 parents 1c1b1bf + ef16e3c commit cf5b83e
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion library/LuaApi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2335,7 +2335,7 @@ static int items_moveToBuilding(lua_State *state)
MapExtras::MapCache mc;
auto item = Lua::CheckDFObject<df::item>(state, 1);
auto building = Lua::CheckDFObject<df::building_actual>(state, 2);
int use_mode = luaL_optint(state, 3, 0);
df::building_item_role_type use_mode = (df::building_item_role_type)luaL_optint(state, 3, 0);
bool force_in_building = lua_toboolean(state, 4);
lua_pushboolean(state, Items::moveToBuilding(mc, item, building, use_mode, force_in_building));
return 1;
Expand Down
3 changes: 2 additions & 1 deletion library/include/modules/Items.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ distribution.

#include "modules/Materials.h"

#include "df/building_item_role_type.h"
#include "df/item_type.h"
#include "df/job_item_vector_id.h"
#include "df/specific_ref.h"
Expand Down Expand Up @@ -155,7 +156,7 @@ DFHACK_EXPORT std::string getDescription(df::item *item, int type = 0, bool deco
DFHACK_EXPORT bool moveToGround(MapExtras::MapCache &mc, df::item *item, df::coord pos);
DFHACK_EXPORT bool moveToContainer(MapExtras::MapCache &mc, df::item *item, df::item *container);
DFHACK_EXPORT bool moveToBuilding(MapExtras::MapCache &mc, df::item *item, df::building_actual *building,
int16_t use_mode = 0, bool force_in_building = false);
df::building_item_role_type use_mode = df::building_item_role_type::TEMP, bool force_in_building = false);
DFHACK_EXPORT bool moveToInventory(MapExtras::MapCache &mc, df::item *item, df::unit *unit,
df::unit_inventory_item::T_mode mode = df::unit_inventory_item::Hauled, int body_part = -1);

Expand Down
2 changes: 1 addition & 1 deletion library/modules/Items.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1057,7 +1057,7 @@ bool DFHack::Items::moveToContainer(MapExtras::MapCache &mc, df::item *item, df:
}

bool DFHack::Items::moveToBuilding(MapExtras::MapCache &mc, df::item *item, df::building_actual *building,
int16_t use_mode, bool force_in_building)
df::building_item_role_type use_mode, bool force_in_building)
{
CHECK_NULL_POINTER(item);
CHECK_NULL_POINTER(building);
Expand Down
2 changes: 1 addition & 1 deletion library/xml
Submodule xml updated 1 files
+6 −1 df.buildings.xml
2 changes: 1 addition & 1 deletion plugins/createitem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ bool makeItem (df::reaction_product_itemst *prod, df::unit *unit, bool second_it
else if (building)
{
out_items[i]->flags.bits.removed = 1;
if (!Items::moveToBuilding(mc, out_items[i], (df::building_actual *)building, 0))
if (!Items::moveToBuilding(mc, out_items[i], (df::building_actual *)building, df::building_item_role_type::TEMP))
out_items[i]->moveToGround(building->centerx, building->centery, building->z);
}
else if (move_to_cursor)
Expand Down
2 changes: 1 addition & 1 deletion scripts

0 comments on commit cf5b83e

Please sign in to comment.