summaryrefslogtreecommitdiff
path: root/src/map/instance.h
diff options
context:
space:
mode:
authorzephyrus <zephyrus@54d463be-8e91-2dee-dedb-b68131a5f0ec>2009-08-12 21:44:02 +0000
committerzephyrus <zephyrus@54d463be-8e91-2dee-dedb-b68131a5f0ec>2009-08-12 21:44:02 +0000
commit09e154b0687a2ba69d5ce6f2456c61db86bc4dec (patch)
tree6be18bd056964352e036afef8c36c860c0ff52af /src/map/instance.h
parent653c88c4f1bf019f61132324fd7146ae2f858cec (diff)
downloadhercules-09e154b0687a2ba69d5ce6f2456c61db86bc4dec.tar.gz
hercules-09e154b0687a2ba69d5ce6f2456c61db86bc4dec.tar.bz2
hercules-09e154b0687a2ba69d5ce6f2456c61db86bc4dec.tar.xz
hercules-09e154b0687a2ba69d5ce6f2456c61db86bc4dec.zip
- Optimization to instance system.
* Removed the crc feature to generate instance npc names. The instance npc name will be "dup_" + instanceid + "_" + srcnpcid. * Removed the big array under map structure and coded in a different way. It was only used to generate map names, but i just used the instance_id + "origin map name". * Moved all instance features to separated files. * Moved the npc duplication for instances into npc.c as Ultramage says (removed npcname_db from npc.h). * Added recomendations for scripts commands by Saithis. - Testing required, i will prepare Endless Tower script soon. I hope this do almost anything in bugreport 3276. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@14003 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map/instance.h')
-rw-r--r--src/map/instance.h48
1 files changed, 48 insertions, 0 deletions
diff --git a/src/map/instance.h b/src/map/instance.h
new file mode 100644
index 000000000..a98117c57
--- /dev/null
+++ b/src/map/instance.h
@@ -0,0 +1,48 @@
+// Copyright (c) Athena Dev Teams - Licensed under GNU GPL
+// For more information, see LICENCE in the main folder
+
+#ifndef _INSTANCE_H_
+#define _INSTANCE_H_
+
+#define MAX_MAP_PER_INSTANCE 10
+#define MAX_INSTANCE 500
+
+typedef enum instance_state { INSTANCE_FREE, INSTANCE_IDLE, INSTANCE_BUSSY } instance_state;
+
+struct s_instance {
+ char name[61]; // Instance Name - required for clif functions.
+ instance_state state;
+ short instance_id;
+ int party_id;
+
+ int map[MAX_MAP_PER_INSTANCE];
+ int num_map;
+ int users;
+
+ struct linkdb_node *ivar, *svar; // Instance Variable for scripts
+
+ int progress_timer;
+ time_t progress_timeout, progress_timeoutval;
+
+ int idle_timer;
+ time_t idle_timeout, idle_timeoutval;
+};
+
+extern int instance_start;
+extern struct s_instance instance[MAX_INSTANCE];
+
+int instance_create(int party_id, const char *name);
+int instance_add_map(const char *name, int instance_id);
+void instance_del_map(int m);
+int instance_map2imap(int m, int party_id, int type);
+int instance_mapid2imapid(int m, int instance_id);
+void instance_destroy(int instance_id);
+void instance_init(int instance_id);
+
+void instance_check_idle(int instance_id);
+void instance_check_kick(struct map_session_data *sd);
+void instance_set_timeout(int instance_id, unsigned int progress_timeout, unsigned int idle_timeout);
+
+void do_init_instance();
+
+#endif