summaryrefslogtreecommitdiff
path: root/src/map/chrif.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/chrif.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/chrif.cpp')
-rw-r--r--src/map/chrif.cpp16
1 files changed, 9 insertions, 7 deletions
diff --git a/src/map/chrif.cpp b/src/map/chrif.cpp
index 6742f88..4757c0a 100644
--- a/src/map/chrif.cpp
+++ b/src/map/chrif.cpp
@@ -199,7 +199,7 @@ int chrif_changemapserver(struct map_session_data *sd, char *name, int x,
s_ip = 0;
for (i = 0; i < fd_max; i++)
- if (session[i] && session[i]->session_data == sd)
+ if (session[i] && session[i]->session_data.get() == sd)
{
s_ip = session[i]->client_addr.sin_addr.s_addr;
break;
@@ -310,7 +310,7 @@ int chrif_authreq(struct map_session_data *sd)
return -1;
for (i = 0; i < fd_max; i++)
- if (session[i] && session[i]->session_data == sd)
+ if (session[i] && session[i]->session_data.get() == sd)
{
WFIFOW(char_fd, 0) = 0x2afc;
WFIFOL(char_fd, 2) = sd->bl.id;
@@ -340,7 +340,7 @@ int chrif_charselectreq(struct map_session_data *sd)
s_ip = 0;
for (i = 0; i < fd_max; i++)
- if (session[i] && session[i]->session_data == sd)
+ if (session[i] && session[i]->session_data.get() == sd)
{
s_ip = session[i]->client_addr.sin_addr.s_addr;
break;
@@ -1161,16 +1161,18 @@ void chrif_parse(int fd)
static
void send_users_tochar(TimerData *, tick_t)
{
- int users = 0, i;
- struct map_session_data *sd;
+ int users = 0;
if (char_fd <= 0 || session[char_fd] == NULL)
return;
WFIFOW(char_fd, 0) = 0x2aff;
- for (i = 0; i < fd_max; i++)
+ for (int i = 0; i < fd_max; i++)
{
- if (session[i] && (sd = (struct map_session_data *)session[i]->session_data) && sd->state.auth &&
+ if (!session[i])
+ continue;
+ map_session_data *sd = static_cast<map_session_data *>(session[i]->session_data.get());
+ if (sd && sd->state.auth &&
!((battle_config.hide_GM_session
|| sd->state.shroud_active
|| bool(sd->status.option & Option::HIDE)) && pc_isGM(sd)))