diff options
-rw-r--r-- | src/Makefile.am | 3 | ||||
-rw-r--r-- | src/map/data/itemd.c | 41 | ||||
-rw-r--r-- | src/map/data/itemd.h | 12 | ||||
-rw-r--r-- | src/map/struct/itemdext.h | 12 |
4 files changed, 68 insertions, 0 deletions
diff --git a/src/Makefile.am b/src/Makefile.am index ec78719..3f6c504 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -44,12 +44,15 @@ MAP_SRC = map/clif.c \ map/send.h \ map/status.c \ map/status.h \ + map/data/itemd.c \ + map/data/itemd.h \ map/data/mapd.c \ map/data/mapd.h \ map/data/npcd.c \ map/data/npcd.h \ map/data/session.c \ map/data/session.h \ + map/struct/itemdext.h \ map/struct/mapdext.h \ map/struct/npcdext.h \ map/struct/sessionext.h \ diff --git a/src/map/data/itemd.c b/src/map/data/itemd.c new file mode 100644 index 0000000..a862617 --- /dev/null +++ b/src/map/data/itemd.c @@ -0,0 +1,41 @@ +// Copyright (c) Copyright (c) Hercules Dev Team, licensed under GNU GPL. +// Copyright (c) 2014 Evol developers + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> + +#include "../../../common/HPMi.h" +#include "../../../common/malloc.h" +#include "../../../common/mmo.h" +#include "../../../common/socket.h" +#include "../../../common/strlib.h" +#include "../../../map/battle.h" +#include "../../../map/itemdb.h" + +#include "map/data/itemd.h" +#include "map/struct/itemdext.h" + +struct ItemdExt *itemd_get(struct item_data *item) +{ + if (!item) + return NULL; + + struct ItemdExt *data = getFromITEMDATA(item, 0); + if (!data) + { + data = itemd_create(); + addToITEMDATA(item, data, 0, true); + } + return data; +} + +struct ItemdExt *itemd_create(void) +{ + struct ItemdExt *data = NULL; + CREATE(data, struct ItemdExt, 1); + if (!data) + return NULL; + data->floorLifeTime = battle->bc->flooritem_lifetime; + return data; +} diff --git a/src/map/data/itemd.h b/src/map/data/itemd.h new file mode 100644 index 0000000..611d6cd --- /dev/null +++ b/src/map/data/itemd.h @@ -0,0 +1,12 @@ +// Copyright (c) Copyright (c) Hercules Dev Team, licensed under GNU GPL. +// Copyright (c) 2014 Evol developers + +#ifndef EVOL_MAP_ITEMD +#define EVOL_MAP_ITEMD + +struct ItemdExt; + +struct ItemdExt *itemd_get(struct item_data *item); +struct ItemdExt *itemd_create(void); + +#endif // EVOL_MAP_MAPD diff --git a/src/map/struct/itemdext.h b/src/map/struct/itemdext.h new file mode 100644 index 0000000..837f5bb --- /dev/null +++ b/src/map/struct/itemdext.h @@ -0,0 +1,12 @@ +// Copyright (c) Copyright (c) Hercules Dev Team, licensed under GNU GPL. +// Copyright (c) 2014 Evol developers + +#ifndef EVOL_MAP_ITEMDEXT +#define EVOL_MAP_ITEMDEXT + +struct ItemdExt +{ + int floorLifeTime; +}; + +#endif // EVOL_MAP_ITEMDEXT |