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

Comparing deliantra/server/server/c_object.C (file contents):
Revision 1.38 by root, Wed Feb 7 23:50:01 2007 UTC vs.
Revision 1.39 by root, Sat Feb 10 21:01:10 2007 UTC

275 if (QUERY_FLAG (tmp, FLAG_WAS_WIZ) && !QUERY_FLAG (pl, FLAG_WAS_WIZ)) 275 if (QUERY_FLAG (tmp, FLAG_WAS_WIZ) && !QUERY_FLAG (pl, FLAG_WAS_WIZ))
276 { 276 {
277 new_draw_info (NDI_UNIQUE, 0, pl, "The object disappears in a puff of smoke!"); 277 new_draw_info (NDI_UNIQUE, 0, pl, "The object disappears in a puff of smoke!");
278 new_draw_info (NDI_UNIQUE, 0, pl, "It must have been an illusion."); 278 new_draw_info (NDI_UNIQUE, 0, pl, "It must have been an illusion.");
279 279
280 if (pl->type == PLAYER) 280 if (pl->contr)
281 esrv_del_item (pl->contr, tmp->count); 281 esrv_del_item (pl->contr, tmp->count);
282 282
283 tmp->destroy (); 283 tmp->destroy ();
284 return; 284 return;
285 } 285 }
301 { 301 {
302 new_draw_info (0, 0, pl, "That item is too heavy for you to pick up."); 302 new_draw_info (0, 0, pl, "That item is too heavy for you to pick up.");
303 return; 303 return;
304 } 304 }
305 305
306 if (settings.real_wiz == FALSE && QUERY_FLAG (pl, FLAG_WAS_WIZ))
307 SET_FLAG (tmp, FLAG_WAS_WIZ);
308
309 if (nrof != tmp_nrof) 306 if (nrof != tmp_nrof)
310 { 307 {
311 object *tmp2 = tmp; 308 object *tmp2 = tmp;
312 309
313 tmp = get_split_ob (tmp, nrof); 310 tmp = get_split_ob (tmp, nrof);
315 { 312 {
316 new_draw_info (NDI_UNIQUE, 0, pl, errmsg); 313 new_draw_info (NDI_UNIQUE, 0, pl, errmsg);
317 return; 314 return;
318 } 315 }
319 316
320 /* Tell a client what happened rest of objects */ 317 /* Tell the client what happened to the rest of objects */
321 if (pl->type == PLAYER) 318 if (pl->contr)
322 {
323 if (tmp2->destroyed ()) 319 if (tmp2->destroyed ())
324 esrv_del_item (pl->contr, tmp2->count); 320 esrv_del_item (pl->contr, tmp2->count);
325 else 321 else
326 esrv_send_item (pl, tmp2); 322 esrv_update_item (UPD_NROF, pl, tmp2);
327 }
328 } 323 }
329 else 324 else
330 { 325 {
331 /* If the object is in a container, send a delete to the client. 326 /* If the object is in a container, send a delete to the client.
332 * - we are moving all the items from the container to elsewhere, 327 * - we are moving all the items from the container to elsewhere,
334 */ 329 */
335 if (!QUERY_FLAG (tmp, FLAG_REMOVED)) 330 if (!QUERY_FLAG (tmp, FLAG_REMOVED))
336 { 331 {
337 if (tmp->env && pl->type == PLAYER) 332 if (tmp->env && pl->type == PLAYER)
338 esrv_del_item (pl->contr, tmp->count); 333 esrv_del_item (pl->contr, tmp->count);
334
339 tmp->remove (); /* Unlink it */ 335 tmp->remove (); /* Unlink it */
340 } 336 }
341 } 337 }
338
342 if (QUERY_FLAG (tmp, FLAG_UNPAID)) 339 if (QUERY_FLAG (tmp, FLAG_UNPAID))
343 (void) sprintf (buf, "%s will cost you %s.", query_name (tmp), query_cost_string (tmp, pl, F_BUY | F_SHOP)); 340 sprintf (buf, "%s will cost you %s.", query_name (tmp), query_cost_string (tmp, pl, F_BUY | F_SHOP));
344 else 341 else
345 (void) sprintf (buf, "You pick up the %s.", query_name (tmp)); 342 sprintf (buf, "You pick up the %s.", query_name (tmp));
343
346 new_draw_info (NDI_UNIQUE, 0, pl, buf); 344 new_draw_info (NDI_UNIQUE, 0, pl, buf);
347 345
348 tmp = insert_ob_in_ob (tmp, op); 346 tmp = insert_ob_in_ob (tmp, op);
349 347
350 /* All the stuff below deals with client/server code, and is only 348 /* All the stuff below deals with client/server code, and is only
351 * usable by players 349 * usable by players
352 */ 350 */
353 if (pl->type != PLAYER) 351 if (pl->contr)
354 return; 352 {
355
356 esrv_send_item (pl, tmp); 353 esrv_send_item (pl, tmp);
354
357 /* These are needed to update the weight for the container we 355 /* These are needed to update the weight for the container we
358 * are putting the object in. 356 * are putting the object in.
359 */ 357 */
360 if (op != pl) 358 if (op != pl)
361 { 359 {
362 esrv_update_item (UPD_WEIGHT, pl, op); 360 esrv_update_item (UPD_WEIGHT, pl, op);
363 esrv_send_item (pl, pl); 361 esrv_send_item (pl, pl);
364 } 362 }
365 363
366 /* Update the container the object was in */ 364 /* Update the container the object was in */
367 if (env && env != pl && env != op) 365 if (env && env != pl && env != op)
368 esrv_update_item (UPD_WEIGHT, pl, env); 366 esrv_update_item (UPD_WEIGHT, pl, env);
367 }
369} 368}
370 369
371/* modified slightly to allow monsters use this -b.t. 5-31-95 */ 370/* modified slightly to allow monsters use this -b.t. 5-31-95 */
372void 371void
373pick_up (object *op, object *alt) 372pick_up (object *op, object *alt)
432 431
433 if (!alt) 432 if (!alt)
434 for (alt = op->inv; alt; alt = alt->below) 433 for (alt = op->inv; alt; alt = alt->below)
435 if (alt->type == CONTAINER && QUERY_FLAG (alt, FLAG_APPLIED) && sack_can_hold (NULL, alt, tmp, count)) 434 if (alt->type == CONTAINER && QUERY_FLAG (alt, FLAG_APPLIED) && sack_can_hold (NULL, alt, tmp, count))
436 break; /* General container comes next */ 435 break; /* General container comes next */
436
437 if (!alt) 437 if (!alt)
438 alt = op; /* No free containers */ 438 alt = op; /* No free containers */
439 } 439 }
440 440
441 if (tmp->env == alt) 441 if (tmp->env == alt)
468 468
469leave: 469leave:
470 if (need_fix_tmp) 470 if (need_fix_tmp)
471 fix_stopped_item (tmp, tmp_map, op); 471 fix_stopped_item (tmp, tmp_map, op);
472} 472}
473
474 473
475/* This takes (picks up) and item. op is the player 474/* This takes (picks up) and item. op is the player
476 * who issued the command. params is a string to 475 * who issued the command. params is a string to
477 * match against the item name. Basically, always 476 * match against the item name. Basically, always
478 * returns zero, but that should be improved. 477 * returns zero, but that should be improved.
493 492
494 if (!tmp) 493 if (!tmp)
495 tmp = op->below; 494 tmp = op->below;
496 } 495 }
497 496
498 if (tmp == NULL) 497 if (!tmp)
499 { 498 {
500 new_draw_info (NDI_UNIQUE, 0, op, "Nothing to take!"); 499 new_draw_info (NDI_UNIQUE, 0, op, "Nothing to take!");
501 return 0; 500 return 0;
502 } 501 }
503 502
504 /* Makes processing easier */ 503 /* Makes processing easier */
505 if (params && *params == '\0') 504 if (params && *params == '\0')
506 params = NULL; 505 params = 0;
507 506
508 while (tmp) 507 while (tmp)
509 { 508 {
510 next = tmp->below; 509 next = tmp->below;
511 510

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines