summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorskotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2007-03-11 17:33:58 +0000
committerskotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2007-03-11 17:33:58 +0000
commit7c74f09515f1eca23f007e106f2bb69cd4ae508e (patch)
tree09630838892a530cb166509065ae2f9ed2b67229
parent26789cc24022cf600543860c4a15dbe79aa0e1f8 (diff)
downloadhercules-7c74f09515f1eca23f007e106f2bb69cd4ae508e.tar.gz
hercules-7c74f09515f1eca23f007e106f2bb69cd4ae508e.tar.bz2
hercules-7c74f09515f1eca23f007e106f2bb69cd4ae508e.tar.xz
hercules-7c74f09515f1eca23f007e106f2bb69cd4ae508e.zip
- Removed function clif_movepc as it's no longer invoked anywhere.
- Removed clif_move as it's not needed anymore. - Renamed clif_moveunit to clif_move and uncommented it. This is the new "unit movement" packet to use (the code should be robust enough to always invoke a clif_insight/outsight for characters going in/out of sight). - Because of this, many functions that handled the return of conv_str need to be changed, I haven't finished doing the conversion process because I must go already, if someone else can continue, please do so (I will resume work on this in ~5 hours git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@9987 54d463be-8e91-2dee-dedb-b68131a5f0ec
-rw-r--r--Changelog-Trunk.txt6
-rw-r--r--src/map/clif.c111
-rw-r--r--src/map/clif.h2
-rw-r--r--src/map/unit.c4
4 files changed, 20 insertions, 103 deletions
diff --git a/Changelog-Trunk.txt b/Changelog-Trunk.txt
index 5a6a646ad..9e60b4476 100644
--- a/Changelog-Trunk.txt
+++ b/Changelog-Trunk.txt
@@ -4,6 +4,12 @@ AS OF SVN REV. 5091, WE ARE NOW USING TRUNK. ALL UNTESTED BUGFIXES/FEATURES GO
IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK.
2007/03/12
+ * Changed the unit-walk packet to be 0x86 as pointed out by FlavioJS. This
+ new packet is much smaller, and should greatly decrease bandwidth usage.
+ The only drawback is that the character will not display at all if the
+ client didn't know of it's existance previously, but eA should always be
+ sending a spawn packet when an object gets into/out of sight anyway, so
+ it should work correctly.
* Modified the guild master change ack packet to return the aid/cid of the
new guild master instead of the index where it was, the previous method
could cause problems in situations where the order of guild members would
diff --git a/src/map/clif.c b/src/map/clif.c
index f7b018a31..977934afc 100644
--- a/src/map/clif.c
+++ b/src/map/clif.c
@@ -1512,115 +1512,26 @@ int clif_walkok(struct map_session_data *sd)
return 0;
}
-/*==========================================
- *
- *------------------------------------------
- */
-int clif_movepc(struct map_session_data *sd) {
- unsigned char buf[256];
-
- nullpo_retr(0, sd);
-
- if (map[sd->bl.m].flag.snow
- || map[sd->bl.m].flag.clouds
- || map[sd->bl.m].flag.fog
- || map[sd->bl.m].flag.fireworks
- || map[sd->bl.m].flag.sakura
- || map[sd->bl.m].flag.leaves
- || map[sd->bl.m].flag.rain
- || map[sd->bl.m].flag.clouds2
- ) {
- memset(buf,0,packet_len(0x7b));
- WBUFW(buf,0)=0x7b;
- WBUFL(buf,2)=-10;
- WBUFW(buf,6)=sd->battle_status.speed;
- WBUFW(buf,8)=0;
- WBUFW(buf,10)=0;
- WBUFW(buf,12)=OPTION_INVISIBLE;
- WBUFW(buf,14)=100;
- WBUFL(buf,22)=gettick();
- WBUFPOS2(buf,50,sd->bl.x,sd->bl.y,sd->ud.to_x,sd->ud.to_y,8,8);
- WBUFB(buf,56)=5;
- WBUFB(buf,57)=5;
- clif_send(buf, packet_len(0x7b), &sd->bl, SELF);
- }
-
- return 0;
-}
-
/// Move the unit (does nothing if the client has no info about the unit)
/// Note: unit must not be self
-//##TODO make sure insight/outsight code is solid enough before using this [FlavioJS]
-/*
-void clif_moveunit(int fd, struct unit_data* ud)
+void clif_move(struct unit_data *ud)
{
- struct block_list* bl;
-
- bl = ud->bl;
-
- WFIFOHEAD(fd, packet_len(0x86));
- WFIFOW(fd,0)=0x86;
- WFIFOL(fd,2)=bl->id;
- WFIFOPOS2(fd,6,bl->x,bl->y,ud->to_x,ud->to_y,8,8);
- WFIFOL(fd,12)=gettick();
- WFIFOSET(fd, packet_len(0x86));
-}
-*/
-
-/*==========================================
- *
- *------------------------------------------
- */
-int clif_move(struct block_list *bl) {
- struct view_data *vd;
- struct unit_data *ud;
- unsigned char buf[256];
- int len;
-
- nullpo_retr(0, bl);
-
+ unsigned char buf[16];
+ struct view_data* vd;
+ struct block_list* bl = ud->bl;
vd = status_get_viewdata(bl);
if (!vd || vd->class_ == INVISIBLE_CLASS)
- return 0;
-
- ud = unit_bl2ud(bl);
- nullpo_retr(0, ud);
+ return; //This performance check is needed to keep GM-hidden objects from being notified to bots.
- len = clif_set007b(bl,vd,ud,buf);
- clif_send(buf,len,bl,AREA_WOS);
+ WBUFW(buf,0)=0x86;
+ WBUFL(buf,2)=bl->id;
+ WBUFPOS2(buf,6,bl->x,bl->y,ud->to_x,ud->to_y,8,8);
+ WBUFL(buf,12)=gettick();
+ clif_send(buf, 16, bl, AREA_WOS);
if (disguised(bl))
- clif_setdisguise((TBL_PC*)bl, buf, len, 0);
-
- //Stupid client that needs this resent every time someone walks :X
- if(vd->cloth_color)
- clif_refreshlook(bl,bl->id,LOOK_CLOTHES_COLOR,vd->cloth_color,AREA_WOS);
-
- switch(bl->type)
- {
- case BL_PC:
- {
- TBL_PC *sd = ((TBL_PC*)bl);
-// clif_movepc(sd);
- if(sd->state.size==2) // tiny/big players [Valaris]
- clif_specialeffect(&sd->bl,423,AREA);
- else if(sd->state.size==1)
- clif_specialeffect(&sd->bl,421,AREA);
- }
- break;
- case BL_MOB:
- {
- TBL_MOB *md = ((TBL_MOB*)bl);
- if(md->special_state.size==2) // tiny/big mobs [Valaris]
- clif_specialeffect(&md->bl,423,AREA);
- else if(md->special_state.size==1)
- clif_specialeffect(&md->bl,421,AREA);
- }
- break;
- }
- return 0;
+ clif_setdisguise((TBL_PC*)bl, buf, 16, 0);
}
-
/*==========================================
* Delays the map_quit of a player after they are disconnected. [Skotlex]
*------------------------------------------
diff --git a/src/map/clif.h b/src/map/clif.h
index 6a0e51da8..7bf9eb682 100644
--- a/src/map/clif.h
+++ b/src/map/clif.h
@@ -73,7 +73,7 @@ int clif_clearchar_delay(unsigned int,struct block_list *,int);
int clif_clearchar_id(int,int,int);
int clif_spawn(struct block_list*); //area
int clif_walkok(struct map_session_data*); // self
-int clif_move(struct block_list*); // area
+void clif_move(struct unit_data *ud); //area
int clif_changemap(struct map_session_data*,short,int,int); //self
int clif_changemapserver(struct map_session_data* sd, const char* mapname, int x, int y, int ip, int port); //self
int clif_blown(struct block_list *); // area
diff --git a/src/map/unit.c b/src/map/unit.c
index 492714bc2..e784c68ce 100644
--- a/src/map/unit.c
+++ b/src/map/unit.c
@@ -85,7 +85,7 @@ int unit_walktoxy_sub(struct block_list *bl)
((TBL_PC *)bl)->head_dir = 0;
clif_walkok((TBL_PC*)bl);
}
- clif_move(bl);
+ clif_move(ud);
if(ud->walkpath.path_pos>=ud->walkpath.path_len)
i = -1;
@@ -204,7 +204,7 @@ static int unit_walktoxy_timer(int tid,unsigned int tick,int id,int data)
return 0;
}
//Resend walk packet for proper Self Destruction display.
- clif_move(bl);
+ clif_move(ud);
}
}