Skip to content

Commit

Permalink
Merge pull request #1089 from Baalberith6/autotrade
Browse files Browse the repository at this point in the history
Fixing @at venders being stuck when map->char connection gets reset.
  • Loading branch information
cydh committed Oct 11, 2016
2 parents 10946dd + df11089 commit 3e4d2b8
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/map/chrif.c
Expand Up @@ -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 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
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
Expand Down Expand Up @@ -485,8 +486,6 @@ int chrif_changemapserverack(uint32 account_id, int login_id1, int login_id2, ui
* 0x2af9 <errCode>B
*/
int chrif_connectack(int fd) {
static bool char_init_done = false;

if (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);
Expand All @@ -500,7 +499,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"));
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"));
guild_castle_map_init();
}
Expand Down Expand Up @@ -565,8 +563,12 @@ void chrif_on_ready(void) {
guild_castle_reconnect(-1, 0, 0);

// Charserver is ready for loading autotrader
do_init_buyingstore_autotrade();
do_init_vending_autotrade();
if (!char_init_done)
{
do_init_buyingstore_autotrade();
do_init_vending_autotrade();
char_init_done = true;
}
}


Expand Down

0 comments on commit 3e4d2b8

Please sign in to comment.