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

Comparing deliantra/server/common/button.C (file contents):
Revision 1.8 by root, Mon Sep 11 20:28:37 2006 UTC vs.
Revision 1.9 by root, Wed Sep 13 23:42:23 2006 UTC

1 1
2/* 2/*
3 * static char *rcsid_button_c = 3 * static char *rcsid_button_c =
4 * "$Id: button.C,v 1.8 2006/09/11 20:28:37 root Exp $"; 4 * "$Id: button.C,v 1.9 2006/09/13 23:42:23 root Exp $";
5 */ 5 */
6 6
7/* 7/*
8 CrossFire, A Multiplayer game for X-windows 8 CrossFire, A Multiplayer game for X-windows
9 9
364 return 1; 364 return 1;
365 } 365 }
366 return 0; 366 return 0;
367} 367}
368 368
369
370/* 369/*
371 * operate_altar checks if sacrifice was accepted and removes sacrificed 370 * operate_altar checks if sacrifice was accepted and removes sacrificed
372 * objects. If sacrifice was succeed return 1 else 0. Might be better to 371 * objects. If sacrifice was succeed return 1 else 0. Might be better to
373 * call check_altar_sacrifice (above) than depend on the return value, 372 * call check_altar_sacrifice (above) than depend on the return value,
374 * since operate_altar will remove the sacrifice also. 373 * since operate_altar will remove the sacrifice also.
375 * 374 *
376 * If this function returns 1, '*sacrifice' is modified to point to the 375 * If this function returns 1, '*sacrifice' is modified to point to the
377 * remaining sacrifice, or is set to NULL if the sacrifice was used up. 376 * remaining sacrifice, or is set to NULL if the sacrifice was used up.
378 */ 377 */
379
380int 378int
381operate_altar (object *altar, object **sacrifice) 379operate_altar (object *altar, object **sacrifice)
382{ 380{
383
384 if (!altar->map) 381 if (!altar->map)
385 { 382 {
386 LOG (llevError, "BUG: operate_altar(): altar has no map\n"); 383 LOG (llevError, "BUG: operate_altar(): altar has no map\n");
387 return 0; 384 return 0;
388 } 385 }
401 int number = NROF_SACRIFICE (altar) / (*sacrifice)->value; 398 int number = NROF_SACRIFICE (altar) / (*sacrifice)->value;
402 399
403 /* Round up any sacrifices. Altars don't make change either */ 400 /* Round up any sacrifices. Altars don't make change either */
404 if (NROF_SACRIFICE (altar) % (*sacrifice)->value) 401 if (NROF_SACRIFICE (altar) % (*sacrifice)->value)
405 number++; 402 number++;
403
406 *sacrifice = decrease_ob_nr (*sacrifice, number); 404 *sacrifice = decrease_ob_nr (*sacrifice, number);
407 } 405 }
408 else 406 else
409 *sacrifice = decrease_ob_nr (*sacrifice, NROF_SACRIFICE (altar)); 407 *sacrifice = decrease_ob_nr (*sacrifice, NROF_SACRIFICE (altar));
410 408
411 if (altar->msg) 409 if (altar->msg)
412 new_info_map (NDI_BLACK, altar->map, altar->msg); 410 new_info_map (NDI_BLACK, altar->map, altar->msg);
411
413 return 1; 412 return 1;
414} 413}
415 414
416void 415void
417trigger_move (object *op, int state) /* 1 down and 0 up */ 416trigger_move (object *op, int state) /* 1 down and 0 up */

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines