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

Comparing deliantra/server/server/player.C (file contents):
Revision 1.263 by root, Sat Apr 3 22:30:21 2010 UTC vs.
Revision 1.273 by root, Sun Apr 18 05:54:18 2010 UTC

54 54
55 players.insert (this); 55 players.insert (this);
56 ob->remove (); 56 ob->remove ();
57 ob->map = 0; 57 ob->map = 0;
58 ob->activate_recursive (); 58 ob->activate_recursive ();
59 CLEAR_FLAG (ob, FLAG_FRIENDLY); 59 ob->clr_flag (FLAG_FRIENDLY);
60 add_friendly_object (ob); 60 add_friendly_object (ob);
61} 61}
62 62
63void 63void
64player::deactivate () 64player::deactivate ()
75 75
76 ob->remove (); 76 ob->remove ();
77 ob->enemy = 0; // sometimes keeps an extra refcount on itself 77 ob->enemy = 0; // sometimes keeps an extra refcount on itself
78 ob->map = 0; 78 ob->map = 0;
79 party = 0; 79 party = 0;
80
81 combat_ob = ranged_ob = 0; //TODO, should be special marker, non-refcounted, not this
82 80
83 players.erase (this); 81 players.erase (this);
84} 82}
85 83
86// connect the player with a specific client 84// connect the player with a specific client
139 ob->flag [FLAG_READY_WEAPON] = false; 137 ob->flag [FLAG_READY_WEAPON] = false;
140 ob->flag [FLAG_READY_SKILL] = false; 138 ob->flag [FLAG_READY_SKILL] = false;
141 ob->flag [FLAG_READY_RANGE] = false; 139 ob->flag [FLAG_READY_RANGE] = false;
142 ob->flag [FLAG_READY_BOW] = false; 140 ob->flag [FLAG_READY_BOW] = false;
143 141
144 for (object *op = ob->inv; op; op = op->below)
145 if (op->flag [FLAG_APPLIED])
146 switch (op->type)
147 {
148 case SKILL:
149 op->flag [FLAG_APPLIED] = false;
150 break;
151
152 case SPELL:
153 case WAND:
154 case ROD:
155 case HORN:
156 case BOW:
157 case RANGED:
158 ranged_ob = op;
159 op->flag [FLAG_APPLIED] = false;
160 break;
161
162 case WEAPON:
163 combat_ob = op;
164 op->flag [FLAG_APPLIED] = false;
165 break;
166 }
167
168 ob->update_stats (); // we unapplied stuff above 142 ob->update_stats (); // we unapplied stuff above
169
170 ob->current_weapon = 0;
171 if (object *item = combat_ob ? combat_ob : ranged_ob)
172 ob->apply (item);
173
174 activate (); 143 activate ();
175 144
176 INVOKE_PLAYER (CONNECT, this); 145 INVOKE_PLAYER (CONNECT, this);
177 INVOKE_PLAYER (LOGIN, this); 146 INVOKE_PLAYER (LOGIN, this);
178} 147}
265 disconnect (); 234 disconnect ();
266 235
267 attachable::do_destroy (); 236 attachable::do_destroy ();
268 237
269 if (ob) 238 if (ob)
270 {
271 ob->destroy_inv (false);
272 ob->destroy (); 239 ob->destroy ();
273 }
274 240
275 ob = observe = viewpoint = 0; 241 ob = observe = viewpoint = 0;
276} 242}
277 243
278player::~player () 244player::~player ()
408 */ 374 */
409int 375int
410path_to_player (object *mon, object *pl, unsigned mindiff) 376path_to_player (object *mon, object *pl, unsigned mindiff)
411{ 377{
412 rv_vector rv; 378 rv_vector rv;
413 sint16 x, y;
414 int lastx, lasty, dir, i, diff, firstdir = 0, lastdir, max = MAX_SPACES, mflags, blocked; 379 int dir, i, diff, firstdir = 0, lastdir, max = MAX_SPACES, mflags, blocked;
415 maptile *m, *lastmap;
416 380
417 get_rangevector (mon, pl, &rv, 0); 381 get_rangevector (mon, pl, &rv, 0);
418 382
419 if (rv.distance < mindiff) 383 if (rv.distance < mindiff)
420 return 0; 384 return 0;
421 385
422 x = mon->x; 386 mapxy pos (mon);
423 y = mon->y;
424 m = mon->map;
425 dir = rv.direction; 387 dir = rv.direction;
426 lastdir = firstdir = rv.direction; /* perhaps we stand next to pl, init firstdir too */ 388 lastdir = firstdir = rv.direction; /* perhaps we stand next to pl, init firstdir too */
427 diff = ::max (abs (rv.distance_x), abs (rv.distance_y)); 389 diff = ::max (abs (rv.distance_x), abs (rv.distance_y));
428 390
429 /* If we can't solve it within the search distance, return now. */ 391 /* If we can't solve it within the search distance, return now. */
430 if (diff > max) 392 if (diff > max)
431 return 0; 393 return 0;
432 394
433 while (diff > 1 && max > 0) 395 while (diff > 1 && max > 0)
434 { 396 {
435 lastx = x; 397 mapxy lastpos = pos;
436 lasty = y; 398 pos.move (dir);
437 lastmap = m;
438 x = lastx + freearr_x[dir];
439 y = lasty + freearr_y[dir];
440 399
441 mflags = get_map_flags (m, &m, x, y, &x, &y); 400 MoveType blocked;
442 blocked = (mflags & P_OUT_OF_MAP) ? MOVE_ALL : GET_MAP_MOVE_BLOCK (m, x, y); 401 bool blocksview;
402
403 if (pos.normalise ())
404 {
405 mapspace &ms = *pos;
406
407 blocksview = ms.flags () & P_BLOCKSVIEW;
408 blocked = ms.move_block;
409 }
410 else
411 {
412 blocksview = true;
413 blocked = MOVE_ALL;
414 }
443 415
444 /* Space is blocked - try changing direction a little */ 416 /* Space is blocked - try changing direction a little */
445 if ((mflags & P_OUT_OF_MAP) || ((OB_TYPE_MOVE_BLOCK (mon, blocked) || (mflags & P_BLOCKSVIEW)) 417 if ((blocksview || OB_TYPE_MOVE_BLOCK (mon, blocked))
446 && (m == mon->map && blocked_link (mon, m, x, y)))) 418 && (blocked_link (mon, pos.m, pos.x, pos.y)))
447 { 419 {
448 /* recalculate direction from last good location. Possible 420 /* recalculate direction from last good location. Possible
449 * we were not traversing ideal location before. 421 * we were not traversing ideal location before.
450 */ 422 */
451 get_rangevector_from_mapcoord (lastmap, lastx, lasty, pl, &rv, 0); 423 get_rangevector_from_mapcoord (lastpos.m, lastpos.x, lastpos.y, pl, &rv, 0);
452 if (rv.direction != dir) 424 if (rv.direction != dir)
453 { 425 {
454 /* OK - says direction should be different - lets reset the 426 /* OK - says direction should be different - lets reset the
455 * the values so it will try again. 427 * the values so it will try again.
456 */ 428 */
457 x = lastx;
458 y = lasty;
459 m = lastmap; 429 pos = lastpos;
460 dir = firstdir = rv.direction; 430 dir = firstdir = rv.direction;
461 } 431 }
462 else 432 else
463 { 433 {
464 /* direct path is blocked - try taking a side step to 434 /* direct path is blocked - try taking a side step to
471 */ 441 */
472 for (i = -DETOUR_AMOUNT; i <= DETOUR_AMOUNT; i++) 442 for (i = -DETOUR_AMOUNT; i <= DETOUR_AMOUNT; i++)
473 { 443 {
474 if (i == 0) 444 if (i == 0)
475 continue; /* already did this, so skip it */ 445 continue; /* already did this, so skip it */
446
476 /* Use lastdir here - otherwise, 447 /* Use lastdir here - otherwise,
477 * since the direction that the creature should move in 448 * since the direction that the creature should move in
478 * may change, you could get infinite loops. 449 * may change, you could get infinite loops.
479 * ie, player is northwest, but monster can only 450 * ie, player is northwest, but monster can only
480 * move west, so it does that. It goes some distance, 451 * move west, so it does that. It goes some distance,
482 * can't do that, but now finds it can move east, and 453 * can't do that, but now finds it can move east, and
483 * gets back to its original point. lastdir contains 454 * gets back to its original point. lastdir contains
484 * the last direction the creature has successfully 455 * the last direction the creature has successfully
485 * moved. 456 * moved.
486 */ 457 */
487
488 x = lastx + freearr_x[absdir (lastdir + i)];
489 y = lasty + freearr_y[absdir (lastdir + i)];
490 m = lastmap; 458 pos = lastpos;
491 mflags = get_map_flags (m, &m, x, y, &x, &y); 459 pos.move (absdir (lastdir + i));
492 if (mflags & P_OUT_OF_MAP) 460
461 if (!pos.normalise ())
493 continue; 462 continue;
494 blocked = GET_MAP_MOVE_BLOCK (m, x, y); 463
495 if (OB_TYPE_MOVE_BLOCK (mon, blocked)) 464 mapspace &ms = *pos;
465
466 if (ms.flags () & P_BLOCKSVIEW)
496 continue; 467 continue;
497 if (mflags & P_BLOCKSVIEW) 468
469 if (OB_TYPE_MOVE_BLOCK (mon, ms.move_block))
498 continue; 470 continue;
499 471
500 if (m == mon->map && blocked_link (mon, m, x, y)) 472 if (blocked_link (mon, pos.m, pos.x, pos.y))
501 break; 473 break;
502 } 474 }
475
503 /* go through entire loop without finding a valid 476 /* go through entire loop without finding a valid
504 * sidestep to take - thus, no valid path. 477 * sidestep to take - thus, no valid path.
505 */ 478 */
506 if (i == (DETOUR_AMOUNT + 1)) 479 if (i == DETOUR_AMOUNT + 1)
507 return 0; 480 return 0;
481
508 diff--; 482 diff--;
509 lastdir = dir; 483 lastdir = dir;
510 max--; 484 max--;
511 if (!firstdir) 485 if (!firstdir)
512 firstdir = dir + i; 486 firstdir = dir + i;
516 { 490 {
517 /* we moved towards creature, so diff is less */ 491 /* we moved towards creature, so diff is less */
518 diff--; 492 diff--;
519 max--; 493 max--;
520 lastdir = dir; 494 lastdir = dir;
495
521 if (!firstdir) 496 if (!firstdir)
522 firstdir = dir; 497 firstdir = dir;
523 } 498 }
524 499
525 if (diff <= 1) 500 if (diff <= 1)
526 { 501 {
527 /* Recalculate diff (distance) because we may not have actually 502 /* Recalculate diff (distance) because we may not have actually
528 * headed toward player for entire distance. 503 * headed toward player for entire distance.
529 */ 504 */
530 get_rangevector_from_mapcoord (m, x, y, pl, &rv, 0); 505 get_rangevector_from_mapcoord (pos.m, pos.x, pos.y, pl, &rv, 0);
531 diff = ::max (abs (rv.distance_x), abs (rv.distance_y)); 506 diff = ::max (abs (rv.distance_x), abs (rv.distance_y));
532 } 507 }
533 508
534 if (diff > max) 509 if (diff > max)
535 return 0; 510 return 0;
553 next = op->below; 528 next = op->below;
554 529
555 /* Forces get applied per default, unless they have the 530 /* Forces get applied per default, unless they have the
556 * flag "neutral" set. Sorry but I can't think of a better way 531 * flag "neutral" set. Sorry but I can't think of a better way
557 */ 532 */
558 if (op->type == FORCE && !QUERY_FLAG (op, FLAG_NEUTRAL)) 533 if (op->type == FORCE && !op->flag [FLAG_NEUTRAL])
559 SET_FLAG (op, FLAG_APPLIED); 534 op->set_flag (FLAG_APPLIED);
560 535
561 /* we never give weapons/armour if these cannot be used 536 /* we never give weapons/armour if these cannot be used
562 * by this player due to race restrictions 537 * by this player due to race restrictions
563 */ 538 */
564 if (pl->type == PLAYER) 539 if (pl->type == PLAYER)
565 { 540 {
566 if ((!QUERY_FLAG (pl, FLAG_USE_ARMOUR) 541 if ((!pl->flag [FLAG_USE_ARMOUR]
567 && 542 &&
568 (op->type == ARMOUR || op->type == BOOTS 543 (op->type == ARMOUR || op->type == BOOTS
569 || op->type == CLOAK || op->type == HELMET 544 || op->type == CLOAK || op->type == HELMET
570 || op->type == SHIELD || op->type == GLOVES 545 || op->type == SHIELD || op->type == GLOVES
571 || op->type == BRACERS || op->type == GIRDLE)) 546 || op->type == BRACERS || op->type == GIRDLE))
572 || (!QUERY_FLAG (pl, FLAG_USE_WEAPON) && op->type == WEAPON)) 547 || (!pl->flag [FLAG_USE_WEAPON] && op->type == WEAPON))
573 { 548 {
574 op->destroy (); 549 op->destroy ();
575 continue; 550 continue;
576 } 551 }
577 } 552 }
594 if (op->nrof > 1) 569 if (op->nrof > 1)
595 op->nrof = 1; 570 op->nrof = 1;
596 } 571 }
597 572
598 if (op->type == SPELLBOOK && op->inv) 573 if (op->type == SPELLBOOK && op->inv)
599 CLEAR_FLAG (op->inv, FLAG_STARTEQUIP); 574 op->inv->clr_flag (FLAG_STARTEQUIP);
600 575
601 /* Give starting characters identified, uncursed, and undamned 576 /* Give starting characters identified, uncursed, and undamned
602 * items. Just don't identify gold or silver, or it won't be 577 * items. Just don't identify gold or silver, or it won't be
603 * merged properly. 578 * merged properly.
604 */ 579 */
605 if (need_identify (op)) 580 if (op->need_identify ())
606 { 581 {
607 SET_FLAG (op, FLAG_IDENTIFIED); 582 op->set_flag (FLAG_IDENTIFIED);
608 CLEAR_FLAG (op, FLAG_CURSED); 583 op->clr_flag (FLAG_CURSED);
609 CLEAR_FLAG (op, FLAG_DAMNED); 584 op->clr_flag (FLAG_DAMNED);
610 } 585 }
611 586
612 if (op->type == SPELL) 587 if (op->type == SPELL)
613 { 588 {
614 op->destroy (); 589 op->destroy ();
615 continue; 590 continue;
616 } 591 }
617 else if (op->type == SKILL) 592 else if (op->type == SKILL)
618 { 593 {
619 SET_FLAG (op, FLAG_CAN_USE_SKILL); 594 op->set_flag (FLAG_CAN_USE_SKILL);
620 op->stats.exp = 0; 595 op->stats.exp = 0;
621 op->level = 1; 596 op->level = 1;
622 } 597 }
623 else /* lock all 'normal items by default */ 598 else /* lock all 'normal items by default */
624 SET_FLAG (op, FLAG_INV_LOCKED); 599 op->set_flag (FLAG_INV_LOCKED);
625 } /* for loop of objects in player inv */ 600 } /* for loop of objects in player inv */
626 601
627 /* Need to set up the skill pointers */ 602 /* Need to set up the skill pointers */
628 pl->contr->link_skills (); 603 pl->contr->link_skills ();
629} 604}
763 738
764 if (ob->msg) 739 if (ob->msg)
765 ob->msg = 0; 740 ob->msg = 0;
766 741
767 start_info (ob); 742 start_info (ob);
768 CLEAR_FLAG (ob, FLAG_WIZ); 743 ob->clr_flag (FLAG_WIZ);
769 give_initial_items (ob, ob->randomitems); 744 give_initial_items (ob, ob->randomitems);
770 esrv_send_inventory (ob, ob); 745 esrv_send_inventory (ob, ob);
771 ob->update_stats (); 746 ob->update_stats ();
772 747
773 /* This moves the player to a different start map, if there 748 /* This moves the player to a different start map, if there
822 rv_vector rv; 797 rv_vector rv;
823 798
824 if (op->stats.hp < 0) 799 if (op->stats.hp < 0)
825 { 800 {
826 LOG (llevDebug, "Fleeing player is dead.\n"); 801 LOG (llevDebug, "Fleeing player is dead.\n");
827 CLEAR_FLAG (op, FLAG_SCARED); 802 op->clr_flag (FLAG_SCARED);
828 return; 803 return;
829 } 804 }
830 805
831 if (!op->enemy) 806 if (!op->enemy)
832 { 807 {
833 LOG (llevDebug, "Fleeing player had no enemy.\n"); 808 LOG (llevDebug, "Fleeing player had no enemy.\n");
834 CLEAR_FLAG (op, FLAG_SCARED); 809 op->clr_flag (FLAG_SCARED);
835 return; 810 return;
836 } 811 }
837 812
838 if (!(random_roll (0, 4, op, PREFER_LOW)) && did_make_save (op, op->level, 0)) 813 if (!(random_roll (0, 4, op, PREFER_LOW)) && did_make_save (op, op->level, 0))
839 { 814 {
840 op->enemy = NULL; 815 op->enemy = NULL;
841 CLEAR_FLAG (op, FLAG_SCARED); 816 op->clr_flag (FLAG_SCARED);
842 return; 817 return;
843 } 818 }
844 819
845 get_rangevector (op, op->enemy, &rv, 0); 820 get_rangevector (op, op->enemy, &rv, 0);
846 821
852 if (op->move (absdir (dir + diff * m)) || (diff == 0 && op->move (absdir (dir - diff * m)))) 827 if (op->move (absdir (dir + diff * m)) || (diff == 0 && op->move (absdir (dir - diff * m))))
853 return; 828 return;
854 } 829 }
855 830
856 /* Cornered, get rid of scared */ 831 /* Cornered, get rid of scared */
857 CLEAR_FLAG (op, FLAG_SCARED); 832 op->clr_flag (FLAG_SCARED);
858 op->enemy = NULL; 833 op->enemy = NULL;
859} 834}
860 835
861/* check_pick sees if there is stuff to be picked up/picks up stuff. 836/* check_pick sees if there is stuff to be picked up/picks up stuff.
862 * It returns 1 if the player should keep on moving, 0 if he should 837 * It returns 1 if the player should keep on moving, 0 if he should
954 * fighting */ 929 * fighting */
955 if (op->contr->mode & PU_INHIBIT) 930 if (op->contr->mode & PU_INHIBIT)
956 return 1; 931 return 1;
957 932
958 /* prevent us from turning into auto-thieves :) */ 933 /* prevent us from turning into auto-thieves :) */
959 if (QUERY_FLAG (tmp, FLAG_UNPAID)) 934 if (tmp->flag [FLAG_UNPAID])
960 continue; 935 continue;
961 936
962 /* ignore known cursed objects */ 937 /* ignore known cursed objects */
963 if (QUERY_FLAG (tmp, FLAG_KNOWN_CURSED) && op->contr->mode & PU_NOT_CURSED) 938 if (tmp->flag [FLAG_KNOWN_CURSED] && op->contr->mode & PU_NOT_CURSED)
964 continue; 939 continue;
965 940
966 /* all food and drink if desired */ 941 /* all food and drink if desired */
967 /* question: don't pick up known-poisonous stuff? */ 942 /* question: don't pick up known-poisonous stuff? */
968 if (op->contr->mode & PU_FOOD) 943 if (op->contr->mode & PU_FOOD)
971 CHK_PICK_PICKUP; 946 CHK_PICK_PICKUP;
972 continue; 947 continue;
973 } 948 }
974 949
975 if (op->contr->mode & PU_DRINK) 950 if (op->contr->mode & PU_DRINK)
976 if (tmp->type == DRINK || (tmp->type == POISON && !QUERY_FLAG (tmp, FLAG_KNOWN_CURSED))) 951 if (tmp->type == DRINK || (tmp->type == POISON && !tmp->flag [FLAG_KNOWN_CURSED]))
977 { 952 {
978 CHK_PICK_PICKUP; 953 CHK_PICK_PICKUP;
979 continue; 954 continue;
980 } 955 }
981 956
1019 continue; 994 continue;
1020 } 995 }
1021 996
1022 /* pick up all magical items */ 997 /* pick up all magical items */
1023 if (op->contr->mode & PU_MAGICAL) 998 if (op->contr->mode & PU_MAGICAL)
1024 if (QUERY_FLAG (tmp, FLAG_KNOWN_MAGICAL) 999 if (tmp->flag [FLAG_KNOWN_MAGICAL]
1025 && !QUERY_FLAG (tmp, FLAG_KNOWN_CURSED)) 1000 && !tmp->flag [FLAG_KNOWN_CURSED])
1026 { 1001 {
1027 CHK_PICK_PICKUP; 1002 CHK_PICK_PICKUP;
1028 continue; 1003 continue;
1029 } 1004 }
1030 1005
1114 continue; 1089 continue;
1115 } 1090 }
1116 1091
1117 /* hoping to catch throwing daggers here */ 1092 /* hoping to catch throwing daggers here */
1118 if (op->contr->mode & PU_MISSILEWEAPON) 1093 if (op->contr->mode & PU_MISSILEWEAPON)
1119 if (tmp->type == WEAPON && QUERY_FLAG (tmp, FLAG_IS_THROWN)) 1094 if (tmp->type == WEAPON && tmp->flag [FLAG_IS_THROWN])
1120 { 1095 {
1121 CHK_PICK_PICKUP; 1096 CHK_PICK_PICKUP;
1122 continue; 1097 continue;
1123 } 1098 }
1124 1099
1179 * return 0. 1154 * return 0.
1180 */ 1155 */
1181static int 1156static int
1182action_makes_visible (object *op) 1157action_makes_visible (object *op)
1183{ 1158{
1184 if (op->invisible && QUERY_FLAG (op, FLAG_ALIVE)) 1159 if (op->invisible && op->flag [FLAG_ALIVE])
1185 { 1160 {
1186 if (QUERY_FLAG (op, FLAG_MAKE_INVIS)) 1161 if (op->flag [FLAG_MAKE_INVIS])
1187 { 1162 {
1188 // artefact invisibility is permanent, but we still make noise 1163 // artefact invisibility is permanent, but we still make noise
1189 // this is important for game-balance. 1164 // this is important for game-balance.
1190 if (op->contr) 1165 if (op->contr)
1191 op->make_noise (); 1166 op->make_noise ();
1218 for (object *tmp = op->inv; tmp; tmp = tmp->below) 1193 for (object *tmp = op->inv; tmp; tmp = tmp->below)
1219 if (tmp->type == ARROW && !strcmp (&tmp->race, type)) 1194 if (tmp->type == ARROW && !strcmp (&tmp->race, type))
1220 return splay (tmp); 1195 return splay (tmp);
1221 1196
1222 for (object *tmp = op->inv; tmp; tmp = tmp->below) 1197 for (object *tmp = op->inv; tmp; tmp = tmp->below)
1223 if (tmp->type == CONTAINER && QUERY_FLAG (tmp, FLAG_APPLIED) && !strcmp (&tmp->race, type)) 1198 if (tmp->type == CONTAINER && tmp->flag [FLAG_APPLIED] && !strcmp (&tmp->race, type))
1224 if (object *arrow = find_arrow (tmp, type)) 1199 if (object *arrow = find_arrow (tmp, type))
1225 { 1200 {
1226 splay (tmp); 1201 splay (tmp);
1227 return arrow; 1202 return arrow;
1228 } 1203 }
1245 if (!type) 1220 if (!type)
1246 return NULL; 1221 return NULL;
1247 1222
1248 for (arrow = op->inv; arrow; arrow = arrow->below) 1223 for (arrow = op->inv; arrow; arrow = arrow->below)
1249 { 1224 {
1250 if (arrow->type == CONTAINER && arrow->race == type && QUERY_FLAG (arrow, FLAG_APPLIED)) 1225 if (arrow->type == CONTAINER && arrow->race == type && arrow->flag [FLAG_APPLIED])
1251 { 1226 {
1252 i = 0; 1227 i = 0;
1253 ntmp = find_better_arrow (arrow, target, type, &i); 1228 ntmp = find_better_arrow (arrow, target, type, &i);
1254 1229
1255 if (i > betterby) 1230 if (i > betterby)
1356 break; 1331 break;
1357 } 1332 }
1358 1333
1359 if (mflags & P_IS_ALIVE) 1334 if (mflags & P_IS_ALIVE)
1360 for (tmp = GET_MAP_OB (m, x, y); tmp; tmp = tmp->above) 1335 for (tmp = GET_MAP_OB (m, x, y); tmp; tmp = tmp->above)
1361 if (QUERY_FLAG (tmp, FLAG_ALIVE)) 1336 if (tmp->flag [FLAG_ALIVE])
1362 break; 1337 break;
1363 } 1338 }
1364 1339
1365 if (!tmp) 1340 if (!tmp)
1366 return find_arrow (op, type); 1341 return find_arrow (op, type);
1427 { 1402 {
1428 if (op->type == PLAYER) 1403 if (op->type == PLAYER)
1429 new_draw_info_format (NDI_UNIQUE, 0, op, "You have no %s left.", &bow->race); 1404 new_draw_info_format (NDI_UNIQUE, 0, op, "You have no %s left.", &bow->race);
1430 /* FLAG_READY_BOW will get reset if the monsters picks up some arrows */ 1405 /* FLAG_READY_BOW will get reset if the monsters picks up some arrows */
1431 else 1406 else
1432 CLEAR_FLAG (op, FLAG_READY_BOW); 1407 op->clr_flag (FLAG_READY_BOW);
1433 1408
1434 return 0; 1409 return 0;
1435 } 1410 }
1436 } 1411 }
1437 1412
1637 { 1612 {
1638 object *tmp; 1613 object *tmp;
1639 1614
1640 if (item->arch) 1615 if (item->arch)
1641 { 1616 {
1642 CLEAR_FLAG (item, FLAG_ANIMATE); 1617 item->clr_flag (FLAG_ANIMATE);
1643 item->face = item->arch->face; 1618 item->face = item->arch->face;
1644 item->set_speed (0); 1619 item->set_speed (0);
1645 } 1620 }
1646 1621
1647 if (object *pl = item->visible_to ()) 1622 if (object *pl = item->visible_to ())
1775 * 1750 *
1776 * Change the color so that the message doesn't disappear with 1751 * Change the color so that the message doesn't disappear with
1777 * all the others. 1752 * all the others.
1778 */ 1753 */
1779 if (pl->contr->usekeys == key_inventory 1754 if (pl->contr->usekeys == key_inventory
1780 || !QUERY_FLAG (container, FLAG_APPLIED) 1755 || !container->flag [FLAG_APPLIED]
1781 || (pl->contr->usekeys == keyrings && container->race != shstr_keys)) 1756 || (pl->contr->usekeys == keyrings && container->race != shstr_keys))
1782 { 1757 {
1783 new_draw_info_format (NDI_UNIQUE | NDI_BROWN, 0, pl, 1758 new_draw_info_format (NDI_UNIQUE | NDI_BROWN, 0, pl,
1784 "The %s in your %s vibrates as you approach the door", query_name (tmp), query_name (container)); 1759 "The %s in your %s vibrates as you approach the door", query_name (tmp), query_name (container));
1785 return NULL; 1760 return NULL;
1936 */ 1911 */
1937 if (op->type == PLAYER 1912 if (op->type == PLAYER
1938 && ((mon->owner && mon->owner->contr 1913 && ((mon->owner && mon->owner->contr
1939 && same_party (mon->owner->contr->party, op->contr->party)) 1914 && same_party (mon->owner->contr->party, op->contr->party))
1940 || mon->owner == op) 1915 || mon->owner == op)
1941 && (QUERY_FLAG (mon, FLAG_UNAGGRESSIVE) || QUERY_FLAG (mon, FLAG_FRIENDLY))) 1916 && (mon->flag [FLAG_UNAGGRESSIVE] || mon->flag [FLAG_FRIENDLY]))
1942 { 1917 {
1943 /* If we're braced, we don't want to switch places with it */ 1918 /* If we're braced, we don't want to switch places with it */
1944 if (op->contr->braced) 1919 if (op->contr->braced)
1945 return false; 1920 return false;
1946 1921
1966 * creatures. Note that if you are braced, you can't push 1941 * creatures. Note that if you are braced, you can't push
1967 * someone, but put it inside this loop so that you won't 1942 * someone, but put it inside this loop so that you won't
1968 * attack them either. 1943 * attack them either.
1969 */ 1944 */
1970 if ((mon->type == PLAYER || mon->enemy != op) 1945 if ((mon->type == PLAYER || mon->enemy != op)
1971 && (mon->type == PLAYER || QUERY_FLAG (mon, FLAG_UNAGGRESSIVE) || QUERY_FLAG (mon, FLAG_FRIENDLY)) 1946 && (mon->type == PLAYER || mon->flag [FLAG_UNAGGRESSIVE] || mon->flag [FLAG_FRIENDLY])
1972 && ((op->contr->peaceful 1947 && ((op->contr->peaceful
1973 || (mon->type == PLAYER && mon->contr->peaceful)) 1948 || (mon->type == PLAYER && mon->contr->peaceful))
1974 && !on_battleground)) 1949 && !on_battleground))
1975 { 1950 {
1976 if (op->speed_left > 0.f) 1951 if (op->speed_left > 0.f)
1992 } 1967 }
1993 } 1968 }
1994 /* If the object is a boulder or other rollable object, then 1969 /* If the object is a boulder or other rollable object, then
1995 * roll it if not braced. You can't roll it if you are braced. 1970 * roll it if not braced. You can't roll it if you are braced.
1996 */ 1971 */
1997 else if (QUERY_FLAG (mon, FLAG_CAN_ROLL) && (!op->contr->braced)) 1972 else if (mon->flag [FLAG_CAN_ROLL] && (!op->contr->braced))
1998 { 1973 {
1999 if (op->speed_left > 0.f) 1974 if (op->speed_left > 0.f)
2000 { 1975 {
2001 --op->speed_left; 1976 --op->speed_left;
2002 1977
2011 * Way it works is like this: First, it must have some hit points 1986 * Way it works is like this: First, it must have some hit points
2012 * and be living. Then, it must be one of the following: 1987 * and be living. Then, it must be one of the following:
2013 * 1) Not a player, 2) A player, but of a different party. Note 1988 * 1) Not a player, 2) A player, but of a different party. Note
2014 * that party_number -1 is no party, so attacks can still happen. 1989 * that party_number -1 is no party, so attacks can still happen.
2015 */ 1990 */
2016 else if ((mon->stats.hp >= 0) && QUERY_FLAG (mon, FLAG_ALIVE) && 1991 else if ((mon->stats.hp >= 0) && mon->flag [FLAG_ALIVE] &&
2017 ((mon->type != PLAYER || op->contr->party == NULL || op->contr->party != mon->contr->party))) 1992 ((mon->type != PLAYER || op->contr->party == NULL || op->contr->party != mon->contr->party)))
2018 { 1993 {
2019 if (op->contr->weapon_sp_left > 0.f && !op->flag [FLAG_WIZPASS]) 1994 if (op->contr->weapon_sp_left > 0.f && !op->flag [FLAG_WIZPASS])
2020 { 1995 {
2021 --op->contr->weapon_sp_left; 1996 --op->contr->weapon_sp_left;
2037{ 2012{
2038 if (!op->map || op->map->in_memory != MAP_ACTIVE) 2013 if (!op->map || op->map->in_memory != MAP_ACTIVE)
2039 return 0; 2014 return 0;
2040 2015
2041 /* Sanity check: make sure dir is valid */ 2016 /* Sanity check: make sure dir is valid */
2042 if (dir < 0 || dir >= 9) 2017 if (dir < 0 || dir > 8)
2043 { 2018 {
2044 LOG (llevError, "move_player: invalid direction %d\n", dir); 2019 LOG (llevError, "move_player: invalid direction %d\n", dir);
2045 return 0; 2020 return 0;
2046 } 2021 }
2047 2022
2048 /* peterm: added following line */ 2023 /* peterm: added following line */
2049 if (QUERY_FLAG (op, FLAG_CONFUSED) && dir) 2024 if (op->flag [FLAG_CONFUSED] && dir)
2050 dir = absdir (dir + rndm (3) + rndm (3) - 2); 2025 dir = absdir (dir + rndm (3) + rndm (3) - 2);
2051 2026
2052 op->facing = dir; 2027 op->facing = dir;
2053 2028
2054 if (op->flag [FLAG_HIDDEN]) 2029 if (op->flag [FLAG_HIDDEN])
2094 * players. 2069 * players.
2095 */ 2070 */
2096bool 2071bool
2097handle_newcs_player (object *op) 2072handle_newcs_player (object *op)
2098{ 2073{
2099 if (QUERY_FLAG (op, FLAG_SCARED)) 2074 if (op->flag [FLAG_SCARED])
2100 { 2075 {
2101 if (op->speed_left > 0.f) 2076 if (op->speed_left > 0.f)
2102 { 2077 {
2103 --op->speed_left; 2078 --op->speed_left;
2104 flee_player (op); 2079 flee_player (op);
2123} 2098}
2124 2099
2125static int 2100static int
2126save_life (object *op) 2101save_life (object *op)
2127{ 2102{
2128 if (!QUERY_FLAG (op, FLAG_LIFESAVE)) 2103 if (!op->flag [FLAG_LIFESAVE])
2129 return 0; 2104 return 0;
2130 2105
2131 for (object *tmp = op->inv; tmp; tmp = tmp->below) 2106 for (object *tmp = op->inv; tmp; tmp = tmp->below)
2132 if (QUERY_FLAG (tmp, FLAG_APPLIED) && QUERY_FLAG (tmp, FLAG_LIFESAVE)) 2107 if (tmp->flag [FLAG_APPLIED] && tmp->flag [FLAG_LIFESAVE])
2133 { 2108 {
2134 op->play_sound (sound_find ("ob_evaporate")); 2109 op->play_sound (sound_find ("ob_evaporate"));
2135 new_draw_info_format (NDI_UNIQUE, 0, op, "Your %s vibrates violently, then evaporates.", query_name (tmp)); 2110 new_draw_info_format (NDI_UNIQUE, 0, op, "Your %s vibrates violently, then evaporates.", query_name (tmp));
2136 2111
2137 tmp->destroy (); 2112 tmp->destroy ();
2138 CLEAR_FLAG (op, FLAG_LIFESAVE); 2113 op->clr_flag (FLAG_LIFESAVE);
2139 2114
2140 if (op->stats.hp < 0) 2115 if (op->stats.hp < 0)
2141 op->stats.hp = op->stats.maxhp; 2116 op->stats.hp = op->stats.maxhp;
2142 2117
2143 if (op->stats.food < 0) 2118 if (op->stats.food < 0)
2146 op->update_stats (); 2121 op->update_stats ();
2147 return 1; 2122 return 1;
2148 } 2123 }
2149 2124
2150 LOG (llevError, "Error: LIFESAVE set without applied object.\n"); 2125 LOG (llevError, "Error: LIFESAVE set without applied object.\n");
2151 CLEAR_FLAG (op, FLAG_LIFESAVE); 2126 op->clr_flag (FLAG_LIFESAVE);
2152 enter_player_savebed (op); /* bring him home. */ 2127 enter_player_savebed (op); /* bring him home. */
2153 return 0; 2128 return 0;
2154} 2129}
2155 2130
2156/* This goes throws the inventory and removes unpaid objects, and puts them 2131/* This goes throws the inventory and removes unpaid objects, and puts them
2163{ 2138{
2164 while (op) 2139 while (op)
2165 { 2140 {
2166 object *next = op->below; /* Make sure we have a good value, in case we remove object 'op' */ 2141 object *next = op->below; /* Make sure we have a good value, in case we remove object 'op' */
2167 2142
2168 if (QUERY_FLAG (op, FLAG_UNPAID)) 2143 if (op->flag [FLAG_UNPAID])
2169 op->insert_at (env); 2144 op->insert_at (env);
2170 else if (op->inv) 2145 else if (op->inv)
2171 drop_unpaid_items (op->inv, env); 2146 drop_unpaid_items (op->inv, env);
2172 2147
2173 op = next; 2148 op = next;
2203 * alternate it here for it to work correctly. 2178 * alternate it here for it to work correctly.
2204 */ 2179 */
2205 if (pticks & 2) 2180 if (pticks & 2)
2206 op->invisible--; 2181 op->invisible--;
2207 } 2182 }
2208 else if (op->invisible && !(QUERY_FLAG (op, FLAG_MAKE_INVIS))) 2183 else if (op->invisible && !(op->flag [FLAG_MAKE_INVIS]))
2209 { 2184 {
2210 if (!op->invisible--) 2185 if (!op->invisible--)
2211 { 2186 {
2212 make_visible (op); 2187 make_visible (op);
2213 new_draw_info (NDI_UNIQUE, 0, op, "Your invisibility spell runs out."); 2188 new_draw_info (NDI_UNIQUE, 0, op, "Your invisibility spell runs out.");
2280 if (op->stats.sp < op->stats.maxsp) 2255 if (op->stats.sp < op->stats.maxsp)
2281 { 2256 {
2282 op->stats.sp++; 2257 op->stats.sp++;
2283 2258
2284 /* dms do not consume food */ 2259 /* dms do not consume food */
2285 if (!QUERY_FLAG (op, FLAG_WIZ)) 2260 if (!op->flag [FLAG_WIZ])
2286 { 2261 {
2287 op->stats.food--; 2262 op->stats.food--;
2288 2263
2289 if (op->contr->digestion < 0) 2264 if (op->contr->digestion < 0)
2290 op->stats.food += op->contr->digestion; 2265 op->stats.food += op->contr->digestion;
2324 if (op->stats.hp < op->stats.maxhp) 2299 if (op->stats.hp < op->stats.maxhp)
2325 { 2300 {
2326 op->stats.hp++; 2301 op->stats.hp++;
2327 2302
2328 /* dms do not consume food */ 2303 /* dms do not consume food */
2329 if (!QUERY_FLAG (op, FLAG_WIZ)) 2304 if (!op->flag [FLAG_WIZ])
2330 { 2305 {
2331 op->stats.food--; 2306 op->stats.food--;
2332 2307
2333 if (op->contr->digestion < 0) 2308 if (op->contr->digestion < 0)
2334 op->stats.food += op->contr->digestion; 2309 op->stats.food += op->contr->digestion;
2361 penalty = max (0, -op->contr->digestion); 2336 penalty = max (0, -op->contr->digestion);
2362 2337
2363 op->last_eat = 25 * (1 + bonus) / (max (0, op->contr->gen_hp) + penalty + 1); 2338 op->last_eat = 25 * (1 + bonus) / (max (0, op->contr->gen_hp) + penalty + 1);
2364 2339
2365 /* dms do not consume food */ 2340 /* dms do not consume food */
2366 if (!QUERY_FLAG (op, FLAG_WIZ)) 2341 if (!op->flag [FLAG_WIZ])
2367 op->stats.food--; 2342 op->stats.food--;
2368 } 2343 }
2369 2344
2370 if (op->stats.food < 0 && op->stats.hp >= 0) 2345 if (op->stats.food < 0 && op->stats.hp >= 0)
2371 { 2346 {
2372 object *flesh = 0; 2347 object *flesh = 0;
2373 2348
2374 for_inv_removable (op, tmp) 2349 for_inv_removable (op, tmp)
2375 { 2350 {
2376 if (QUERY_FLAG (tmp, FLAG_UNPAID)) 2351 if (tmp->flag [FLAG_UNPAID])
2377 continue; 2352 continue;
2378 2353
2379 if (tmp->type == FOOD || tmp->type == DRINK || tmp->type == POISON) 2354 if (tmp->type == FOOD || tmp->type == DRINK || tmp->type == POISON)
2380 { 2355 {
2381 op->statusmsg ("You blindly grab for a bite of food. " 2356 op->statusmsg ("You blindly grab for a bite of food. "
2416 op->contr->killer->destroy (); 2391 op->contr->killer->destroy ();
2417 } 2392 }
2418 } 2393 }
2419 2394
2420 /* killer should be set here already */ 2395 /* killer should be set here already */
2421 if (op->stats.hp < 0 && !QUERY_FLAG (op, FLAG_WIZ)) 2396 if (op->stats.hp < 0 && !op->flag [FLAG_WIZ])
2422 kill_player (op); 2397 kill_player (op);
2423 } 2398 }
2424} 2399}
2425 2400
2426/* If the player should die (lack of hp, food, etc), we call this. 2401/* If the player should die (lack of hp, food, etc), we call this.
2621 * difference. 2596 * difference.
2622 */ 2597 */
2623 if (this_stat >= -50) 2598 if (this_stat >= -50)
2624 { 2599 {
2625 change_attr_value (&(dep->stats), i, -1); 2600 change_attr_value (&(dep->stats), i, -1);
2626 SET_FLAG (dep, FLAG_APPLIED); 2601 dep->set_flag (FLAG_APPLIED);
2627 new_draw_info (NDI_UNIQUE, 0, op, lose_msg[i]); 2602 new_draw_info (NDI_UNIQUE, 0, op, lose_msg[i]);
2628 op->update_stats (); 2603 op->update_stats ();
2629 lost_a_stat = 1; 2604 lost_a_stat = 1;
2630 } 2605 }
2631 } 2606 }
2702 2677
2703 force = get_archetype (FORCE_NAME); 2678 force = get_archetype (FORCE_NAME);
2704 /* 50 ticks should be enough time for the spell to abate */ 2679 /* 50 ticks should be enough time for the spell to abate */
2705 force->speed = 0.1f; 2680 force->speed = 0.1f;
2706 force->speed_left = -5.f; 2681 force->speed_left = -5.f;
2707 SET_FLAG (force, FLAG_APPLIED); 2682 force->set_flag (FLAG_APPLIED);
2708 for (at = 0; at < NROFATTACKS; at++) 2683 for (at = 0; at < NROFATTACKS; at++)
2709 if (will_kill_again & (1 << at)) 2684 if (will_kill_again & (1 << at))
2710 force->resist[at] = 100; 2685 force->resist[at] = 100;
2711 2686
2712 insert_ob_in_ob (force, op); 2687 insert_ob_in_ob (force, op);
2734 tmp->x = op->x, tmp->y = op->y; 2709 tmp->x = op->x, tmp->y = op->y;
2735 2710
2736 if (tmp->type == CONTAINER) 2711 if (tmp->type == CONTAINER)
2737 loot_object (tmp); /* empty container to ground */ 2712 loot_object (tmp); /* empty container to ground */
2738 2713
2739 if (!QUERY_FLAG (tmp, FLAG_UNIQUE) && (QUERY_FLAG (tmp, FLAG_STARTEQUIP) || QUERY_FLAG (tmp, FLAG_NO_DROP) || !(rndm (3)))) 2714 if (!tmp->flag [FLAG_UNIQUE] && (tmp->flag [FLAG_STARTEQUIP] || tmp->flag [FLAG_NO_DROP] || !(rndm (3))))
2740 { 2715 {
2741 if (tmp->nrof > 1) 2716 if (tmp->nrof > 1)
2742 { 2717 {
2743 tmp->decrease (rndm (1, tmp->nrof - 1)); 2718 tmp->decrease (rndm (1, tmp->nrof - 1));
2744 insert_ob_in_map (tmp, op->map, NULL, 0); 2719 insert_ob_in_map (tmp, op->map, NULL, 0);
2834} 2809}
2835 2810
2836int 2811int
2837is_true_undead (object *op) 2812is_true_undead (object *op)
2838{ 2813{
2839 if (QUERY_FLAG (op->arch, FLAG_UNDEAD)) 2814 if (op->arch->flag [FLAG_UNDEAD])
2840 return 1; 2815 return 1;
2841 2816
2842 return 0; 2817 return 0;
2843} 2818}
2844 2819
2942 2917
2943 if (who->type == PLAYER) 2918 if (who->type == PLAYER)
2944 player = 1; 2919 player = 1;
2945 2920
2946 else 2921 else
2947 friendly = QUERY_FLAG (who, FLAG_FRIENDLY); 2922 friendly = who->flag [FLAG_FRIENDLY];
2948 2923
2949 /* search adjacent squares */ 2924 /* search adjacent squares */
2950 for (i = 1; i < 9; i++) 2925 for (i = 1; i < 9; i++)
2951 { 2926 {
2952 x = who->x + freearr_x[i]; 2927 x = who->x + freearr_x[i];
2961 if (OB_TYPE_MOVE_BLOCK (who, GET_MAP_MOVE_BLOCK (m, x, y))) 2936 if (OB_TYPE_MOVE_BLOCK (who, GET_MAP_MOVE_BLOCK (m, x, y)))
2962 continue; 2937 continue;
2963 2938
2964 for (tmp = GET_MAP_OB (m, x, y); tmp; tmp = tmp->above) 2939 for (tmp = GET_MAP_OB (m, x, y); tmp; tmp = tmp->above)
2965 { 2940 {
2966 if ((player ||friendly) &&QUERY_FLAG (tmp, FLAG_MONSTER) && !QUERY_FLAG (tmp, FLAG_UNAGGRESSIVE)) 2941 if ((player ||friendly) &&tmp->flag [FLAG_MONSTER] && !tmp->flag [FLAG_UNAGGRESSIVE])
2967 return 1; 2942 return 1;
2968 else if (tmp->type == PLAYER) 2943 else if (tmp->type == PLAYER)
2969 { 2944 {
2970 /*don't let a hidden DM prevent you from hiding */ 2945 /*don't let a hidden DM prevent you from hiding */
2971 if (!QUERY_FLAG (tmp, FLAG_WIZ) || tmp->contr->hidden == 0) 2946 if (!tmp->flag [FLAG_WIZ] || tmp->contr->hidden == 0)
2972 return 1; 2947 return 1;
2973 } 2948 }
2974 } 2949 }
2975 } 2950 }
2976 return 0; 2951 return 0;
3045 * and the exit-coordinates sp/hp must both be > 0. 3020 * and the exit-coordinates sp/hp must both be > 0.
3046 * => The intention here is to prevent abuse of the battleground- 3021 * => The intention here is to prevent abuse of the battleground-
3047 * feature (like pickable or hidden battleground tiles). */ 3022 * feature (like pickable or hidden battleground tiles). */
3048 for (object *tmp = op->below; tmp; tmp = tmp->below) 3023 for (object *tmp = op->below; tmp; tmp = tmp->below)
3049 { 3024 {
3050 if (QUERY_FLAG (tmp, FLAG_IS_FLOOR)) 3025 if (tmp->flag [FLAG_IS_FLOOR])
3051 { 3026 {
3052 if (QUERY_FLAG (tmp, FLAG_NO_PICK) 3027 if (tmp->flag [FLAG_NO_PICK]
3053 && tmp->type == BATTLEGROUND 3028 && tmp->type == BATTLEGROUND
3054 && tmp->name == shstr_battleground 3029 && tmp->name == shstr_battleground
3055 && EXIT_X (tmp) && EXIT_Y (tmp)) 3030 && EXIT_X (tmp) && EXIT_Y (tmp))
3056 { 3031 {
3057 /* before we assign the exit, check if this is a teambattle */ 3032 /* before we assign the exit, check if this is a teambattle */
3209 else 3184 else
3210 j = 1; 3185 j = 1;
3211 strcat (buf, spellpathnames[i]); 3186 strcat (buf, spellpathnames[i]);
3212 } 3187 }
3213 } 3188 }
3189
3214 strcat (buf, "."); 3190 strcat (buf, ".");
3215 new_draw_info (NDI_UNIQUE | NDI_BLUE, 0, who, buf); 3191 new_draw_info (NDI_UNIQUE | NDI_BLUE, 0, who, buf);
3216 } 3192 }
3217 3193
3218 /* evtl. adding flags: */ 3194 /* evtl. adding flags: */
3219 if (QUERY_FLAG (item, FLAG_XRAYS)) 3195 if (item->flag [FLAG_XRAYS])
3220 SET_FLAG (skin, FLAG_XRAYS); 3196 skin->set_flag (FLAG_XRAYS);
3221 if (QUERY_FLAG (item, FLAG_STEALTH)) 3197 if (item->flag [FLAG_STEALTH])
3222 SET_FLAG (skin, FLAG_STEALTH); 3198 skin->set_flag (FLAG_STEALTH);
3223 if (QUERY_FLAG (item, FLAG_SEE_IN_DARK)) 3199 if (item->flag [FLAG_SEE_IN_DARK])
3224 SET_FLAG (skin, FLAG_SEE_IN_DARK); 3200 skin->set_flag (FLAG_SEE_IN_DARK);
3225 3201
3226 /* print message if there is one */ 3202 /* print message if there is one */
3227 if (item->msg != NULL) 3203 if (item->msg != NULL)
3228 new_draw_info (NDI_UNIQUE | NDI_BLUE, 0, who, item->msg); 3204 new_draw_info (NDI_UNIQUE | NDI_BLUE, 0, who, item->msg);
3229 } 3205 }
3271{ 3247{
3272 play_sound (sound_find ("generic_failure")); 3248 play_sound (sound_find ("generic_failure"));
3273 statusmsg (msg, color); 3249 statusmsg (msg, color);
3274} 3250}
3275 3251
3252void
3253object::failmsgf (const char *format, ...)
3254{
3255 if (!contr)
3256 return;
3257
3258 va_list ap;
3259 va_start (ap, format);
3260 contr->failmsg (vformat (format, ap));
3261 va_end (ap);
3262}
3263
3264void
3265player::failmsgf (const char *format, ...)
3266{
3267 va_list ap;
3268 va_start (ap, format);
3269 failmsg (vformat (format, ap));
3270 va_end (ap);
3271}
3272

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines