diff options
author | shennetsind <ind@henn.et> | 2013-05-30 21:00:22 -0300 |
---|---|---|
committer | shennetsind <ind@henn.et> | 2013-05-30 21:00:22 -0300 |
commit | 20bdc01fa687b174a732be4483ddea4982d67ce9 (patch) | |
tree | 3336c1c449a78d52d25d2534acbd319d10c56b45 /src/map/instance.h | |
parent | 21bbfad48084190b8a6881ee3b277993418a5137 (diff) | |
download | hercules-20bdc01fa687b174a732be4483ddea4982d67ce9.tar.gz hercules-20bdc01fa687b174a732be4483ddea4982d67ce9.tar.bz2 hercules-20bdc01fa687b174a732be4483ddea4982d67ce9.tar.xz hercules-20bdc01fa687b174a732be4483ddea4982d67ce9.zip |
Memory Slasher - May 30 Patch
http://hercules.ws/board/topic/928-memory-slasher-may-30-patch/
Signed-off-by: shennetsind <ind@henn.et>
Diffstat (limited to 'src/map/instance.h')
-rw-r--r-- | src/map/instance.h | 76 |
1 files changed, 48 insertions, 28 deletions
diff --git a/src/map/instance.h b/src/map/instance.h index 03b0d0898..e86586e44 100644 --- a/src/map/instance.h +++ b/src/map/instance.h @@ -1,51 +1,71 @@ -// Copyright (c) Athena Dev Teams - Licensed under GNU GPL -// For more information, see LICENCE in the main folder +// Copyright (c) Hercules Dev Team, licensed under GNU GPL. +// See the LICENSE file +// Portions Copyright (c) Athena Dev Teams #ifndef _INSTANCE_H_ #define _INSTANCE_H_ -#define MAX_MAP_PER_INSTANCE 10 -#define MAX_INSTANCE 500 - #define INSTANCE_NAME_LENGTH (60+1) -typedef enum instance_state { INSTANCE_FREE, INSTANCE_IDLE, INSTANCE_BUSY } instance_state; +typedef enum instance_state { + INSTANCE_FREE, + INSTANCE_IDLE, + INSTANCE_BUSY +} instance_state; + +enum instance_owner_type { + IOT_NONE, + IOT_CHAR, + IOT_PARTY, + IOT_GUILD, + /* ... */ + IOT_MAX, +}; -struct s_instance { +struct instance_data { + unsigned short id; char name[INSTANCE_NAME_LENGTH]; // Instance Name - required for clif functions. instance_state state; - short instance_id; - int party_id; + enum instance_owner_type owner_type; + int owner_id; - int map[MAX_MAP_PER_INSTANCE]; - int num_map; - int users; + unsigned short *map; + unsigned short num_map; + unsigned short users; struct DBMap* vars; // Instance Variable for scripts int progress_timer; - time_t progress_timeout; + unsigned int progress_timeout; int idle_timer; - time_t idle_timeout, idle_timeoutval; + unsigned int idle_timeout, idle_timeoutval; }; -extern int instance_start; -extern struct s_instance instance[MAX_INSTANCE]; +struct instance_data *instances; -int instance_create(int party_id, const char *name); -int instance_add_map(const char *name, int instance_id, bool usebasename); -void instance_del_map(int16 m); -int instance_map2imap(int16 m, int instance_id); -int instance_mapid2imapid(int16 m, int instance_id); -void instance_destroy(int instance_id); -void instance_init(int instance_id); +struct instance_interface { + void (*init) (void); + void (*final) (void); + /* start point */ + unsigned short start_id; + unsigned short instances; + /* */ + int (*create) (int party_id, const char *name, enum instance_owner_type type); + int (*add_map) (const char *name, int instance_id, bool usebasename, const char *map_name); + void (*del_map) (int16 m); + int (*map2imap) (int16 m, int instance_id); + int (*mapid2imapid) (int16 m, int instance_id); + void (*destroy) (int instance_id); + void (*start) (int instance_id); + void (*check_idle) (int instance_id); + void (*check_kick) (struct map_session_data *sd); + void (*set_timeout) (int instance_id, unsigned int progress_timeout, unsigned int idle_timeout); + bool (*valid) (int instance_id); +} instance_s; -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); +struct instance_interface *instance; -void do_final_instance(void); -void do_init_instance(void); +void instance_defaults(void); #endif |