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.19 by root, Mon Dec 18 03:00:02 2006 UTC vs.
Revision 1.20 by root, Wed Dec 20 09:14:22 2006 UTC

459 int last = op->value; 459 int last = op->value;
460 int detected; 460 int detected;
461 461
462 detected = 0; 462 detected = 0;
463 463
464 for (tmp = get_map_ob (op->map, op->x, op->y); tmp != NULL && !detected; tmp = tmp->above) 464 for (tmp = GET_MAP_OB (op->map, op->x, op->y); tmp != NULL && !detected; tmp = tmp->above)
465 { 465 {
466 object *tmp2; 466 object *tmp2;
467 467
468 if (op->stats.hp) 468 if (op->stats.hp)
469 { 469 {
766 } 766 }
767 767
768 /* only need to look for living creatures if this flag is set */ 768 /* only need to look for living creatures if this flag is set */
769 if (mflags & P_IS_ALIVE) 769 if (mflags & P_IS_ALIVE)
770 { 770 {
771 for (tmp = get_map_ob (m, new_x, new_y); tmp != NULL; tmp = tmp->above) 771 for (tmp = GET_MAP_OB (m, new_x, new_y); tmp != NULL; tmp = tmp->above)
772 if (QUERY_FLAG (tmp, FLAG_ALIVE)) 772 if (QUERY_FLAG (tmp, FLAG_ALIVE))
773 break; 773 break;
774 774
775 /* Not really fair, but don't let monsters hit themselves with 775 /* Not really fair, but don't let monsters hit themselves with
776 * their own arrow - this can be because they fire it then 776 * their own arrow - this can be because they fire it then
908 * Modified this routine to allow held objects. b.t. */ 908 * Modified this routine to allow held objects. b.t. */
909 909
910void 910void
911change_object (object *op) 911change_object (object *op)
912{ /* Doesn`t handle linked objs yet */ 912{ /* Doesn`t handle linked objs yet */
913 object *tmp, *env, *pl;
914 int i, j; 913 int i, j;
915 914
916 if (op->other_arch == NULL) 915 if (op->other_arch == NULL)
917 { 916 {
918 LOG (llevError, "Change object (%s) without other_arch error.\n", &op->name); 917 LOG (llevError, "Change object (%s) without other_arch error.\n", &op->name);
925 if (op->stats.food-- > 0) 924 if (op->stats.food-- > 0)
926 return; 925 return;
927 else 926 else
928 op->stats.food = 1; /* so 1 other_arch is made */ 927 op->stats.food = 1; /* so 1 other_arch is made */
929 } 928 }
929
930 object *pl = op->in_player ();
930 env = op->env; 931 object *env = op->env;
932
931 op->remove (); 933 op->remove ();
932 for (i = 0; i < NROFNEWOBJS (op); i++) 934 for (i = 0; i < NROFNEWOBJS (op); i++)
933 { 935 {
934 tmp = arch_to_object (op->other_arch); 936 object *tmp = arch_to_object (op->other_arch);
937
935 if (op->type == LAMP) 938 if (op->type == LAMP)
936 tmp->stats.food = op->stats.food - 1; 939 tmp->stats.food = op->stats.food - 1;
940
937 tmp->stats.hp = op->stats.hp; /* The only variable it keeps. */ 941 tmp->stats.hp = op->stats.hp; /* The only variable it keeps. */
938 if (env) 942 if (env)
939 { 943 {
940 tmp->x = env->x, tmp->y = env->y; 944 tmp->x = env->x, tmp->y = env->y;
941 tmp = insert_ob_in_ob (tmp, env); 945 tmp = insert_ob_in_ob (tmp, env);
946
942 /* If this object is the players inventory, we need to tell the 947 /* If this object is the players inventory, we need to tell the
943 * client of the change. Insert_ob_in_map takes care of the 948 * client of the change. Insert_ob_in_map takes care of the
944 * updating the client, so we don't need to do that below. 949 * updating the client, so we don't need to do that below.
945 */ 950 */
946 if ((pl = is_player_inv (env)) != NULL) 951 if (pl)
947 { 952 {
948 esrv_del_item (pl->contr, op->count); 953 esrv_del_item (pl->contr, op->count);
949 esrv_send_item (pl, tmp); 954 esrv_send_item (pl, tmp);
950 } 955 }
951 } 956 }
1121 1126
1122 /* Determine direction now for random movers so we do the right thing */ 1127 /* Determine direction now for random movers so we do the right thing */
1123 if (!dir) 1128 if (!dir)
1124 dir = rndm (1, 8); 1129 dir = rndm (1, 8);
1125 1130
1126 for (victim = get_map_ob (op->map, op->x, op->y); victim != NULL; victim = victim->above) 1131 for (victim = GET_MAP_OB (op->map, op->x, op->y); victim != NULL; victim = victim->above)
1127 { 1132 {
1128 if (QUERY_FLAG (victim, FLAG_ALIVE) && !QUERY_FLAG (victim, FLAG_WIZPASS) && 1133 if (QUERY_FLAG (victim, FLAG_ALIVE) && !QUERY_FLAG (victim, FLAG_WIZPASS) &&
1129 (victim->move_type & op->move_type || !victim->move_type)) 1134 (victim->move_type & op->move_type || !victim->move_type))
1130 { 1135 {
1131 1136
1148 } 1153 }
1149 1154
1150 if (should_director_abort (op, victim)) 1155 if (should_director_abort (op, victim))
1151 return; 1156 return;
1152 1157
1153 for (nextmover = get_map_ob (m, nx, ny); nextmover != NULL; nextmover = nextmover->above) 1158 for (nextmover = GET_MAP_OB (m, nx, ny); nextmover != NULL; nextmover = nextmover->above)
1154 { 1159 {
1155 if (nextmover->type == PLAYERMOVER) 1160 if (nextmover->type == PLAYERMOVER)
1156 nextmover->speed_left = -.99; 1161 nextmover->speed_left = -.99;
1157 if (QUERY_FLAG (nextmover, FLAG_ALIVE)) 1162 if (QUERY_FLAG (nextmover, FLAG_ALIVE))
1158 { 1163 {
1327void 1332void
1328move_marker (object *op) 1333move_marker (object *op)
1329{ 1334{
1330 object *tmp, *tmp2; 1335 object *tmp, *tmp2;
1331 1336
1332 for (tmp = get_map_ob (op->map, op->x, op->y); tmp != NULL; tmp = tmp->above) 1337 for (tmp = GET_MAP_OB (op->map, op->x, op->y); tmp != NULL; tmp = tmp->above)
1333 { 1338 {
1334 if (tmp->type == PLAYER) 1339 if (tmp->type == PLAYER)
1335 { /* we've got someone to MARK */ 1340 { /* we've got someone to MARK */
1336 1341
1337 /* remove an old force with a slaying field == op->name */ 1342 /* remove an old force with a slaying field == op->name */
1428 if (QUERY_FLAG (op, FLAG_APPLIED)) 1433 if (QUERY_FLAG (op, FLAG_APPLIED))
1429 remove_force (op); 1434 remove_force (op);
1430 else 1435 else
1431 { 1436 {
1432 /* IF necessary, delete the item from the players inventory */ 1437 /* IF necessary, delete the item from the players inventory */
1433 object *pl = is_player_inv (op); 1438 object *pl = op->in_player ();
1434 1439
1435 if (pl) 1440 if (pl)
1436 esrv_del_item (pl->contr, op->count); 1441 esrv_del_item (pl->contr, op->count);
1437 1442
1438 op->remove (); 1443 op->remove ();

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines