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.7 by elmex, Tue Aug 29 17:29:28 2006 UTC vs.
Revision 1.8 by root, Sun Sep 3 00:18:42 2006 UTC

1/* 1/*
2 * static char *rcsid_time_c = 2 * static char *rcsid_time_c =
3 * "$Id: time.C,v 1.7 2006/08/29 17:29:28 elmex Exp $"; 3 * "$Id: time.C,v 1.8 2006/09/03 00:18:42 root Exp $";
4 */ 4 */
5 5
6/* 6/*
7 CrossFire, A Multiplayer game for X-windows 7 CrossFire, A Multiplayer game for X-windows
8 8
101 } 101 }
102 /*First count numer of objects in inv*/ 102 /*First count numer of objects in inv*/
103 for (op=gen->inv;op;op=op->below) 103 for (op=gen->inv;op;op=op->below)
104 qty++; 104 qty++;
105 if (!qty){ 105 if (!qty){
106 LOG(llevError,"Generator (%s) has no inventory in generate_monster_inv?\n", gen->name); 106 LOG(llevError,"Generator (%s) has no inventory in generate_monster_inv?\n", &gen->name);
107 return;/*No inventory*/ 107 return;/*No inventory*/
108 } 108 }
109 qty=rndm(0,qty-1); 109 qty=rndm(0,qty-1);
110 for (op=gen->inv;qty;qty--) 110 for (op=gen->inv;qty;qty--)
111 op=op->below; 111 op=op->below;
319 if(tmp!=NULL) { 319 if(tmp!=NULL) {
320 if(QUERY_FLAG(tmp, FLAG_ALIVE)) { 320 if(QUERY_FLAG(tmp, FLAG_ALIVE)) {
321 hit_player(tmp, random_roll(1, op->stats.dam, tmp, PREFER_LOW), op, AT_PHYSICAL, 1); 321 hit_player(tmp, random_roll(1, op->stats.dam, tmp, PREFER_LOW), op, AT_PHYSICAL, 1);
322 if(tmp->type==PLAYER) 322 if(tmp->type==PLAYER)
323 new_draw_info_format(NDI_UNIQUE, 0, tmp, 323 new_draw_info_format(NDI_UNIQUE, 0, tmp,
324 "You are crushed by the %s!",op->name); 324 "You are crushed by the %s!", &op->name);
325 } else 325 } else
326 /* If the object is not alive, and the object either can 326 /* If the object is not alive, and the object either can
327 * be picked up or the object rolls, move the object 327 * be picked up or the object rolls, move the object
328 * off the gate. 328 * off the gate.
329 */ 329 */
559 op->speed = 0; 559 op->speed = 0;
560 update_ob_speed(op); 560 update_ob_speed(op);
561 op->stats.wc = op->stats.sp; 561 op->stats.wc = op->stats.sp;
562 op->stats.dam= op->stats.hp; 562 op->stats.dam= op->stats.hp;
563 op->attacktype = op->stats.grace; 563 op->attacktype = op->stats.grace;
564 if (op->slaying != NULL) 564 op->slaying = 0;
565 FREE_AND_CLEAR_STR(op->slaying); 565 op->skill = 0;
566
567 if (op->skill != NULL)
568 FREE_AND_CLEAR_STR(op->skill);
569 566
570 if (op->spellarg != NULL) { 567 if (op->spellarg != NULL) {
571 op->slaying = add_string(op->spellarg); 568 op->slaying = op->spellarg;
572 free(op->spellarg); 569 free(op->spellarg);
573 op->spellarg = NULL; 570 op->spellarg = NULL;
574 } else 571 } else
575 op->slaying = NULL; 572 op->slaying = NULL;
576 573
803void change_object(object *op) { /* Doesn`t handle linked objs yet */ 800void change_object(object *op) { /* Doesn`t handle linked objs yet */
804 object *tmp,*env,*pl; 801 object *tmp,*env,*pl;
805 int i,j; 802 int i,j;
806 803
807 if(op->other_arch==NULL) { 804 if(op->other_arch==NULL) {
808 LOG(llevError,"Change object (%s) without other_arch error.\n", op->name); 805 LOG(llevError,"Change object (%s) without other_arch error.\n", &op->name);
809 return; 806 return;
810 } 807 }
811 808
812 /* In non-living items only change when food value is 0 */ 809 /* In non-living items only change when food value is 0 */
813 if(!QUERY_FLAG(op,FLAG_ALIVE)) { 810 if(!QUERY_FLAG(op,FLAG_ALIVE)) {
931 player->contr->bed_y = EXIT_Y(op); 928 player->contr->bed_y = EXIT_Y(op);
932 } 929 }
933 else 930 else
934 LOG(llevDebug, 931 LOG(llevDebug,
935 "WARNING: destination '%s' in player_changer must be an absolute path!\n", 932 "WARNING: destination '%s' in player_changer must be an absolute path!\n",
936 EXIT_PATH(op)); 933 &EXIT_PATH(op));
937 934
938 enter_exit(op->above,op); 935 enter_exit(op->above,op);
939 save_player(player, 1); 936 save_player(player, 1);
940 } 937 }
941} 938}
952 949
953 spell = op->inv; 950 spell = op->inv;
954 if (!spell || spell->type != SPELL) spell=&op->other_arch->clone; 951 if (!spell || spell->type != SPELL) spell=&op->other_arch->clone;
955 if (!spell) { 952 if (!spell) {
956 LOG(llevError,"move_firewall: no spell specified (%s, %s, %d, %d)\n", 953 LOG(llevError,"move_firewall: no spell specified (%s, %s, %d, %d)\n",
957 op->name, op->map->name, op->x, op->y); 954 &op->name, op->map->name, op->x, op->y);
958 return; 955 return;
959 } 956 }
960 957
961 cast_spell(op,op,op->stats.sp?op->stats.sp:rndm(1, 8),spell, NULL); 958 cast_spell(op,op,op->stats.sp?op->stats.sp:rndm(1, 8),spell, NULL);
962} 959}
1113 new_ob = object_create_clone(ob_to_copy); 1110 new_ob = object_create_clone(ob_to_copy);
1114 CLEAR_FLAG(new_ob, FLAG_IS_A_TEMPLATE); 1111 CLEAR_FLAG(new_ob, FLAG_IS_A_TEMPLATE);
1115 unflag_inv(new_ob, FLAG_IS_A_TEMPLATE); 1112 unflag_inv(new_ob, FLAG_IS_A_TEMPLATE);
1116 } else { 1113 } else {
1117 if (creator->other_arch == NULL) { 1114 if (creator->other_arch == NULL) {
1118 LOG(llevError,"move_creator: Creator doesn't have other arch set: %s (%s, %d, %d)\n", creator->name ? creator->name : "(null)", creator->map->path, creator->x, creator->y); 1115 LOG(llevError,"move_creator: Creator doesn't have other arch set: %s (%s, %d, %d)\n", &creator->name, creator->map->path, creator->x, creator->y);
1119 return; 1116 return;
1120 } 1117 }
1121 1118
1122 new_ob = object_create_arch(creator->other_arch); 1119 new_ob = object_create_arch(creator->other_arch);
1123 fix_generated_item(new_ob, creator, 0, 0, GT_MINIMAL); 1120 fix_generated_item(new_ob, creator, 0, 0, GT_MINIMAL);
1132 insert_ob_in_map_at(new_ob, creator->map, creator, 0, creator->x, creator->y); 1129 insert_ob_in_map_at(new_ob, creator->map, creator, 0, creator->x, creator->y);
1133 if (QUERY_FLAG(new_ob, FLAG_FREED)) 1130 if (QUERY_FLAG(new_ob, FLAG_FREED))
1134 return; 1131 return;
1135 1132
1136 if (creator->slaying) { 1133 if (creator->slaying) {
1137 FREE_AND_COPY(new_ob->name, creator->slaying); 1134 new_ob->name = new_ob->title = creator->slaying;
1138 FREE_AND_COPY(new_ob->title, creator->slaying);
1139 } 1135 }
1140} 1136}
1141 1137
1142/* move_marker --peterm@soda.csua.berkeley.edu 1138/* move_marker --peterm@soda.csua.berkeley.edu
1143 when moved, a marker will search for a player sitting above 1139 when moved, a marker will search for a player sitting above
1152 object *tmp,*tmp2; 1148 object *tmp,*tmp2;
1153 1149
1154 for(tmp=get_map_ob(op->map,op->x,op->y);tmp!=NULL;tmp=tmp->above) { 1150 for(tmp=get_map_ob(op->map,op->x,op->y);tmp!=NULL;tmp=tmp->above) {
1155 if(tmp->type == PLAYER) { /* we've got someone to MARK */ 1151 if(tmp->type == PLAYER) { /* we've got someone to MARK */
1156 1152
1157 if ( quest_on_activate(op, tmp->contr) )
1158 return;
1159
1160 /* remove an old force with a slaying field == op->name */ 1153 /* remove an old force with a slaying field == op->name */
1161 for(tmp2=tmp->inv;tmp2 !=NULL; tmp2=tmp2->below) { 1154 for(tmp2=tmp->inv;tmp2 !=NULL; tmp2=tmp2->below) {
1162 if(tmp2->type == FORCE && tmp2->slaying && !strcmp(tmp2->slaying,op->name)) break; 1155 if(tmp2->type == FORCE && tmp2->slaying && !strcmp(tmp2->slaying,op->name)) break;
1163 } 1156 }
1164 1157
1183 force->speed = 0.01; 1176 force->speed = 0.01;
1184 force->speed_left = -op->stats.food; 1177 force->speed_left = -op->stats.food;
1185 } 1178 }
1186 update_ob_speed (force); 1179 update_ob_speed (force);
1187 /* put in the lock code */ 1180 /* put in the lock code */
1188 force->slaying = add_string(op->slaying); 1181 force->slaying = op->slaying;
1189 1182
1190 if ( op->lore ) 1183 if (op->lore)
1191 force->lore = add_string( op->lore ); 1184 force->lore = op->lore;
1192 1185
1193 insert_ob_in_ob(force,tmp); 1186 insert_ob_in_ob(force,tmp);
1194 if(op->msg) 1187 if(op->msg)
1195 new_draw_info(NDI_UNIQUE|NDI_NAVY,0,tmp,op->msg); 1188 new_draw_info(NDI_UNIQUE|NDI_NAVY,0,tmp,op->msg);
1196 1189

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines