summaryrefslogtreecommitdiff
path: root/src/map/intif.cpp
diff options
context:
space:
mode:
authorBen Longbons <b.r.longbons@gmail.com>2013-06-22 22:30:13 -0700
committerBen Longbons <b.r.longbons@gmail.com>2013-06-23 22:07:50 -0700
commitdbbfda0e96037da4f208ff8f00d181a5294484ae (patch)
tree7a7b9982c6d98ddc2271aade72040ea9233a4a11 /src/map/intif.cpp
parent83db3bbee4e19e7426a32ee89ad6c2d8e48260f2 (diff)
downloadtmwa-dbbfda0e96037da4f208ff8f00d181a5294484ae.tar.gz
tmwa-dbbfda0e96037da4f208ff8f00d181a5294484ae.tar.bz2
tmwa-dbbfda0e96037da4f208ff8f00d181a5294484ae.tar.xz
tmwa-dbbfda0e96037da4f208ff8f00d181a5294484ae.zip
add new stuff stuff (with tests!), poison memcmp and strncpy
Diffstat (limited to 'src/map/intif.cpp')
-rw-r--r--src/map/intif.cpp52
1 files changed, 34 insertions, 18 deletions
diff --git a/src/map/intif.cpp b/src/map/intif.cpp
index 9e9d2e1..311c661 100644
--- a/src/map/intif.cpp
+++ b/src/map/intif.cpp
@@ -286,13 +286,16 @@ int intif_parse_WisEnd(int fd)
{
dumb_ptr<map_session_data> sd;
+ char name[24];
+ RFIFO_STRING(fd, 2, name, 24);
+ uint8_t flag = RFIFOB(fd, 26);
if (battle_config.etc_log)
// flag: 0: success to send wisper, 1: target character is not loged in?, 2: ignored by target
PRINTF("intif_parse_wisend: player: %s, flag: %d\n",
- static_cast<const char *>(RFIFOP(fd, 2)), RFIFOB(fd, 26));
- sd = map_nick2sd(static_cast<const char *>(RFIFOP(fd, 2)));
+ name, flag);
+ sd = map_nick2sd(name);
if (sd != NULL)
- clif_wis_end(sd->fd, RFIFOB(fd, 26));
+ clif_wis_end(sd->fd, flag);
return 0;
}
@@ -414,8 +417,12 @@ void intif_parse_PartyCreated(int fd)
{
if (battle_config.etc_log)
PRINTF("intif: party created\n");
- party_created(RFIFOL(fd, 2), RFIFOB(fd, 6), RFIFOL(fd, 7),
- static_cast<const char *>(RFIFOP(fd, 11)));
+ int account_id = RFIFOL(fd, 2);
+ int fail = RFIFOB(fd, 6);
+ int party_id = RFIFOL(fd, 7);
+ char name[24];
+ RFIFO_STRING(fd, 11, name, 24);
+ party_created(account_id, fail, party_id, name);
}
// パーティ情報
@@ -438,7 +445,9 @@ void intif_parse_PartyInfo(int fd)
RFIFOL(fd, 4), RFIFOW(fd, 2),
sizeof(struct party) + 4);
}
- party_recv_info(static_cast<const struct party *>(RFIFOP(fd, 4)));
+ party p {};
+ RFIFO_STRUCT(fd, 4, p);
+ party_recv_info(&p);
}
// パーティ追加通知
@@ -463,10 +472,14 @@ void intif_parse_PartyOptionChanged(int fd)
static
void intif_parse_PartyMemberLeaved(int fd)
{
+ int party_id = RFIFOL(fd, 2);
+ int account_id = RFIFOL(fd, 6);
+ char name[24];
+ RFIFO_STRING(fd, 10, name, 24);
if (battle_config.etc_log)
- PRINTF("intif: party member leaved %d %d %s\n", RFIFOL(fd, 2),
- RFIFOL(fd, 6), static_cast<const char *>(RFIFOP(fd, 10)));
- party_member_leaved(RFIFOL(fd, 2), RFIFOL(fd, 6), static_cast<const char *>(RFIFOP(fd, 10)));
+ PRINTF("intif: party member leaved %d %d %s\n",
+ party_id, account_id, name);
+ party_member_leaved(party_id, account_id, name);
}
// パーティ解散通知
@@ -480,18 +493,19 @@ void intif_parse_PartyBroken(int fd)
static
void intif_parse_PartyMove(int fd)
{
-// if(battle_config.etc_log)
-// PRINTF("intif: party move %d %d %s %d %d\n",RFIFOL(fd,2),RFIFOL(fd,6),RFIFOP(fd,10),RFIFOB(fd,26),RFIFOW(fd,27));
- party_recv_movemap(RFIFOL(fd, 2), RFIFOL(fd, 6), static_cast<const char *>(RFIFOP(fd, 10)),
- RFIFOB(fd, 26), RFIFOW(fd, 27));
+ int party_id = RFIFOL(fd, 2);
+ int account_id = RFIFOL(fd, 6);
+ char map[16];
+ RFIFO_STRING(fd, 10, map, 16);
+ uint8_t online = RFIFOB(fd, 26);
+ uint16_t lv = RFIFOW(fd, 27);
+ party_recv_movemap(party_id, account_id, map, online, lv);
}
// パーティメッセージ
static
void intif_parse_PartyMessage(int fd)
{
-// if(battle_config.etc_log)
-// PRINTF("intif_parse_PartyMessage: %s\n",RFIFOP(fd,12));
size_t len = RFIFOW(fd, 2) - 12;
char buf[len];
RFIFO_STRING(fd, 12, buf, len);
@@ -532,9 +546,11 @@ int intif_parse(int fd)
switch (cmd)
{
case 0x3800:
- clif_GMmessage(NULL,
- const_string(static_cast<const char *>(RFIFOP(fd, 4)),
- (packet_len - 4) - 1), 0);
+ {
+ char mes[packet_len - 4];
+ RFIFO_STRING(fd, 4, mes, packet_len - 4);
+ clif_GMmessage(NULL, ZString(ZString::really_construct_from_a_pointer, mes), 0);
+ }
break;
case 0x3801:
intif_parse_WisMessage(fd);