summaryrefslogtreecommitdiff
path: root/include/space.h
diff options
context:
space:
mode:
authororoborus <oroborus@0ee4d065-81f0-4d1e-b06c-ff20ad07cc3e>2008-06-12 16:36:13 +0000
committeroroborus <oroborus@0ee4d065-81f0-4d1e-b06c-ff20ad07cc3e>2008-06-12 16:36:13 +0000
commit9751218f594526982877332d6ca0fa90b67bbb7b (patch)
tree2acbc70e3d8432bb80ef70470bda75ba93bc2593 /include/space.h
parent4919e623c6695a80aaf96187253756dcbb72bf87 (diff)
- prva cast prepisu kodu pre pozuivanie space_t a space_t API, ktore je optimalizovany pre ukladanie informacii o
objektoch vo velkych mapach. POZOR: nie je vhodne kompilovat ako gameserver ( pre istotu to ani nejde ) // este to msusim doorbit :) git-svn-id: http://opensvn.csie.org/tuxanci_ng@63 0ee4d065-81f0-4d1e-b06c-ff20ad07cc3e
Diffstat (limited to 'include/space.h')
-rw-r--r--include/space.h36
1 files changed, 36 insertions, 0 deletions
diff --git a/include/space.h b/include/space.h
new file mode 100644
index 0000000..8f5ad7c
--- /dev/null
+++ b/include/space.h
@@ -0,0 +1,36 @@
+
+#ifndef SPACE_H
+
+#define SPACE_H
+
+#include "main.h"
+#include "list.h"
+
+typedef struct space_struct
+{
+ int w;
+ int h;
+ int segW;
+ int segH;
+ list_t ***area;
+ list_t *list;
+ void (*getStatus)(void *p, int *id, int *x, int *y, int *w, int *h);
+ void (*setStatus)(void *p, int x, int y, int w, int h);
+} space_t;
+
+extern space_t *newSpace(int w, int h, int segW, int segH,
+ void (*getStatus)(void *p, int *id, int *x, int *y, int *w, int *h),
+ void (*setStatus)(void *p, int x, int y, int w, int h));
+
+extern void addObjectToSpace(space_t *p, void *item);
+extern void getObjectFromSpace(space_t *p, int x, int y, int w, int h, list_t *list);
+extern void* getObjectFromSpaceWithID(space_t *p, int id);
+extern int isConflictWithObjectFromSpace(space_t *p, int x, int y, int w, int h);
+extern void delObjectFromSpace(space_t *p, void *item);
+extern void delObjectFromSpaceWithMem(space_t *p, void *item, void *f);
+extern void moveObjectInSpace(space_t *p, void *item, int move_x, int move_y);
+extern void printSpace(space_t *p);
+extern void destroySpace(space_t *p, void *f);
+
+#endif
+