summaryrefslogtreecommitdiff
path: root/src/emap/craft.c
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2016-01-12 01:48:43 +0300
committerAndrei Karas <akaras@inbox.ru>2016-01-12 01:48:43 +0300
commit32edcdcf47c804d0bb40299fad5d184b558bb76c (patch)
tree279589abd15ec4d939cf251125ea29aee035596a /src/emap/craft.c
parent0055aac688833a01cbe2b3e6b951bb162a80b474 (diff)
downloadevol-hercules-32edcdcf47c804d0bb40299fad5d184b558bb76c.tar.gz
evol-hercules-32edcdcf47c804d0bb40299fad5d184b558bb76c.tar.bz2
evol-hercules-32edcdcf47c804d0bb40299fad5d184b558bb76c.tar.xz
evol-hercules-32edcdcf47c804d0bb40299fad5d184b558bb76c.zip
Add script command for get item id from one craft slot.
New script command: getcraftslotid id, slot
Diffstat (limited to 'src/emap/craft.c')
-rw-r--r--src/emap/craft.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/emap/craft.c b/src/emap/craft.c
index c790836..8ad8633 100644
--- a/src/emap/craft.c
+++ b/src/emap/craft.c
@@ -274,3 +274,19 @@ void craft_delete(const int id)
delete_craft_var(craft);
idb_remove(craftvar_db, id);
}
+
+struct craft_slot *craft_get_slot(const int id, const int slot)
+{
+ struct craft_vardata *craft = idb_get(craftvar_db, id);
+ if (!craft)
+ {
+ ShowError("Craft object with id %d not exists.\n", id);
+ return NULL;
+ }
+ if (slot < 0 || slot > craft_inventory_size)
+ {
+ ShowError("Wrong slot %d for craft with id %d.\n", slot, id);
+ return NULL;
+ }
+ return &craft->slots[slot];
+}