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.164 by root, Mon Jul 14 16:42:49 2008 UTC vs.
Revision 1.169 by root, Sun Sep 7 21:31:23 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 }
1260 * Handles applying a sign. 1260 * Handles applying a sign.
1261 */ 1261 */
1262static void 1262static void
1263apply_sign (object *op, object *sign, int autoapply) 1263apply_sign (object *op, object *sign, int autoapply)
1264{ 1264{
1265 readable_message_type *msgType; 1265 if (sign->has_dialogue ())
1266 {
1267 op->statusmsg (form ("Maybe you should I<talk> to the %s instead?", &sign->name));
1268 return;
1269 }
1266 1270
1267 if (!sign->msg) 1271 if (!sign->msg)
1268 { 1272 {
1269 op->statusmsg ("Nothing is written on it."); 1273 op->statusmsg ("Nothing is written on it.");
1270 return; 1274 return;
1305 1309
1306 if (ns->can_msg) 1310 if (ns->can_msg)
1307 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\n\n%s", &sign->name, &sign->msg));
1308 else 1312 else
1309 { 1313 {
1310 msgType = get_readable_message_type (sign); 1314 readable_message_type *msgType = get_readable_message_type (sign);
1311 const char *somemsg = format ("%u %s", autoapply ? 1 : 0, &sign->msg); 1315 const char *somemsg = format ("%u %s", autoapply ? 1 : 0, &sign->msg);
1312 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);
1313 } 1317 }
1314 } 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);
1315} 1351}
1316 1352
1317/** 1353/**
1318 * 'victim' moves onto 'trap' 1354 * 'victim' moves onto 'trap'
1319 * 'victim' leaves 'trap' 1355 * 'victim' leaves 'trap'
1488 case CHECK_INV: 1524 case CHECK_INV:
1489 check_inv (victim, trap); 1525 check_inv (victim, trap);
1490 goto leave; 1526 goto leave;
1491 1527
1492 case HOLE: 1528 case HOLE:
1493 /* Hole not open? */ 1529 move_apply_hole (trap, victim);
1494 if (trap->stats.wc > 0)
1495 goto leave;
1496
1497 /* Is this a multipart monster and not the head? If so, return.
1498 * Processing will happen if the head runs into the pit
1499 */
1500 if (victim->head)
1501 goto leave;
1502
1503 victim->play_sound (trap->sound ? trap->sound : sound_find ("fall_hole"));
1504 victim->statusmsg ("You fall through the hole!", NDI_RED);
1505 transfer_ob (victim, EXIT_X (trap), EXIT_Y (trap), 1, victim);
1506 goto leave; 1530 goto leave;
1507 1531
1508 case EXIT: 1532 case EXIT:
1509 if (victim->type == PLAYER && EXIT_PATH (trap)) 1533 if (victim->type == PLAYER && EXIT_PATH (trap))
1510 { 1534 {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines