ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/socket/item.C
(Generate patch)

Comparing deliantra/server/socket/item.C (file contents):
Revision 1.92 by root, Sun Apr 11 00:34:07 2010 UTC vs.
Revision 1.98 by root, Sat Dec 31 06:18:02 2011 UTC

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,2008,2009,2010 Marc Alexander Lehmann / Robin Redeker / the Deliantra team 4 * Copyright (©) 2005,2006,2007,2008,2009,2010,2011 Marc Alexander Lehmann / Robin Redeker / the Deliantra team
5 * Copyright (©) 2002 Mark Wedel & Crossfire Development Team 5 * Copyright (©) 2002 Mark Wedel & Crossfire Development Team
6 * Copyright (©) 1992 Frank Tore Johansen 6 * Copyright (©) 1992 Frank Tore Johansen
7 * 7 *
8 * Deliantra is free software: you can redistribute it and/or modify it under 8 * Deliantra is free software: you can redistribute it and/or modify it under
9 * the terms of the Affero GNU General Public License as published by the 9 * the terms of the Affero GNU General Public License as published by the
142 142
143 *len = sl.cur - len - 1; 143 *len = sl.cur - len - 1;
144 } 144 }
145 else 145 else
146 { 146 {
147 int len = min (head->custom_name.length (), 127); 147 int len = min (127, head->custom_name.length ());
148 148
149 sl << uint8 (len * 2 + 1) 149 sl << uint8 (len * 2 + 1)
150 << data (head->custom_name, len) 150 << data (head->custom_name, len)
151 << uint8 (0) 151 << uint8 (0)
152 << data (head->custom_name, len); 152 << data (head->custom_name, len);
193 { 193 {
194 LOG (llevDebug, "esrv_draw_look called when update_look was not set (player %s)\n", &ob->name); 194 LOG (llevDebug, "esrv_draw_look called when update_look was not set (player %s)\n", &ob->name);
195 return; 195 return;
196 } 196 }
197 197
198 if (pl->ns->need_delinv0)
199 {
200 pl->ns->need_delinv0 = 0;
201 pl->ns->send_packet ("delinv 0");
202 }
203
204 if (pl->run_on)
205 return;
206
198 pl->ns->update_look = 0; 207 pl->ns->update_look = 0;
208 pl->ns->need_delinv0 = 1;
199 209
200 if (ob->flag [FLAG_REMOVED] 210 if (ob->flag [FLAG_REMOVED]
201 || !ob->map 211 || !ob->map
202 || ob->map->in_memory != MAP_ACTIVE 212 || ob->map->state != MAP_ACTIVE
203 || out_of_map (ob->map, ob->x, ob->y)) 213 || out_of_map (ob->map, ob->x, ob->y))
204 return; 214 return;
205
206 pl->ns->send_packet ("delinv 0");
207 215
208 packet sl; 216 packet sl;
209 sl.printf ("item%d ", pl->ns->itemcmd); 217 sl.printf ("item%d ", pl->ns->itemcmd);
210 218
211 sl << uint32 (0); 219 sl << uint32 (0);
619 pl->ns->look_position = tag & 0x7fffffff; 627 pl->ns->look_position = tag & 0x7fffffff;
620 pl->ns->floorbox_update (); 628 pl->ns->floorbox_update ();
621 return; 629 return;
622 } 630 }
623 631
632 // the object might be legally gone already
624 object *op = esrv_get_ob_from_count (pl->ob, tag); 633 if (object *op = esrv_get_ob_from_count (pl->ob, tag))
625
626 if (!op)
627 {
628 LOG (llevDebug, "Player '%s' tried to apply the unknown object (%d)\n", &pl->ob->name, tag);
629 return;
630 }
631
632 pl->ob->apply (op, AP_TOGGLE); 634 pl->ob->apply (op, AP_TOGGLE);
633} 635}
634 636
635/** Client wants to lock some object. Lets do so. */ 637/** Client wants to lock some object. Lets do so. */
636void 638void
637LockItem (char *data, int len, player *pl) 639LockItem (char *data, int len, player *pl)

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines