summaryrefslogtreecommitdiff
path: root/src/map/party.c
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/party.c
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/party.c')
-rw-r--r--src/map/party.c32
1 files changed, 13 insertions, 19 deletions
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;
}