Date: Friday July 28, 2000 @ 0:10 Author: cvs Update of /home/cvs/CVS/crossfire/server In directory boltzmann.eecs.berkeley.edu:/tmp/cvs-serv24266/server Modified Files: time.c Log Message: server/time.c: Update the change_object function such that if the object is in a players inventory, send a delete & send_item for the object that has changed (the delete + send_item is necessary due to the ways objects change, so we just can't sent a update_item). This fixes the 'torches go dim & then out but client inventory not updated' bug, and likely fixes some other problems - I am not sure how many other objects out there change. MSW 7/28/2000 **************************************** Index: crossfire/server/time.c diff -u crossfire/server/time.c:1.9 crossfire/server/time.c:1.10 --- crossfire/server/time.c:1.9 Tue Jun 13 09:58:41 2000 +++ crossfire/server/time.c Fri Jul 28 00:10:21 2000 @@ -1,12 +1,12 @@ /* * static char *rcsid_time_c = - * "$Id: time.c,v 1.9 2000/06/13 16:58:41 jec Exp $"; + * "$Id: time.c,v 1.10 2000/07/28 07:10:21 cvs Exp $"; */ /* CrossFire, A Multiplayer game for X-windows - Copyright (C) 1994 Mark Wedel + Copyright (C) 2000 Mark Wedel Copyright (C) 1992 Frank Tore Johansen This program is free software; you can redistribute it and/or modify @@ -23,7 +23,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - The author can be reached via e-mail to master at rahul.net + The author can be reached via e-mail to mwedel at scruz.net */ /* @@ -626,7 +626,7 @@ * Modified this routine to allow held objects. b.t. */ void change_object(object *op) { /* Doesn`t handle linked objs yet */ - object *tmp,*env; + object *tmp,*env,*pl; int i,j; if(op->other_arch==NULL) { @@ -646,7 +646,15 @@ tmp->stats.hp=op->stats.hp; /* The only variable it keeps. */ if(env) { tmp->x=env->x,tmp->y=env->y; - insert_ob_in_ob(tmp,env); + tmp=insert_ob_in_ob(tmp,env); + /* If this object is the players inventory, we need to tell the + * client of the change. Insert_ob_in_map takes care of the + * updating the client, so we don't need to do that below. + */ + if ((pl=is_player_inv(env))!=NULL) { + esrv_del_item(pl->contr, op->count); + esrv_send_item(pl, tmp); + } } else { j=find_first_free_spot(tmp->arch,op->map,op->x,op->y); if (j==-1) /* No free spot */