… | |
… | |
857 | |
857 | |
858 | if (op->type == LAMP) |
858 | if (op->type == LAMP) |
859 | tmp->stats.food = op->stats.food - 1; |
859 | tmp->stats.food = op->stats.food - 1; |
860 | |
860 | |
861 | tmp->stats.hp = op->stats.hp; /* The only variable it keeps. */ |
861 | tmp->stats.hp = op->stats.hp; /* The only variable it keeps. */ |
|
|
862 | |
862 | if (env) |
863 | if (env) |
863 | { |
|
|
864 | tmp = env->insert (tmp); |
864 | env->insert (tmp); |
865 | |
|
|
866 | /* If this object is the players inventory, we need to tell the |
|
|
867 | * client of the change. Insert_ob_in_map takes care of the |
|
|
868 | * updating the client, so we don't need to do that below. |
|
|
869 | */ |
|
|
870 | if (object *pl = op->in_player ()) |
|
|
871 | esrv_send_item (pl, tmp); |
|
|
872 | } |
|
|
873 | else |
865 | else |
874 | { |
866 | { |
875 | j = find_first_free_spot (tmp, op->map, op->x, op->y); |
867 | j = find_first_free_spot (tmp, op->map, op->x, op->y); |
876 | if (j < 0) /* No free spot */ |
868 | if (j < 0) /* No free spot */ |
877 | tmp->destroy (); |
869 | tmp->destroy (); |