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

Comparing deliantra/server/server/time.C (file contents):
Revision 1.35 by root, Tue Jan 9 01:28:32 2007 UTC vs.
Revision 1.41 by root, Sat Mar 17 20:34:19 2007 UTC

245 return; 245 return;
246 } 246 }
247 247
248 if (op->stats.food == 1) 248 if (op->stats.food == 1)
249 { 249 {
250 /* need to remove the object before fix_player is called, else fix_player 250 /* need to unapply the object before update_stats is called, else fix_player
251 * will not do anything. 251 * will not do anything.
252 */ 252 */
253 if (op->env->type == PLAYER) 253 if (op->env->type == PLAYER)
254 { 254 {
255 CLEAR_FLAG (op, FLAG_APPLIED); 255 CLEAR_FLAG (op, FLAG_APPLIED);
455 455
456 if (op->stats.hp) 456 if (op->stats.hp)
457 { 457 {
458 for (tmp2 = tmp->inv; tmp2; tmp2 = tmp2->below) 458 for (tmp2 = tmp->inv; tmp2; tmp2 = tmp2->below)
459 { 459 {
460 if (op->slaying && !strcmp (op->slaying, tmp->name)) 460 if (op->slaying && op->slaying == tmp->name)
461 detected = 1; 461 detected = 1;
462
462 if (tmp2->type == FORCE && tmp2->slaying && !strcmp (tmp2->slaying, op->slaying)) 463 if (tmp2->type == FORCE && tmp2->slaying && tmp2->slaying == op->slaying)
463 detected = 1; 464 detected = 1;
464 } 465 }
465 } 466 }
467
466 if (op->slaying && !strcmp (op->slaying, tmp->name)) 468 if (op->slaying && op->slaying == tmp->name)
467 {
468 detected = 1; 469 detected = 1;
469 }
470 else if (tmp->type == SPECIAL_KEY && tmp->slaying == op->slaying) 470 else if (tmp->type == SPECIAL_KEY && tmp->slaying == op->slaying)
471 detected = 1; 471 detected = 1;
472 } 472 }
473 473
474 /* the detector sets the button if detection is found */ 474 /* the detector sets the button if detection is found */
604void 604void
605fix_stopped_item (object *op, maptile *map, object *originator) 605fix_stopped_item (object *op, maptile *map, object *originator)
606{ 606{
607 if (map == NULL) 607 if (map == NULL)
608 return; 608 return;
609
609 if (QUERY_FLAG (op, FLAG_REMOVED)) 610 if (QUERY_FLAG (op, FLAG_REMOVED))
610 insert_ob_in_map (op, map, originator, 0); 611 insert_ob_in_map (op, map, originator, 0);
611 else if (op->type == ARROW) 612 else if (op->type == ARROW)
612 merge_ob (op, NULL); /* only some arrows actually need this */ 613 merge_ob (op, NULL); /* only some arrows actually need this */
613} 614}
614
615 615
616object * 616object *
617fix_stopped_arrow (object *op) 617fix_stopped_arrow (object *op)
618{ 618{
619 if (rndm (0, 99) < op->stats.food) 619 if (rndm (0, 99) < op->stats.food)
648 op->stats.hp = 0; 648 op->stats.hp = 0;
649 op->stats.grace = 0; 649 op->stats.grace = 0;
650 op->level = 0; 650 op->level = 0;
651 op->face = op->arch->clone.face; 651 op->face = op->arch->clone.face;
652 op->owner = NULL; /* So that stopped arrows will be saved */ 652 op->owner = NULL; /* So that stopped arrows will be saved */
653 update_object (op, UP_OBJ_FACE); 653 update_object (op, UP_OBJ_CHANGE);
654 return op; 654 return op;
655} 655}
656 656
657/* stop_arrow() - what to do when a non-living flying object 657/* stop_arrow() - what to do when a non-living flying object
658 * has to stop. Sept 96 - I added in thrown object code in 658 * has to stop. Sept 96 - I added in thrown object code in
684 } 684 }
685} 685}
686 686
687/* Move an arrow along its course. op is the arrow or thrown object. 687/* Move an arrow along its course. op is the arrow or thrown object.
688 */ 688 */
689
690void 689void
691move_arrow (object *op) 690move_arrow (object *op)
692{ 691{
693 object *tmp; 692 object *tmp;
694 sint16 new_x, new_y; 693 sint16 new_x, new_y;
765 * as below. (Note that for living creatures there is a small 764 * as below. (Note that for living creatures there is a small
766 * chance that reflect_missile fails.) 765 * chance that reflect_missile fails.)
767 */ 766 */
768 if (QUERY_FLAG (tmp, FLAG_REFL_MISSILE) && (rndm (0, 99)) < (90 - op->level / 10)) 767 if (QUERY_FLAG (tmp, FLAG_REFL_MISSILE) && (rndm (0, 99)) < (90 - op->level / 10))
769 { 768 {
770 int number = op->face->number; 769 int number = op->face;
771 770
772 op->direction = absdir (op->direction + 4); 771 op->direction = absdir (op->direction + 4);
773 op->state = 0; 772 op->state = 0;
774 773 update_turn_face (op);
775 if (GET_ANIM_ID (op))
776 {
777 number += 4;
778
779 if (number > GET_ANIMATION (op, 8))
780 number -= 8;
781
782 op->face = &new_faces[number];
783 }
784
785 was_reflected = 1; /* skip normal movement calculations */ 774 was_reflected = 1; /* skip normal movement calculations */
786 } 775 }
787 else 776 else
788 { 777 {
789 /* Attack the object. */ 778 /* Attack the object. */
1204 return; 1193 return;
1205 } 1194 }
1206 1195
1207 if (op->above == NULL) 1196 if (op->above == NULL)
1208 return; 1197 return;
1198
1209 for (tmp = op->above; tmp != NULL; tmp = tmp->above) 1199 for (tmp = op->above; tmp; tmp = tmp->above)
1210 { 1200 {
1211 if (strcmp (op->other_arch->name, tmp->arch->name) == 0) 1201 if (op->other_arch->name == tmp->arch->name)
1212 { 1202 {
1213 if (op->level <= 0) 1203 if (op->level <= 0)
1214 tmp->destroy (); 1204 tmp->destroy ();
1215 else 1205 else
1216 { 1206 {
1307 with a specific code as the slaying field. 1297 with a specific code as the slaying field.
1308 At that time, it writes the contents of its own message 1298 At that time, it writes the contents of its own message
1309 field to the player. The marker will decrement hp to 1299 field to the player. The marker will decrement hp to
1310 0 and then delete itself every time it grants a mark. 1300 0 and then delete itself every time it grants a mark.
1311 unless hp was zero to start with, in which case it is infinite.*/ 1301 unless hp was zero to start with, in which case it is infinite.*/
1312
1313void 1302void
1314move_marker (object *op) 1303move_marker (object *op)
1315{ 1304{
1316 if (object *tmp = op->ms ().player ()) 1305 if (object *tmp = op->ms ().player ())
1317 { 1306 {
1318 object *tmp2; 1307 object *tmp2;
1319 1308
1320 /* remove an old force with a slaying field == op->name */ 1309 /* remove an old force with a slaying field == op->name */
1321 for (tmp2 = tmp->inv; tmp2; tmp2 = tmp2->below) 1310 for (tmp2 = tmp->inv; tmp2; tmp2 = tmp2->below)
1322 if (tmp2->type == FORCE && tmp2->slaying && !strcmp (tmp2->slaying, op->name)) 1311 if (tmp2->type == FORCE && tmp2->slaying && tmp2->slaying == op->name)
1323 { 1312 {
1324 tmp2->destroy (); 1313 tmp2->destroy ();
1325 break; 1314 break;
1326 } 1315 }
1327 1316
1328 /* cycle through his inventory to look for the MARK we want to 1317 /* cycle through his inventory to look for the MARK we want to
1329 * place 1318 * place
1330 */ 1319 */
1331 for (tmp2 = tmp->inv; tmp2; tmp2 = tmp2->below) 1320 for (tmp2 = tmp->inv; tmp2; tmp2 = tmp2->below)
1332 if (tmp2->type == FORCE && tmp2->slaying && !strcmp (tmp2->slaying, op->slaying)) 1321 if (tmp2->type == FORCE && tmp2->slaying && tmp2->slaying == op->slaying)
1333 break; 1322 break;
1334 1323
1335 /* if we didn't find our own MARK */ 1324 /* if we didn't find our own MARK */
1336 if (tmp2 == NULL) 1325 if (!tmp2)
1337 { 1326 {
1338 object *force = get_archetype (FORCE_NAME); 1327 object *force = get_archetype (FORCE_NAME);
1339 1328
1340 if (op->stats.food) 1329 if (op->stats.food)
1341 { 1330 {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines