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

Comparing deliantra/server/server/apply.C (file contents):
Revision 1.165 by root, Tue Jul 15 00:00:37 2008 UTC vs.
Revision 1.172 by root, Mon Sep 29 10:32:50 2008 UTC

53 * subtype 5: arch or race 53 * subtype 5: arch or race
54 * subtype 7: all three 54 * subtype 7: all three
55 */ 55 */
56 if (op->subtype) 56 if (op->subtype)
57 { 57 {
58 arch_flag = (op->subtype & 1); 58 arch_flag = op->subtype & 1;
59 name_flag = (op->subtype & 2); 59 name_flag = op->subtype & 2;
60 race_flag = (op->subtype & 4); 60 race_flag = op->subtype & 4;
61 } 61 }
62 else 62 else
63 { 63 {
64 arch_flag = 1; 64 arch_flag = 1;
65 name_flag = 1; 65 name_flag = 1;
113 { 113 {
114 if (operate_altar (altar, &money)) 114 if (operate_altar (altar, &money))
115 { 115 {
116 identify (marked); 116 identify (marked);
117 117
118 buf.printf ("You have %s.\n\n", long_desc (marked, pl)); 118 buf.printf ("You have %s.\r", long_desc (marked, pl));
119 if (marked->msg) 119 if (marked->msg)
120 buf << "The item has a story:\n\n" << marked->msg << "\n\n"; 120 buf << "The item has a story:\r" << marked->msg << "\n\n";
121 121
122 return !money; 122 return !money;
123 } 123 }
124 } 124 }
125 125
129 { 129 {
130 if (operate_altar (altar, &money)) 130 if (operate_altar (altar, &money))
131 { 131 {
132 identify (id); 132 identify (id);
133 133
134 buf.printf ("You have %s.\n\n", long_desc (id, pl)); 134 buf.printf ("You have %s.\r", long_desc (id, pl));
135 if (id->msg) 135 if (id->msg)
136 buf << "The item has a story:\n\n" << id->msg << "\n\n"; 136 buf << "The item has a story:\r" << id->msg << "\n\n";
137 137
138 /* If no more money, might as well quit now */ 138 /* If no more money, might as well quit now */
139 if (!money || !check_altar_sacrifice (altar, money)) 139 if (!money || !check_altar_sacrifice (altar, money))
140 break; 140 break;
141 } 141 }
1306 ns->play_sound (sign->sound); 1306 ns->play_sound (sign->sound);
1307 else if (autoapply) 1307 else if (autoapply)
1308 ns->play_sound (sound_find ("msg_voice")); 1308 ns->play_sound (sound_find ("msg_voice"));
1309 1309
1310 if (ns->can_msg) 1310 if (ns->can_msg)
1311 op->contr->infobox (MSG_CHANNEL ("examine"), format ("T<%s>\n\n\n\n%s", &sign->name, &sign->msg)); 1311 op->contr->infobox (MSG_CHANNEL ("examine"), format ("T<%s>\n\n%s", &sign->name, &sign->msg));
1312 else 1312 else
1313 { 1313 {
1314 readable_message_type *msgType = get_readable_message_type (sign); 1314 readable_message_type *msgType = get_readable_message_type (sign);
1315 const char *somemsg = format ("%u %s", autoapply ? 1 : 0, &sign->msg); 1315 const char *somemsg = format ("%u %s", autoapply ? 1 : 0, &sign->msg);
1316 draw_ext_info (NDI_UNIQUE | NDI_NAVY, 0, op, msgType->message_type, msgType->message_subtype, somemsg, &sign->msg); 1316 draw_ext_info (NDI_UNIQUE | NDI_NAVY, 0, op, msgType->message_type, msgType->message_subtype, somemsg, &sign->msg);
1317 } 1317 }
1318 } 1318 }
1319}
1320
1321static void
1322move_apply_hole (object *trap, object *victim)
1323{
1324 /* Hole not open? */
1325 if (trap->stats.wc > 0)
1326 return;
1327
1328 /* Is this a multipart monster and not the head? If so, return.
1329 * Processing will happen if the head runs into the pit
1330 */
1331 if (victim->head)
1332 return;
1333
1334 // now find all possible locations and randomly pick one
1335 int dir = find_free_spot (victim, trap->map, EXIT_X (trap), EXIT_Y (trap), 0,
1336 trap->range >= 3 ? SIZEOFFREE3 + 1
1337 : trap->range >= 2 ? SIZEOFFREE2 + 1
1338 : trap->range >= 1 ? SIZEOFFREE1 + 1
1339 : SIZEOFFREE0 + 1);
1340
1341 if (dir < 0)
1342 return;
1343
1344 victim->play_sound (trap->sound ? trap->sound : sound_find ("fall_hole"));
1345 victim->statusmsg ("You fall through the hole!", NDI_RED);
1346
1347 transfer_ob (victim,
1348 EXIT_X (trap) + freearr_x[dir],
1349 EXIT_Y (trap) + freearr_y[dir],
1350 0, victim);
1319} 1351}
1320 1352
1321/** 1353/**
1322 * 'victim' moves onto 'trap' 1354 * 'victim' moves onto 'trap'
1323 * 'victim' leaves 'trap' 1355 * 'victim' leaves 'trap'
1492 case CHECK_INV: 1524 case CHECK_INV:
1493 check_inv (victim, trap); 1525 check_inv (victim, trap);
1494 goto leave; 1526 goto leave;
1495 1527
1496 case HOLE: 1528 case HOLE:
1497 /* Hole not open? */ 1529 move_apply_hole (trap, victim);
1498 if (trap->stats.wc > 0)
1499 goto leave;
1500
1501 /* Is this a multipart monster and not the head? If so, return.
1502 * Processing will happen if the head runs into the pit
1503 */
1504 if (victim->head)
1505 goto leave;
1506
1507 victim->play_sound (trap->sound ? trap->sound : sound_find ("fall_hole"));
1508 victim->statusmsg ("You fall through the hole!", NDI_RED);
1509 transfer_ob (victim, EXIT_X (trap), EXIT_Y (trap), 1, victim);
1510 goto leave; 1530 goto leave;
1511 1531
1512 case EXIT: 1532 case EXIT:
1513 if (victim->type == PLAYER && EXIT_PATH (trap)) 1533 if (victim->type == PLAYER && EXIT_PATH (trap))
1514 { 1534 {
1607 readable_message_type *msgType = get_readable_message_type (tmp); 1627 readable_message_type *msgType = get_readable_message_type (tmp);
1608 1628
1609 if (player *pl = op->contr) 1629 if (player *pl = op->contr)
1610 if (client *ns = pl->ns) 1630 if (client *ns = pl->ns)
1611 if (ns->can_msg) 1631 if (ns->can_msg)
1612 pl->infobox (MSG_CHANNEL ("book"), format ("T<%s>\n\n\n\n%s", (char *)long_desc (tmp, op), &tmp->msg)); 1632 pl->infobox (MSG_CHANNEL ("book"), format ("T<%s>\n\n%s", (char *)long_desc (tmp, op), &tmp->msg));
1613 else 1633 else
1614 draw_ext_info_format (NDI_UNIQUE | NDI_NAVY, 0, op, 1634 draw_ext_info_format (NDI_UNIQUE | NDI_NAVY, 0, op,
1615 msgType->message_type, msgType->message_subtype, 1635 msgType->message_type, msgType->message_subtype,
1616 "You open the %s and start reading.\n%s", (char *)"%s\n%s", 1636 "You open the %s and start reading.\n%s", (char *)"%s\n%s",
1617 long_desc (tmp, op), &tmp->msg); 1637 long_desc (tmp, op), &tmp->msg);
1945 if (op->destroyed () || tmp->destroyed ()) 1965 if (op->destroyed () || tmp->destroyed ())
1946 break; 1966 break;
1947 } 1967 }
1948 1968
1949 if (!tmp->destroyed () && !tmp->inv) 1969 if (!tmp->destroyed () && !tmp->inv)
1950 tmp->decrease (); 1970 tmp->decrease (true);
1951} 1971}
1952 1972
1953/** 1973/**
1954 * op eats food. 1974 * op eats food.
1955 * If player, takes care of messages and dragon special food. 1975 * If player, takes care of messages and dragon special food.
3552 /* If we generated an object and put it in this object inventory, 3572 /* If we generated an object and put it in this object inventory,
3553 * move it to the parent object as the current object is about 3573 * move it to the parent object as the current object is about
3554 * to disappear. An example of this item is the random_* stuff 3574 * to disappear. An example of this item is the random_* stuff
3555 * that is put inside other objects. 3575 * that is put inside other objects.
3556 */ 3576 */
3557 for (tmp = op->inv; tmp; tmp = tmp2)
3558 {
3559 tmp2 = tmp->below;
3560 tmp->remove ();
3561
3562 if (op->env) 3577 if (op->env)
3563 insert_ob_in_ob (tmp, op->env); 3578 while (op->inv)
3564 else 3579 op->env->insert (op->inv);
3565 tmp->destroy ();
3566 }
3567 3580
3568 op->destroy (); 3581 op->destroy ();
3569 break; 3582 break;
3570 } 3583 }
3571 3584

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines