Expanded instance_db to include idle time

* Follow up to c97be60.
* Adjusted the instance_db to allow instance idle time to be adjustable.
This commit is contained in:
aleos89 2016-05-14 12:06:04 -04:00
parent 8f7d2208a9
commit cb703c5bfa
4 changed files with 24 additions and 25 deletions

View File

@ -1,5 +1,5 @@
// Instance Database
//
// Structure of Database:
// ID,Name,LimitTime,EnterMap,EnterX,EnterY,Map1,Map2,Map3,Map4,Map5,Map6,Map7,Map8
// ID,Name,LimitTime,IdleTimeout,EnterMap,EnterX,EnterY,Map1,Map2,Map3,Map4,Map5,Map6,Map7,Map8

View File

@ -1,9 +1,9 @@
// Instance Database
//
// Structure of Database:
// ID,Name,LimitTime,EnterMap,EnterX,EnterY,Map1,Map2,Map3,Map4,Map5,Map6,Map7,Map8
// ID,Name,LimitTime,IdleTimeout,EnterMap,EnterX,EnterY,Map1,Map2,Map3,Map4,Map5,Map6,Map7,Map8
1,Endless Tower,14400,1@tower,50,355,1@tower,2@tower,3@tower,4@tower,5@tower,6@tower
2,Sealed Catacomb,7200,1@cata,100,224,1@cata,2@cata
3,Orc's Memory,3600,1@orcs,179,15,1@orcs,2@orcs
4,Nidhoggur's Nest,14400,1@nyd,32,36,1@nyd,2@nyd
1,Endless Tower,14400,300,1@tower,50,355,1@tower,2@tower,3@tower,4@tower,5@tower,6@tower
2,Sealed Catacomb,7200,300,1@cata,100,224,1@cata,2@cata
3,Orc's Memory,3600,300,1@orcs,179,15,1@orcs,2@orcs
4,Nidhoggur's Nest,14400,300,1@nyd,32,36,1@nyd,2@nyd

View File

@ -1,18 +1,18 @@
// Instance Database
//
// Structure of Database:
// ID,Name,LimitTime,EnterMap,EnterX,EnterY,Map1,Map2,Map3,Map4,Map5,Map6,Map7,Map8
// ID,Name,LimitTime,IdleTime,EnterMap,EnterX,EnterY,Map1,Map2,Map3,Map4,Map5,Map6,Map7,Map8
1,Endless Tower,14400,1@tower,50,355,1@tower,2@tower,3@tower,4@tower,5@tower,6@tower
2,Sealed Catacomb,7200,1@cata,100,224,1@cata,2@cata
3,Orc's Memory,3600,1@orcs,179,15,1@orcs,2@orcs
4,Nidhoggur's Nest,14400,1@nyd,32,36,1@nyd,2@nyd
5,Mistwood Maze,7200,1@mist,89,29,1@mist
6,Culvert,3600,1@pump,63,98,1@pump,2@pump
7,Octopus Cave,3600,1@cash,199,99,1@cash
8,Bangungot Hospital 2F,3600,1@ma_h,40,157,1@ma_h
9,Buwaya Cave,3600,1@ma_c,35,57,1@ma_c
10,Bakonawa Lake,7200,1@ma_b,64,51,1@ma_b
11,Wolfchev's Laboratory,14400,1@lhz,45,148,1@lhz
12,Old Glast Heim,3600,1@gl_k,150,20,1@gl_k,2@gl_k
13,Eclage Interior,1200,1@ecl,60,50,1@ecl
1,Endless Tower,14400,300,1@tower,50,355,1@tower,2@tower,3@tower,4@tower,5@tower,6@tower
2,Sealed Catacomb,7200,300,1@cata,100,224,1@cata,2@cata
3,Orc's Memory,3600,300,1@orcs,179,15,1@orcs,2@orcs
4,Nidhoggur's Nest,14400,300,1@nyd,32,36,1@nyd,2@nyd
5,Mistwood Maze,7200,300,1@mist,89,29,1@mist
6,Culvert,3600,300,1@pump,63,98,1@pump,2@pump
7,Octopus Cave,3600,300,1@cash,199,99,1@cash
8,Bangungot Hospital 2F,3600,300,1@ma_h,40,157,1@ma_h
9,Buwaya Cave,3600,300,1@ma_c,35,57,1@ma_c
10,Bakonawa Lake,7200,300,1@ma_b,64,51,1@ma_b
11,Wolfchev's Laboratory,14400,300,1@lhz,45,148,1@lhz
12,Old Glast Heim,3600,300,1@gl_k,150,20,1@gl_k,2@gl_k
13,Eclage Interior,1200,300,1@ecl,60,50,1@ecl

View File

@ -21,7 +21,6 @@
#include <stdlib.h>
#define INSTANCE_INTERVAL 60000 // Interval used to check when an instance is to be destroyed (ms)
#define INSTANCE_LIMIT 300000 // Idle timer before instance is destroyed (ms) : 5 Minute Default
int instance_start = 0; // To keep the last index + 1 of normal map inserted in the map[ARRAY]
@ -227,8 +226,8 @@ static int instance_startidletimer(struct instance_data *im, unsigned short inst
return 1;
// Add the timer
im->idle_limit = (unsigned int)time(NULL) + INSTANCE_LIMIT/1000;
im->idle_timer = add_timer(gettick()+INSTANCE_LIMIT, instance_delete_timer, instance_id, 0);
im->idle_limit = (unsigned int)time(NULL) + db->timeout;
im->idle_timer = add_timer(gettick() + db->timeout * 1000, instance_delete_timer, instance_id, 0);
switch(im->mode) {
case IM_NONE:
@ -446,8 +445,8 @@ int instance_addmap(unsigned short instance_id)
// Set to busy, update timers
im->state = INSTANCE_BUSY;
im->idle_limit = (unsigned int)time(NULL) + INSTANCE_LIMIT/1000;
im->idle_timer = add_timer(gettick()+INSTANCE_LIMIT, instance_delete_timer, instance_id, 0);
im->idle_limit = (unsigned int)time(NULL) + db->timeout;
im->idle_timer = add_timer(gettick() + db->timeout * 1000, instance_delete_timer, instance_id, 0);
// Add the maps
for(i = 0; i < db->maplist_count; i++) {