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.9 by root, Sun Sep 10 15:59:58 2006 UTC vs.
Revision 1.13 by root, Sat Sep 16 22:24:13 2006 UTC

1
2/*
3 * static char *rcsid_time_c =
4 * "$Id: time.C,v 1.9 2006/09/10 15:59:58 root Exp $";
5 */
6
7/* 1/*
8 CrossFire, A Multiplayer game for X-windows 2 CrossFire, A Multiplayer game for X-windows
9 3
10 Copyright (C) 2002 Mark Wedel & Crossfire Development Team 4 Copyright (C) 2002 Mark Wedel & Crossfire Development Team
11 Copyright (C) 1992 Frank Tore Johansen 5 Copyright (C) 1992 Frank Tore Johansen
22 16
23 You should have received a copy of the GNU General Public License 17 You should have received a copy of the GNU General Public License
24 along with this program; if not, write to the Free Software 18 along with this program; if not, write to the Free Software
25 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 19 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
26 20
27 The authors can be reached via e-mail at crossfire-devel@real-time.com 21 The authors can be reached via e-mail at <crossfire@schmorp.de>
28*/ 22*/
29 23
30/* 24/*
31 * Routines that is executed from objects based on their speed have been 25 * Routines that is executed from objects based on their speed have been
32 * collected in this file. 26 * collected in this file.
211 if (--op->duration > 0) 205 if (--op->duration > 0)
212 return; 206 return;
213 207
214 switch (op->subtype) 208 switch (op->subtype)
215 { 209 {
216 case FORCE_CONFUSION: 210 case FORCE_CONFUSION:
217 if (op->env != NULL) 211 if (op->env != NULL)
218 { 212 {
219 CLEAR_FLAG (op->env, FLAG_CONFUSED); 213 CLEAR_FLAG (op->env, FLAG_CONFUSED);
220 new_draw_info (NDI_UNIQUE, 0, op->env, "You regain your senses.\n"); 214 new_draw_info (NDI_UNIQUE, 0, op->env, "You regain your senses.\n");
221 } 215 }
222 216
223 default: 217 default:
224 if (op->env != NULL) 218 if (op->env != NULL)
225 { 219 {
226 CLEAR_FLAG (op, FLAG_APPLIED); 220 CLEAR_FLAG (op, FLAG_APPLIED);
227 change_abil (op->env, op); 221 change_abil (op->env, op);
228 fix_player (op->env); 222 fix_player (op->env);
229 } 223 }
230 } 224 }
231 remove_ob (op); 225 remove_ob (op);
232 free_object (op); 226 free_object (op);
233} 227}
234 228
593 if (op->map == NULL) 587 if (op->map == NULL)
594 return op; 588 return op;
595 589
596 switch (op->type) 590 switch (op->type)
597 { 591 {
598 case THROWN_OBJ: 592 case THROWN_OBJ:
599 { 593 {
600 object *payload = op->inv; 594 object *payload = op->inv;
601 595
602 if (payload == NULL) 596 if (payload == NULL)
603 return NULL; 597 return NULL;
604 remove_ob (payload); 598 remove_ob (payload);
605 remove_ob (op); 599 remove_ob (op);
606 free_object (op); 600 free_object (op);
607 return payload; 601 return payload;
608 } 602 }
609 603
610 case ARROW: 604 case ARROW:
611 if (op->speed >= MIN_ACTIVE_SPEED) 605 if (op->speed >= MIN_ACTIVE_SPEED)
612 op = fix_stopped_arrow (op); 606 op = fix_stopped_arrow (op);
613 return op; 607 return op;
614 608
615 default: 609 default:
616 return op; 610 return op;
617 } 611 }
618} 612}
619 613
620/* fix_stopped_item() - put stopped item where stop_item() had found it. 614/* fix_stopped_item() - put stopped item where stop_item() had found it.
621 * Inserts item into the old map, or merges it if it already is on the map. 615 * Inserts item into the old map, or merges it if it already is on the map.
622 * 616 *
623 * 'map' must be the value of op->map before stop_item() was called. 617 * 'map' must be the value of op->map before stop_item() was called.
624 */ 618 */
625void 619void
626fix_stopped_item (object *op, mapstruct *map, object *originator) 620fix_stopped_item (object *op, maptile *map, object *originator)
627{ 621{
628 if (map == NULL) 622 if (map == NULL)
629 return; 623 return;
630 if (QUERY_FLAG (op, FLAG_REMOVED)) 624 if (QUERY_FLAG (op, FLAG_REMOVED))
631 insert_ob_in_map (op, map, originator, 0); 625 insert_ob_in_map (op, map, originator, 0);
716move_arrow (object *op) 710move_arrow (object *op)
717{ 711{
718 object *tmp; 712 object *tmp;
719 sint16 new_x, new_y; 713 sint16 new_x, new_y;
720 int was_reflected, mflags; 714 int was_reflected, mflags;
721 mapstruct *m; 715 maptile *m;
722 716
723 if (op->map == NULL) 717 if (op->map == NULL)
724 { 718 {
725 LOG (llevError, "BUG: Arrow had no map.\n"); 719 LOG (llevError, "BUG: Arrow had no map.\n");
726 remove_ob (op); 720 remove_ob (op);
849 * that did the same thing. 843 * that did the same thing.
850 */ 844 */
851 while (retry < 2) 845 while (retry < 2)
852 { 846 {
853 int left, right, mflags; 847 int left, right, mflags;
854 mapstruct *m1; 848 maptile *m1;
855 sint16 x1, y1; 849 sint16 x1, y1;
856 850
857 retry++; 851 retry++;
858 852
859 /* Need to check for P_OUT_OF_MAP: if the arrow is tavelling 853 /* Need to check for P_OUT_OF_MAP: if the arrow is tavelling
1122move_player_mover (object *op) 1116move_player_mover (object *op)
1123{ 1117{
1124 object *victim, *nextmover; 1118 object *victim, *nextmover;
1125 int dir = op->stats.sp; 1119 int dir = op->stats.sp;
1126 sint16 nx, ny; 1120 sint16 nx, ny;
1127 mapstruct *m; 1121 maptile *m;
1128 1122
1129 /* Determine direction now for random movers so we do the right thing */ 1123 /* Determine direction now for random movers so we do the right thing */
1130 if (!dir) 1124 if (!dir)
1131 dir = rndm (1, 8); 1125 dir = rndm (1, 8);
1132 1126
1423 animate_object (op, op->direction); 1417 animate_object (op, op->direction);
1424 1418
1425 if (QUERY_FLAG (op, FLAG_SEE_ANYWHERE)) 1419 if (QUERY_FLAG (op, FLAG_SEE_ANYWHERE))
1426 make_sure_seen (op); 1420 make_sure_seen (op);
1427 } 1421 }
1422
1428 if (QUERY_FLAG (op, FLAG_CHANGING) && !op->state) 1423 if (QUERY_FLAG (op, FLAG_CHANGING) && !op->state)
1429 { 1424 {
1430 change_object (op); 1425 change_object (op);
1431 return 1; 1426 return 1;
1432 } 1427 }
1428
1433 if (QUERY_FLAG (op, FLAG_GENERATOR) && !QUERY_FLAG (op, FLAG_FRIENDLY)) 1429 if (QUERY_FLAG (op, FLAG_GENERATOR) && !QUERY_FLAG (op, FLAG_FRIENDLY))
1434 generate_monster (op); 1430 generate_monster (op);
1435 1431
1436 if (QUERY_FLAG (op, FLAG_IS_USED_UP) && --op->stats.food <= 0) 1432 if (QUERY_FLAG (op, FLAG_IS_USED_UP) && --op->stats.food <= 0)
1437 { 1433 {
1442 /* IF necessary, delete the item from the players inventory */ 1438 /* IF necessary, delete the item from the players inventory */
1443 object *pl = is_player_inv (op); 1439 object *pl = is_player_inv (op);
1444 1440
1445 if (pl) 1441 if (pl)
1446 esrv_del_item (pl->contr, op->count); 1442 esrv_del_item (pl->contr, op->count);
1443
1447 remove_ob (op); 1444 remove_ob (op);
1445
1448 if (QUERY_FLAG (op, FLAG_SEE_ANYWHERE)) 1446 if (QUERY_FLAG (op, FLAG_SEE_ANYWHERE))
1449 make_sure_not_seen (op); 1447 make_sure_not_seen (op);
1448
1450 free_object (op); 1449 free_object (op);
1451 } 1450 }
1451
1452 return 1; 1452 return 1;
1453 } 1453 }
1454
1454 switch (op->type) 1455 switch (op->type)
1455 { 1456 {
1456
1457 case SPELL_EFFECT: 1457 case SPELL_EFFECT:
1458 move_spell_effect (op); 1458 move_spell_effect (op);
1459 return 1; 1459 return 1;
1460 1460
1461 case ROD: 1461 case ROD:
1462 case HORN: 1462 case HORN:
1463 regenerate_rod (op); 1463 regenerate_rod (op);
1464 return 1; 1464 return 1;
1465 1465
1466 case FORCE: 1466 case FORCE:
1467 case POTION_EFFECT: 1467 case POTION_EFFECT:
1468 remove_force (op); 1468 remove_force (op);
1469 return 1; 1469 return 1;
1470 1470
1471 case BLINDNESS: 1471 case BLINDNESS:
1472 remove_blindness (op); 1472 remove_blindness (op);
1473 return 0; 1473 return 0;
1474 1474
1475 case POISONING: 1475 case POISONING:
1476 poison_more (op); 1476 poison_more (op);
1477 return 0; 1477 return 0;
1478 1478
1479 case DISEASE: 1479 case DISEASE:
1480 move_disease (op); 1480 move_disease (op);
1481 return 0; 1481 return 0;
1482 1482
1483 case SYMPTOM: 1483 case SYMPTOM:
1484 move_symptom (op); 1484 move_symptom (op);
1485 return 0; 1485 return 0;
1486 1486
1487 case THROWN_OBJ: 1487 case THROWN_OBJ:
1488 case ARROW: 1488 case ARROW:
1489 move_arrow (op); 1489 move_arrow (op);
1490 return 0; 1490 return 0;
1491 1491
1492 case LIGHTNING: /* It now moves twice as fast */ 1492 case LIGHTNING: /* It now moves twice as fast */
1493 move_bolt (op); 1493 move_bolt (op);
1494 return 0; 1494 return 0;
1495 1495
1496 case DOOR: 1496 case DOOR:
1497 remove_door (op); 1497 remove_door (op);
1498 return 0; 1498 return 0;
1499 1499
1500 case LOCKED_DOOR: 1500 case LOCKED_DOOR:
1501 remove_door2 (op); 1501 remove_door2 (op);
1502 return 0; 1502 return 0;
1503 1503
1504 case TELEPORTER: 1504 case TELEPORTER:
1505 move_teleporter (op); 1505 move_teleporter (op);
1506 return 0; 1506 return 0;
1507 1507
1508 case GOLEM: 1508 case GOLEM:
1509 move_golem (op); 1509 move_golem (op);
1510 return 0; 1510 return 0;
1511 1511
1512 case EARTHWALL: 1512 case EARTHWALL:
1513 hit_player (op, 2, op, AT_PHYSICAL, 1); 1513 hit_player (op, 2, op, AT_PHYSICAL, 1);
1514 return 0; 1514 return 0;
1515 1515
1516 case FIREWALL: 1516 case FIREWALL:
1517 move_firewall (op); 1517 move_firewall (op);
1518 if (op->stats.maxsp) 1518 if (op->stats.maxsp)
1519 animate_turning (op); 1519 animate_turning (op);
1520 return 0; 1520 return 0;
1521 1521
1522 case MOOD_FLOOR: 1522 case MOOD_FLOOR:
1523 do_mood_floor (op); 1523 do_mood_floor (op);
1524 return 0; 1524 return 0;
1525 1525
1526 case GATE: 1526 case GATE:
1527 move_gate (op); 1527 move_gate (op);
1528 return 0; 1528 return 0;
1529 1529
1530 case TIMED_GATE: 1530 case TIMED_GATE:
1531 move_timed_gate (op); 1531 move_timed_gate (op);
1532 return 0; 1532 return 0;
1533 1533
1534 case TRIGGER: 1534 case TRIGGER:
1535 case TRIGGER_BUTTON: 1535 case TRIGGER_BUTTON:
1536 case TRIGGER_PEDESTAL: 1536 case TRIGGER_PEDESTAL:
1537 case TRIGGER_ALTAR: 1537 case TRIGGER_ALTAR:
1538 animate_trigger (op); 1538 animate_trigger (op);
1539 return 0; 1539 return 0;
1540 1540
1541 case DETECTOR: 1541 case DETECTOR:
1542 move_detector (op); 1542 move_detector (op);
1543 1543
1544 case DIRECTOR: 1544 case DIRECTOR:
1545 if (op->stats.maxsp) 1545 if (op->stats.maxsp)
1546 animate_turning (op); 1546 animate_turning (op);
1547 return 0; 1547 return 0;
1548 1548
1549 case HOLE: 1549 case HOLE:
1550 move_hole (op); 1550 move_hole (op);
1551 return 0; 1551 return 0;
1552 1552
1553 case DEEP_SWAMP: 1553 case DEEP_SWAMP:
1554 move_deep_swamp (op); 1554 move_deep_swamp (op);
1555 return 0; 1555 return 0;
1556 1556
1557 case RUNE: 1557 case RUNE:
1558 case TRAP: 1558 case TRAP:
1559 move_rune (op); 1559 move_rune (op);
1560 return 0; 1560 return 0;
1561 1561
1562 case PLAYERMOVER: 1562 case PLAYERMOVER:
1563 move_player_mover (op); 1563 move_player_mover (op);
1564 return 0; 1564 return 0;
1565 1565
1566 case CREATOR: 1566 case CREATOR:
1567 move_creator (op); 1567 move_creator (op);
1568 return 0; 1568 return 0;
1569 1569
1570 case MARKER: 1570 case MARKER:
1571 move_marker (op); 1571 move_marker (op);
1572 return 0; 1572 return 0;
1573 1573
1574 case PLAYER_CHANGER: 1574 case PLAYER_CHANGER:
1575 move_player_changer (op); 1575 move_player_changer (op);
1576 return 0; 1576 return 0;
1577 1577
1578 case PEACEMAKER: 1578 case PEACEMAKER:
1579 move_peacemaker (op); 1579 move_peacemaker (op);
1580 return 0; 1580 return 0;
1581 } 1581 }
1582 1582
1583 return 0; 1583 return 0;
1584} 1584}

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines