viewing paste Unknown #5805 | C

Posted on the
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78
Index: src/map/atcommand.c
===================================================================
--- src/map/atcommand.c (revision 17312)
+++ src/map/atcommand.c (working copy)
@@ -3726,10 +3726,18 @@
  *------------------------------------------*/
 ACMD_FUNC(reloadscript)
 {
+   struct s_mapiterator* iter;
+   struct map_session_data* pl_sd;
+
    nullpo_retr(-1, sd);
    //atcommand_broadcast( fd, sd, "@broadcast", "Server is reloading scripts..." );
    //atcommand_broadcast( fd, sd, "@broadcast", "You will feel a bit of lag at this point !" );
 
+   iter = mapit_getallusers();
+   for( pl_sd = (TBL_PC*)mapit_first(iter); mapit_exists(iter); pl_sd = (TBL_PC*)mapit_next(iter) )
+       pc_close_npc(pl_sd,2);
+   mapit_free(iter);
+
    flush_fifos();
    map_reloadnpc(true); // reload config files seeking for npcs
    script_reload();
Index: src/map/npc.c
===================================================================
--- src/map/npc.c   (revision 17312)
+++ src/map/npc.c   (working copy)
@@ -1287,11 +1287,11 @@
    sd->state.callshop = 0;
    sd->npc_shopid = id;
 
-   if (type==0) {
+   if(type==0)
        clif_buylist(sd,nd);
-   } else {
+   else 
        clif_selllist(sd);
-   }
+
    return 0;
 }
 /*==========================================
@@ -1676,9 +1676,7 @@
    nullpo_retr(1, item_list);
 
    if( ( nd = npc_checknear(sd, map_id2bl(sd->npc_shopid)) ) == NULL || nd->subtype != SHOP )
-   {
        return 1;
-   }
 
    z = 0;
 
Index: src/map/pc.c
===================================================================
--- src/map/pc.c    (revision 17312)
+++ src/map/pc.c    (working copy)
@@ -6584,11 +6584,12 @@
 {
    nullpo_retv(sd);
 
-   if (sd->npc_id) {
+   if (sd->npc_id || sd->npc_shopid) {
        if (sd->state.using_fake_npc) {
            clif_clearunit_single(sd->npc_id, CLR_OUTSIGHT, sd->fd);
            sd->state.using_fake_npc = 0;
        }
+           
        if (sd->st) {
            if(sd->st->state == RUN){ //wait ending code execution
                add_timer(gettick()+500,pc_close_npc_timer,sd->bl.id,flag);
@@ -6599,6 +6600,7 @@
        }
        sd->state.menu_or_input = 0;
        sd->npc_menu = 0;
+       sd->npc_shopid = 0;
 #ifdef SECURE_NPCTIMEOUT
        sd->npc_idle_timer = INVALID_TIMER;
 #endif
Viewed 719 times, submitted by Guest.