summaryrefslogtreecommitdiff
path: root/src/map/clif.c
diff options
context:
space:
mode:
authorFlavioJS <FlavioJS@54d463be-8e91-2dee-dedb-b68131a5f0ec>2007-09-25 01:58:31 +0000
committerFlavioJS <FlavioJS@54d463be-8e91-2dee-dedb-b68131a5f0ec>2007-09-25 01:58:31 +0000
commit1041b3bbad62766df85393254a93602a1851895a (patch)
tree0c3e433ec1b0c8b2bed7371ef9c65aa5c112755b /src/map/clif.c
parent02ff54ba1d0b87b29f19c29524ba77a2f30a6d85 (diff)
downloadhercules-1041b3bbad62766df85393254a93602a1851895a.tar.gz
hercules-1041b3bbad62766df85393254a93602a1851895a.tar.bz2
hercules-1041b3bbad62766df85393254a93602a1851895a.tar.xz
hercules-1041b3bbad62766df85393254a93602a1851895a.zip
* Disabled tick cache (to enable it: define TICK_CACHE to the number of calls that should be cached).
* Added a charid2sd database for fast charid searches. * Reworked the nick cache to only contain offline characters. Note: The tick cache was causing _some_ of the desync problems in eA. Gameplay should be much smother, but desync problems still exist. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@11290 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map/clif.c')
-rw-r--r--src/map/clif.c52
1 files changed, 17 insertions, 35 deletions
diff --git a/src/map/clif.c b/src/map/clif.c
index e10a95d99..e9258e317 100644
--- a/src/map/clif.c
+++ b/src/map/clif.c
@@ -5160,24 +5160,13 @@ int clif_wis_end(int fd, int flag)
/*==========================================
* キャラID名前引き結果を送信する
*------------------------------------------*/
-int clif_solved_charname(struct map_session_data *sd,int char_id)
+int clif_solved_charname(int fd, int charid, const char* name)
{
- char *p= map_charid2nick(char_id);
- int fd;
-
- nullpo_retr(0, sd);
-
- fd=sd->fd;
- if(p!=NULL){
- WFIFOHEAD(fd,packet_len(0x194));
- WFIFOW(fd,0)=0x194;
- WFIFOL(fd,2)=char_id;
- memcpy(WFIFOP(fd,6), p, NAME_LENGTH);
- WFIFOSET(fd,packet_len(0x194));
- }else{
- map_reqchariddb(sd,char_id);
- chrif_searchcharid(char_id);
- }
+ WFIFOHEAD(fd,packet_len(0x194));
+ WFIFOW(fd,0)=0x194;
+ WFIFOL(fd,2)=charid;
+ safestrncpy(WFIFOP(fd,6), name, NAME_LENGTH);
+ WFIFOSET(fd,packet_len(0x194));
return 0;
}
@@ -6039,25 +6028,18 @@ int clif_movetoattack(struct map_session_data *sd,struct block_list *bl)
/*==========================================
* 製造エフェクト
*------------------------------------------*/
-int clif_produceeffect(struct map_session_data *sd,int flag,int nameid)
+int clif_produceeffect(struct map_session_data* sd,int flag,int nameid)
{
- int view,fd;
+ int fd;
nullpo_retr(0, sd);
- fd=sd->fd;
- // 名前の登録と送信を先にしておく
- if( map_charid2nick(sd->status.char_id)==NULL )
- map_addchariddb(sd->status.char_id,sd->status.name);
- clif_solved_charname(sd,sd->status.char_id);
-
+ fd = sd->fd;
+ clif_solved_charname(fd, sd->status.char_id, sd->status.name);
WFIFOHEAD(fd,packet_len(0x18f));
WFIFOW(fd, 0)=0x18f;
WFIFOW(fd, 2)=flag;
- if((view = itemdb_viewid(nameid)) > 0)
- WFIFOW(fd, 4)=view;
- else
- WFIFOW(fd, 4)=nameid;
+ WFIFOW(fd, 4)=(itemdb_viewid(nameid)||nameid);
WFIFOSET(fd,packet_len(0x18f));
return 0;
}
@@ -9915,10 +9897,10 @@ void clif_parse_InsertCard(int fd,struct map_session_data *sd)
*------------------------------------------*/
void clif_parse_SolveCharName(int fd, struct map_session_data *sd)
{
- int char_id;
+ int charid;
- char_id = RFIFOL(fd,packet_db[sd->packet_ver][RFIFOW(fd,0)].pos[0]);
- clif_solved_charname(sd, char_id);
+ charid = RFIFOL(fd,packet_db[sd->packet_ver][RFIFOW(fd,0)].pos[0]);
+ map_reqnickdb(sd, charid);
}
/*==========================================
@@ -11263,7 +11245,7 @@ void clif_parse_PVPInfo(int fd,struct map_session_data *sd)
void clif_parse_Blacksmith(int fd,struct map_session_data *sd)
{
int i;
- char *name;
+ const char* name;
WFIFOHEAD(fd,packet_len(0x219));
WFIFOW(fd,0) = 0x219;
@@ -11306,7 +11288,7 @@ int clif_fame_blacksmith(struct map_session_data *sd, int points)
void clif_parse_Alchemist(int fd,struct map_session_data *sd)
{
int i;
- char *name;
+ const char* name;
WFIFOHEAD(fd,packet_len(0x21a));
WFIFOW(fd,0) = 0x21a;
@@ -11349,7 +11331,7 @@ int clif_fame_alchemist(struct map_session_data *sd, int points)
void clif_parse_Taekwon(int fd,struct map_session_data *sd)
{
int i;
- char *name;
+ const char* name;
WFIFOHEAD(fd,packet_len(0x226));
WFIFOW(fd,0) = 0x226;