summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/login/login.c11
-rw-r--r--src/login_sql/login.c23
-rw-r--r--src/map/clif.c23
3 files changed, 35 insertions, 22 deletions
diff --git a/src/login/login.c b/src/login/login.c
index 844549c6a..530d2eeda 100644
--- a/src/login/login.c
+++ b/src/login/login.c
@@ -1233,9 +1233,9 @@ int parse_fromchar(int fd)
if( session[fd]->eof )
{
ShowStatus("Char-server '%s' has disconnected.\n", server[id].name);
- server[id].fd = -1;
- memset(&server[id], 0, sizeof(struct mmo_char_server));
online_db->foreach(online_db, online_db_setoffline, id); //Set all chars from this char server to offline.
+ memset(&server[id], 0, sizeof(struct mmo_char_server));
+ server[id].fd = -1;
do_close(fd);
return 0;
}
@@ -2606,7 +2606,8 @@ void login_set_defaults()
void do_final(void)
{
int i, fd;
- ShowInfo("Terminating...\n");
+ ShowStatus("Terminating...\n");
+
mmo_auth_sync();
online_db->destroy(online_db, NULL);
@@ -2615,10 +2616,11 @@ void do_final(void)
if(access_ladmin_allow) aFree(access_ladmin_allow);
if(access_allow) aFree(access_allow);
if(access_deny) aFree(access_deny);
+
for (i = 0; i < MAX_SERVERS; i++) {
if ((fd = server[i].fd) >= 0) {
- server[i].fd = -1;
memset(&server[i], 0, sizeof(struct mmo_char_server));
+ server[i].fd = -1;
do_close(fd);
}
}
@@ -2626,6 +2628,7 @@ void do_final(void)
if(log_fp)
fclose(log_fp);
+
ShowStatus("Finished.\n");
}
diff --git a/src/login_sql/login.c b/src/login_sql/login.c
index f63961f82..20be31a7b 100644
--- a/src/login_sql/login.c
+++ b/src/login_sql/login.c
@@ -621,11 +621,11 @@ int parse_fromchar(int fd)
if( session[fd]->eof )
{
ShowStatus("Char-server '%s' has disconnected.\n", server[id].name);
- server[id].fd = -1;
- memset(&server[id], 0, sizeof(struct mmo_char_server));
online_db->foreach(online_db, online_db_setoffline, id); //Set all chars from this char server to offline.
if( SQL_ERROR == Sql_Query(sql_handle, "DELETE FROM `sstatus` WHERE `index`='%d'", id) )
Sql_ShowDebug(sql_handle);
+ memset(&server[id], 0, sizeof(struct mmo_char_server));
+ server[id].fd = -1;
do_close(fd);
return 0;
}
@@ -1863,13 +1863,24 @@ void login_set_defaults()
//--------------------------------------
void do_final(void)
{
- //sync account when terminating.
- //but no need when you using DBMS (mysql)
+ int i, fd;
ShowStatus("Terminating...\n");
+
mmo_db_close();
online_db->destroy(online_db, NULL);
- if (gm_account_db)
- aFree(gm_account_db);
+
+ if(gm_account_db) aFree(gm_account_db);
+
+ for (i = 0; i < MAX_SERVERS; i++) {
+ if ((fd = server[i].fd) >= 0) {
+ memset(&server[i], 0, sizeof(struct mmo_char_server));
+ server[i].fd = -1;
+ do_close(fd);
+ }
+ }
+ do_close(login_fd);
+
+ ShowStatus("Finished.\n");
}
//------------------------------
diff --git a/src/map/clif.c b/src/map/clif.c
index 9835f12ec..bdb989d3f 100644
--- a/src/map/clif.c
+++ b/src/map/clif.c
@@ -946,7 +946,6 @@ static int clif_set_unit_spawned(struct block_list* bl, unsigned char* buf)
}
else
{ // npc/mob/pet/homun spawn packet
- memset(buf,0,sizeof(buf));
WBUFW(buf, 0) = 0x7c;
WBUFL(buf, 2) = bl->id;
WBUFW(buf, 6) = status_get_speed(bl);
@@ -954,20 +953,20 @@ static int clif_set_unit_spawned(struct block_list* bl, unsigned char* buf)
WBUFW(buf,10) = (sc)? sc->opt2 : 0;
WBUFW(buf,12) = (sc)? sc->option : 0;
WBUFW(buf,14) = vd->hair_style; //Required for pets (removes attack cursor)
- //16W: Weapon
+ WBUFW(buf,16) = 0; // Weapon
WBUFW(buf,18) = vd->head_bottom; //Pet armor (ignored by client)
WBUFW(buf,20) = vd->class_;
- //22W: Shield
- //24W: Head top
- //26W: Head mid
- //28W: Hair color
- //30W: Cloth color
- //32W: Head dir
- //34B: karma
- //35B: Sex
+ WBUFW(buf,22) = 0; // Shield
+ WBUFW(buf,24) = 0; // Head top
+ WBUFW(buf,26) = 0; // Head mid
+ WBUFW(buf,28) = 0; // Hair color
+ WBUFW(buf,30) = 0; // Cloth color
+ WBUFW(buf,32) = 0; // Head dir
+ WBUFB(buf,34) = 0; // karma
+ WBUFB(buf,35) = 0; // Sex
WBUFPOS(buf,36,bl->x,bl->y,unit_getdir(bl));
- //39B: ???
- //40B: ???
+ WBUFB(buf,39) = 0; // ???
+ WBUFB(buf,40) = 0; // ???
#if PACKETVER < 9
return packet_len(0x7c);