From ac359e696f162090840dab488a6ef4981d35bbda Mon Sep 17 00:00:00 2001 From: Ben Longbons Date: Sat, 18 May 2013 17:37:33 -0700 Subject: Tweak a little memory management in char-server --- src/char/inter.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/char/inter.cpp') diff --git a/src/char/inter.cpp b/src/char/inter.cpp index 9efb28c..59a2945 100644 --- a/src/char/inter.cpp +++ b/src/char/inter.cpp @@ -381,7 +381,6 @@ static int mapif_parse_WisRequest(int fd) { static int wisid = 0; - int index; if (RFIFOW(fd, 2) - 52 <= 0) { // normaly, impossible, but who knows... @@ -390,7 +389,8 @@ int mapif_parse_WisRequest(int fd) } // search if character exists before to ask all map-servers - if ((index = search_character_index((const char *)RFIFOP(fd, 28))) == -1) + const mmo_charstatus *mcs = search_character(static_cast(RFIFOP(fd, 28))); + if (!mcs) { unsigned char buf[27]; WBUFW(buf, 0) = 0x3802; @@ -402,7 +402,7 @@ int mapif_parse_WisRequest(int fd) else { // to be sure of the correct name, rewrite it - strzcpy(static_cast(const_cast(RFIFOP(fd, 28))), search_character_name(index), 24); + strzcpy(static_cast(const_cast(RFIFOP(fd, 28))), mcs->name, 24); // if source is destination, don't ask other servers. if (strcmp((const char *)RFIFOP(fd, 4), (const char *)RFIFOP(fd, 28)) == 0) { -- cgit v1.2.3-70-g09d2