All pastes #30560 Raw Edit

cavehippo

public text v1 · immutable
#30560 ·published 2005-11-23 14:02 UTC
rendered paste body
Index: include/sproto.h
===================================================================
RCS file: /cvsroot/crossfire/crossfire/include/sproto.h,v
retrieving revision 1.152
diff -C5 -r1.152 sproto.h
*** include/sproto.h    9 Nov 2005 19:34:17 -0000       1.152
--- include/sproto.h    23 Nov 2005 14:01:00 -0000
***************
*** 682,691 ****
--- 682,692 ----
  double shop_specialisation_ratio(object *item, mapstruct *map);
  double shop_greed(mapstruct *map);
  double shopkeeper_approval(mapstruct *map, object *player);
  int describe_shop(object *op);
  void shop_listing(object *op);
+ void drop_all_unpaid(object *op);
  /* skills.c */
  int steal(object *op, int dir, object *skill);
  int pick_lock(object *pl, int dir, object *skill);
  int hide(object *op, object *skill);
  int jump(object *pl, int dir, object *skill);
Index: server/shop.c
===================================================================
RCS file: /cvsroot/crossfire/crossfire/server/shop.c,v
retrieving revision 1.49
diff -C5 -r1.49 shop.c
*** server/shop.c       9 Nov 2005 15:37:29 -0000       1.49
--- server/shop.c       23 Nov 2005 14:01:03 -0000
***************
*** 1124,1128 ****
--- 1124,1144 ----
            free(items[i].item_real);
        }
      }
      free(items);
  }
+
+ /* if we need to quickly make a player leave everything that they are carrying that
+  * hasn't been paid for we call this, used with the dm summon command, and dead connections */
+ void drop_all_unpaid(object *op) {
+     object *item;
+     for (item = op->inv;item;) {
+       if QUERY_FLAG(item, FLAG_UNPAID) drop(op, item);
+       if (item->inv) item = item->inv;
+       else if (item->below) item = item->below;
+       else if (item->env && item->env != op && item->env->below) item = item->env->below;
+       else item = NULL;
+     }
+
+
+
+ }
Index: socket/loop.c
===================================================================
RCS file: /cvsroot/crossfire/crossfire/socket/loop.c,v
retrieving revision 1.34
diff -C5 -r1.34 loop.c
*** socket/loop.c       28 Oct 2005 19:08:53 -0000      1.34
--- socket/loop.c       23 Nov 2005 14:01:03 -0000
***************
*** 534,543 ****
--- 534,544 ----
            player *npl=pl->next;

            save_player(pl->ob, 0);
            if(!QUERY_FLAG(pl->ob,FLAG_REMOVED)) {
                terminate_all_pets(pl->ob);
+               drop_all_unpaid(pl->ob);
                remove_ob(pl->ob);
            }
            leave(pl,1);
            final_free_player(pl);
            pl=npl;
***************
*** 647,656 ****
--- 648,658 ----

        if (FD_ISSET(pl->socket.fd,&tmp_exceptions)) {
            save_player(pl->ob, 0);
            if(!QUERY_FLAG(pl->ob,FLAG_REMOVED)) {
                terminate_all_pets(pl->ob);
+               drop_all_unpaid(pl->ob);
                remove_ob(pl->ob);
            }
            leave(pl,1);
            final_free_player(pl);
        }
***************
*** 663,672 ****
--- 665,675 ----
             */
            if (pl->socket.status==Ns_Dead) {
                save_player(pl->ob, 0);
                if(!QUERY_FLAG(pl->ob,FLAG_REMOVED)) {
                    terminate_all_pets(pl->ob);
+                   drop_all_unpaid(pl->ob);
                    remove_ob(pl->ob);
                }
                leave(pl,1);
                final_free_player(pl);
            } else {