From b32aa4307330553e45d5a0dba149cb5fda834249 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Fri, 28 Nov 2014 16:51:09 +0300 Subject: Add empty extension object to npc. --- src/Makefile.am | 2 ++ src/map/data/npcd.c | 36 ++++++++++++++++++++++++++++++++++++ src/map/data/npcd.h | 12 ++++++++++++ src/map/struct/npcdext.h | 11 +++++++++++ 4 files changed, 61 insertions(+) create mode 100644 src/map/data/npcd.c create mode 100644 src/map/data/npcd.h create mode 100644 src/map/struct/npcdext.h diff --git a/src/Makefile.am b/src/Makefile.am index 514a0b7..a4956e2 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -34,9 +34,11 @@ MAP_SRC = map/clif.c \ map/send.h \ map/data/mapd.c \ map/data/mapd.h \ + map/data/npcd.h \ map/data/session.c \ map/data/session.h \ map/struct/mapdext.h \ + map/struct/npcdext.h \ map/struct/sessionext.h \ map/utils/formatutils.c \ map/utils/formatutils.h \ diff --git a/src/map/data/npcd.c b/src/map/data/npcd.c new file mode 100644 index 0000000..8d770e7 --- /dev/null +++ b/src/map/data/npcd.c @@ -0,0 +1,36 @@ +// Copyright (c) Copyright (c) Hercules Dev Team, licensed under GNU GPL. +// Copyright (c) 2014 Evol developers + +#include +#include +#include + +#include "../../../common/HPMi.h" +#include "../../../common/malloc.h" +#include "../../../common/mmo.h" +#include "../../../common/socket.h" +#include "../../../common/strlib.h" + +#include "map/data/npcd.h" +#include "map/struct/npcdext.h" + +struct NpcdExt *mapd_get(npc_data *nd) +{ + struct NpcdExt *data = getFromNPCD(nd, 0); + if (!data) + { + data = mapd_create(); + addToNPCD(nd, data, 0, true); + } + return data; +} + +struct NpcdExt *mapd_create(void) +{ + struct NpcdExt *data = NULL; + CREATE(data, struct NpcdExt, 1); + if (!data) + return NULL; +// data->x = y; + return data; +} diff --git a/src/map/data/npcd.h b/src/map/data/npcd.h new file mode 100644 index 0000000..dacd861 --- /dev/null +++ b/src/map/data/npcd.h @@ -0,0 +1,12 @@ +// Copyright (c) Copyright (c) Hercules Dev Team, licensed under GNU GPL. +// Copyright (c) 2014 Evol developers + +#ifndef EVOL_MAP_NPCD +#define EVOL_MAP_NPCD + +struct NpcdExt; + +struct NpcdExt *npcd_get(int fd); +struct NpcdExt *npcd_create(void); + +#endif // EVOL_MAP_NPCD diff --git a/src/map/struct/npcdext.h b/src/map/struct/npcdext.h new file mode 100644 index 0000000..11f9752 --- /dev/null +++ b/src/map/struct/npcdext.h @@ -0,0 +1,11 @@ +// Copyright (c) Copyright (c) Hercules Dev Team, licensed under GNU GPL. +// Copyright (c) 2014 Evol developers + +#ifndef EVOL_MAP_NPCDEXT +#define EVOL_MAP_NPCDEXT + +struct NpcdExt +{ +}; + +#endif // EVOL_MAP_NPCDEXT -- cgit v1.2.3-70-g09d2