Fixing venders being stuck when map->char connection gets reset.

This commit is contained in:
Matej Pristak 2016-03-22 20:55:34 +01:00
parent 242b3c1ab4
commit df1108923a

View File

@ -30,6 +30,7 @@ static int check_connect_char_server(int tid, unsigned int tick, int id, intptr_
static struct eri *auth_db_ers; //For reutilizing player login structures. static struct eri *auth_db_ers; //For reutilizing player login structures.
static DBMap* auth_db; // int id -> struct auth_node* static DBMap* auth_db; // int id -> struct auth_node*
static bool char_init_done = false; //server already initialized? Used for InterInitOnce and vending loadings
static const int packet_len_table[0x3d] = { // U - used, F - free static const int packet_len_table[0x3d] = { // U - used, F - free
60, 3,-1,-1,10,-1, 6,-1, // 2af8-2aff: U->2af8, U->2af9, U->2afa, U->2afb, U->2afc, U->2afd, U->2afe, U->2aff 60, 3,-1,-1,10,-1, 6,-1, // 2af8-2aff: U->2af8, U->2af9, U->2afa, U->2afb, U->2afc, U->2afd, U->2afe, U->2aff
@ -484,8 +485,6 @@ int chrif_changemapserverack(uint32 account_id, int login_id1, int login_id2, ui
* 0x2af9 <errCode>B * 0x2af9 <errCode>B
*/ */
int chrif_connectack(int fd) { int chrif_connectack(int fd) {
static bool char_init_done = false;
if (RFIFOB(fd,2)) { if (RFIFOB(fd,2)) {
ShowFatalError("Connection to char-server failed %d, please check conf/import/map_conf userid and passwd.\n", RFIFOB(fd,2)); ShowFatalError("Connection to char-server failed %d, please check conf/import/map_conf userid and passwd.\n", RFIFOB(fd,2));
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
@ -499,7 +498,6 @@ int chrif_connectack(int fd) {
ShowStatus("Event '"CL_WHITE"OnInterIfInit"CL_RESET"' executed with '"CL_WHITE"%d"CL_RESET"' NPCs.\n", npc_event_doall("OnInterIfInit")); ShowStatus("Event '"CL_WHITE"OnInterIfInit"CL_RESET"' executed with '"CL_WHITE"%d"CL_RESET"' NPCs.\n", npc_event_doall("OnInterIfInit"));
if( !char_init_done ) { if( !char_init_done ) {
char_init_done = true;
ShowStatus("Event '"CL_WHITE"OnInterIfInitOnce"CL_RESET"' executed with '"CL_WHITE"%d"CL_RESET"' NPCs.\n", npc_event_doall("OnInterIfInitOnce")); ShowStatus("Event '"CL_WHITE"OnInterIfInitOnce"CL_RESET"' executed with '"CL_WHITE"%d"CL_RESET"' NPCs.\n", npc_event_doall("OnInterIfInitOnce"));
guild_castle_map_init(); guild_castle_map_init();
} }
@ -564,8 +562,12 @@ void chrif_on_ready(void) {
guild_castle_reconnect(-1, 0, 0); guild_castle_reconnect(-1, 0, 0);
// Charserver is ready for loading autotrader // Charserver is ready for loading autotrader
do_init_buyingstore_autotrade(); if (!char_init_done)
do_init_vending_autotrade(); {
do_init_buyingstore_autotrade();
do_init_vending_autotrade();
char_init_done = true;
}
} }