diff options
Diffstat (limited to 'src/map')
-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 |
3 files changed, 65 insertions, 0 deletions
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 |