Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 16 additions & 2 deletions src/lua/creature/movement.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -808,6 +808,13 @@ uint32_t MoveEvent::fireAddRemItem(const std::shared_ptr<Item> &item, const std:
if (isLoadedScriptId()) {
return executeAddRemItem(item, fromTile, pos);
} else {
if (!moveFunction) {
g_logger().error("[MoveEvent::fireAddRemItem - Item {} item on position: {}] "
"Move function is nullptr.",
item->getName(), pos.toString());
return 0;
}

return moveFunction(item, fromTile, pos);
}
}
Expand Down Expand Up @@ -840,6 +847,13 @@ uint32_t MoveEvent::fireAddRemItem(const std::shared_ptr<Item> &item, const Posi
if (isLoadedScriptId()) {
return executeAddRemItem(item, pos);
} else {
if (!moveFunction) {
g_logger().error("[MoveEvent::fireAddRemItem - Item {} item on position: {}] "
"Move function is nullptr.",
item->getName(), pos.toString());
return 0;
}

return moveFunction(item, nullptr, pos);
}
}
Expand All @@ -849,9 +863,9 @@ bool MoveEvent::executeAddRemItem(const std::shared_ptr<Item> &item, const Posit
// onRemoveItem(moveitem, pos)
if (!LuaScriptInterface::reserveScriptEnv()) {
g_logger().error("[MoveEvent::executeAddRemItem - "
"Item {} item on tile x: {} y: {} z: {}] "
"Item {} item on position: {}] "
"Call stack overflow. Too many lua script calls being nested.",
item->getName(), pos.getX(), pos.getY(), pos.getZ());
item->getName(), pos.toString());
return false;
}

Expand Down