summaryrefslogtreecommitdiff
path: root/src/char
diff options
context:
space:
mode:
authorskotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2007-02-28 06:07:41 +0000
committerskotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2007-02-28 06:07:41 +0000
commit0e18aab4b8d2dc4bdac05e18a76c8d170fbcc64d (patch)
treed8b47d2982e89b41bbbb97038f934a977b6d45b6 /src/char
parentd3ba5a04661367e6e6108677e54937f2646786b2 (diff)
downloadhercules-0e18aab4b8d2dc4bdac05e18a76c8d170fbcc64d.tar.gz
hercules-0e18aab4b8d2dc4bdac05e18a76c8d170fbcc64d.tar.bz2
hercules-0e18aab4b8d2dc4bdac05e18a76c8d170fbcc64d.tar.xz
hercules-0e18aab4b8d2dc4bdac05e18a76c8d170fbcc64d.zip
- Simplified a bit mmo_char_tobuf (at least it looks cleaner to me now)
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@9932 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/char')
-rw-r--r--src/char/char.c30
1 files changed, 10 insertions, 20 deletions
diff --git a/src/char/char.c b/src/char/char.c
index e2a29a8ad..cc6b12d8e 100644
--- a/src/char/char.c
+++ b/src/char/char.c
@@ -1662,7 +1662,7 @@ int count_users(void) {
/// Writes char data to the buffer in the format used by the client.
/// Used in packets 0x6b (chars info) and 0x6d (new char info)
/// Returns the size (106 or 108)
-int mmo_char_tobuf(uint8* buf, struct mmo_charstatus *p, int new_charscreen)
+int mmo_char_tobuf(uint8* buf, struct mmo_charstatus *p)
{
if( buf == NULL || p == NULL )
return 0;
@@ -1706,15 +1706,16 @@ int mmo_char_tobuf(uint8* buf, struct mmo_charstatus *p, int new_charscreen)
WBUFB(buf,101) = (p->int_ > UCHAR_MAX) ? UCHAR_MAX : p->int_;
WBUFB(buf,102) = (p->dex > UCHAR_MAX) ? UCHAR_MAX : p->dex;
WBUFB(buf,103) = (p->luk > UCHAR_MAX) ? UCHAR_MAX : p->luk;
-
//Updated packet structure with rename-button included. Credits to Sara-chan
+#if PACKETVER > 7
WBUFW(buf,104) = p->char_num;
- if( new_charscreen )
- {
- WBUFW(buf,106) = 1;// Rename bit (0=rename,1=no rename)
- return 108;
- }
+ WBUFW(buf,106) = 1;// Rename bit (0=rename,1=no rename)
+ return 108;
+#else
+ WBUFB(buf,104) = p->char_num;
return 106;
+#endif
+
}
//----------------------------------------
@@ -1744,13 +1745,7 @@ int mmo_char_send006b(int fd, struct char_session_data *sd) {
memset(WFIFOP(fd,4), 0, 20);// unknown bytes
for(i = 0; i < found_num; i++)
- {
-#if PACKETVER > 7
- j += mmo_char_tobuf(WFIFOP(fd,j), &char_dat[sd->found_char[i]].status, 1);
-#else
- j += mmo_char_tobuf(WFIFOP(fd,j), &char_dat[sd->found_char[i]].status, 0);
-#endif
- }
+ j += mmo_char_tobuf(WFIFOP(fd,j), &char_dat[sd->found_char[i]].status);
WFIFOW(fd,2) = j;// packet len
WFIFOSET(fd,j);
}
@@ -3637,13 +3632,8 @@ int parse_char(int fd) {
int len;
WFIFOHEAD(fd, 110);
WFIFOW(fd,0) = 0x6d;
-#if PACKETVER > 7
- len = 2 + mmo_char_tobuf(WFIFOP(fd,2), &char_dat[i].status, 1);
-#else
- len = 2 + mmo_char_tobuf(WFIFOP(fd,2), &char_dat[i].status, 0);
-#endif
+ len = 2 + mmo_char_tobuf(WFIFOP(fd,2), &char_dat[i].status);
WFIFOSET(fd,len);
-
RFIFOSKIP(fd,37);
}
for(ch = 0; ch < 9; ch++) {