1 | /* |
1 | /* |
2 | * This file is part of Deliantra, the Roguelike Realtime MMORPG. |
2 | * This file is part of Deliantra, the Roguelike Realtime MMORPG. |
3 | * |
3 | * |
4 | * Copyright (©) 2005,2006,2007 Marc Alexander Lehmann / Robin Redeker / the Deliantra team |
4 | * Copyright (©) 2005,2006,2007,2008 Marc Alexander Lehmann / Robin Redeker / the Deliantra team |
5 | * Copyright (©) 2002,2007 Mark Wedel & Crossfire Development Team |
5 | * Copyright (©) 2002,2007 Mark Wedel & Crossfire Development Team |
6 | * Copyright (©) 1992,2007 Frank Tore Johansen |
6 | * Copyright (©) 1992,2007 Frank Tore Johansen |
7 | * |
7 | * |
8 | * Deliantra is free software: you can redistribute it and/or modify |
8 | * Deliantra is free software: you can redistribute it and/or modify |
9 | * it under the terms of the GNU General Public License as published by |
9 | * it under the terms of the GNU General Public License as published by |
… | |
… | |
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 | { |
|
|
872 | esrv_del_item (pl->contr, op->count); |
|
|
873 | esrv_send_item (pl, tmp); |
|
|
874 | } |
|
|
875 | } |
|
|
876 | else |
865 | else |
877 | { |
866 | { |
878 | 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); |
879 | if (j < 0) /* No free spot */ |
868 | if (j < 0) /* No free spot */ |
880 | tmp->destroy (); |
869 | tmp->destroy (); |
… | |
… | |
1310 | { |
1299 | { |
1311 | if (QUERY_FLAG (op, FLAG_APPLIED)) |
1300 | if (QUERY_FLAG (op, FLAG_APPLIED)) |
1312 | remove_force (op); |
1301 | remove_force (op); |
1313 | else |
1302 | else |
1314 | { |
1303 | { |
1315 | /* If necessary, delete the item from the players inventory */ |
|
|
1316 | if (object *pl = op->in_player ()) |
|
|
1317 | esrv_del_item (pl->contr, op->count); |
|
|
1318 | |
|
|
1319 | op->remove (); |
1304 | op->remove (); |
1320 | |
1305 | |
1321 | if (QUERY_FLAG (op, FLAG_SEE_ANYWHERE)) |
1306 | if (QUERY_FLAG (op, FLAG_SEE_ANYWHERE)) |
1322 | make_sure_not_seen (op); |
1307 | make_sure_not_seen (op); |
1323 | |
1308 | |