summaryrefslogtreecommitdiff
path: root/src/map/intif.cpp
diff options
context:
space:
mode:
authorBen Longbons <b.r.longbons@gmail.com>2013-05-18 17:37:33 -0700
committerBen Longbons <b.r.longbons@gmail.com>2013-05-18 18:49:39 -0700
commitac359e696f162090840dab488a6ef4981d35bbda (patch)
tree2ee04de23428bba264d1e39c80d5f50180d1b555 /src/map/intif.cpp
parentfd00d50574064db9edfcccc4286ed8f1b55b185a (diff)
downloadtmwa-ac359e696f162090840dab488a6ef4981d35bbda.tar.gz
tmwa-ac359e696f162090840dab488a6ef4981d35bbda.tar.bz2
tmwa-ac359e696f162090840dab488a6ef4981d35bbda.tar.xz
tmwa-ac359e696f162090840dab488a6ef4981d35bbda.zip
Tweak a little memory management in char-server
Diffstat (limited to 'src/map/intif.cpp')
-rw-r--r--src/map/intif.cpp16
1 files changed, 10 insertions, 6 deletions
diff --git a/src/map/intif.cpp b/src/map/intif.cpp
index 6c8edf5..6a9008e 100644
--- a/src/map/intif.cpp
+++ b/src/map/intif.cpp
@@ -332,9 +332,9 @@ int intif_parse_WisEnd(int fd)
// Received wisp message from map-server via char-server for ALL gm
static
int mapif_parse_WisToGM(int fd)
-{ // 0x3003/0x3803 <packet_len>.w <wispname>.24B <min_gm_level>.w <message>.?B
- int i, min_gm_level, len;
- struct map_session_data *pl_sd;
+{
+ // 0x3003/0x3803 <packet_len>.w <wispname>.24B <min_gm_level>.w <message>.?B
+ int min_gm_level, len;
char Wisp_name[24];
char mbuf[255];
@@ -350,12 +350,16 @@ int mapif_parse_WisToGM(int fd)
memcpy(message, RFIFOP(fd, 30), len);
message[len - 1] = '\0';
// information is sended to all online GM
- for (i = 0; i < fd_max; i++)
- if (session[i] && (pl_sd = (struct map_session_data *)session[i]->session_data)
- && pl_sd->state.auth)
+ for (int i = 0; i < fd_max; i++)
+ {
+ if (!session[i])
+ continue;
+ map_session_data *pl_sd = static_cast<map_session_data *>(session[i]->session_data.get());
+ if (pl_sd && pl_sd->state.auth)
if (pc_isGM(pl_sd) >= min_gm_level)
clif_wis_message(i, Wisp_name, message,
strlen(message) + 1);
+ }
if (message != mbuf)
free(message);