summaryrefslogtreecommitdiff
path: root/src/map
diff options
context:
space:
mode:
authorFlavioJS <FlavioJS@54d463be-8e91-2dee-dedb-b68131a5f0ec>2006-12-21 02:32:51 +0000
committerFlavioJS <FlavioJS@54d463be-8e91-2dee-dedb-b68131a5f0ec>2006-12-21 02:32:51 +0000
commitb5267523b67fbb77deacd7e9b44110a31086805d (patch)
tree8d22dc2c79a8239524efab8a484f0584ee26ca91 /src/map
parentd3a2bbe60ca0a543713bc0bdd280be7c9c9c2951 (diff)
downloadhercules-b5267523b67fbb77deacd7e9b44110a31086805d.tar.gz
hercules-b5267523b67fbb77deacd7e9b44110a31086805d.tar.bz2
hercules-b5267523b67fbb77deacd7e9b44110a31086805d.tar.xz
hercules-b5267523b67fbb77deacd7e9b44110a31086805d.zip
- Added a 1-node cache to db. Removed party_cache and guild_cache since now the database has a cache.
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@9545 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map')
-rw-r--r--src/map/guild.c18
-rw-r--r--src/map/party.c32
2 files changed, 19 insertions, 31 deletions
diff --git a/src/map/guild.c b/src/map/guild.c
index 0ddb966d5..a5db3664a 100644
--- a/src/map/guild.c
+++ b/src/map/guild.c
@@ -25,12 +25,11 @@
#include "skill.h"
#include "log.h"
-static struct guild* guild_cache; //For fast retrieval of the same guild over and over. [Skotlex]
-static struct dbt *guild_db;
-static struct dbt *castle_db;
-static struct dbt *guild_expcache_db;
-static struct dbt *guild_infoevent_db;
-static struct dbt *guild_castleinfoevent_db;
+static DB guild_db;
+static DB castle_db;
+static DB guild_expcache_db;
+static DB guild_infoevent_db;
+static DB guild_castleinfoevent_db;
struct eventlist {
char name[50];
@@ -225,10 +224,7 @@ void do_init_guild(void)
// ŒŸõ
struct guild *guild_search(int guild_id)
{
- if(guild_cache && guild_cache->guild_id == guild_id)
- return guild_cache;
- guild_cache = idb_get(guild_db,guild_id);
- return guild_cache;
+ return idb_get(guild_db,guild_id);
}
int guild_searchname_sub(DBKey key,void *data,va_list ap)
{
@@ -1576,8 +1572,6 @@ int guild_broken(int guild_id,int flag)
guild_db->foreach(guild_db,guild_broken_sub,guild_id);
castle_db->foreach(castle_db,castle_guild_broken_sub,guild_id);
- if (guild_cache && guild_cache->guild_id == guild_id)
- guild_cache = NULL;
guild_storage_delete(guild_id);
idb_remove(guild_db,guild_id);
return 0;
diff --git a/src/map/party.c b/src/map/party.c
index babc9129d..aabd336ff 100644
--- a/src/map/party.c
+++ b/src/map/party.c
@@ -22,8 +22,7 @@
#include "skill.h"
#include "status.h"
-static struct dbt* party_db;
-static struct party_data* party_cache = NULL; //party in cache for skipping consecutive lookups. [Skotlex]
+static DB party_db;
int party_share_level = 10;
int party_send_xy_timer(int tid,unsigned int tick,int id,int data);
@@ -34,13 +33,13 @@ int party_send_xy_timer(int tid,unsigned int tick,int id,int data);
*/
static void party_fill_member(struct party_member *member, struct map_session_data *sd) {
member->account_id = sd->status.account_id;
- member->char_id = sd->status.char_id;
- memcpy(member->name,sd->status.name,NAME_LENGTH);
- member->class_ = sd->status.class_;
- member->map = sd->mapindex;
- member->lv = sd->status.base_level;
- member->online = 1;
- member->leader = 0;
+ member->char_id = sd->status.char_id;
+ memcpy(member->name, sd->status.name, NAME_LENGTH);
+ member->class_ = sd->status.class_;
+ member->map = sd->mapindex;
+ member->lv = sd->status.base_level;
+ member->online = 1;
+ member->leader = 0;
}
/*==========================================
@@ -55,19 +54,16 @@ void do_final_party(void)
void do_init_party(void)
{
party_db=db_alloc(__FILE__,__LINE__,DB_INT,DB_OPT_RELEASE_DATA,sizeof(int));
- add_timer_func_list(party_send_xy_timer,"party_send_xy_timer");
- add_timer_interval(gettick()+battle_config.party_update_interval,party_send_xy_timer,0,0,battle_config.party_update_interval);
+ add_timer_func_list(party_send_xy_timer, "party_send_xy_timer");
+ add_timer_interval(gettick()+battle_config.party_update_interval, party_send_xy_timer, 0, 0, battle_config.party_update_interval);
}
// ŒŸõ
struct party_data *party_search(int party_id)
{
- if(!party_id) return NULL;
- if (party_cache && party_cache->party.party_id == party_id)
- return party_cache;
-
- party_cache = idb_get(party_db,party_id);
- return party_cache;
+ if(!party_id)
+ return NULL;
+ return idb_get(party_db,party_id);
}
int party_searchname_sub(DBKey key,void *data,va_list ap)
{
@@ -449,8 +445,6 @@ int party_broken(int party_id)
p->data[i].sd->state.party_sent=0;
}
}
- if (party_cache && party_cache->party.party_id == party_id)
- party_cache = NULL;
idb_remove(party_db,party_id);
return 0;
}