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

Comparing deliantra/server/server/c_wiz.C (file contents):
Revision 1.46 by root, Mon Jun 4 12:19:09 2007 UTC vs.
Revision 1.47 by root, Mon Jun 4 13:04:00 2007 UTC

423 * we also set up spell_name which is only 423 * we also set up spell_name which is only
424 * the first word. 424 * the first word.
425 */ 425 */
426 426
427 at_spell = archetype::find (cp); 427 at_spell = archetype::find (cp);
428 if (!at_spell || at_spell->clone.type != SPELL) 428 if (!at_spell || at_spell->type != SPELL)
429 at_spell = find_archetype_by_object_name (cp); 429 at_spell = find_archetype_by_object_name (cp);
430 if (!at_spell || at_spell->clone.type != SPELL) 430 if (!at_spell || at_spell->type != SPELL)
431 { 431 {
432 assign (spell_name, cp); 432 assign (spell_name, cp);
433 fsp = strchr (spell_name, ' '); 433 fsp = strchr (spell_name, ' ');
434 if (fsp) 434 if (fsp)
435 { 435 {
436 *fsp = 0; 436 *fsp = 0;
437 fsp++; 437 fsp++;
438 at_spell = archetype::find (spell_name); 438 at_spell = archetype::find (spell_name);
439 439
440 /* Got a spell, update the first string pointer */ 440 /* Got a spell, update the first string pointer */
441 if (at_spell && at_spell->clone.type == SPELL) 441 if (at_spell && at_spell->type == SPELL)
442 bp2 = cp + strlen (spell_name) + 1; 442 bp2 = cp + strlen (spell_name) + 1;
443 else 443 else
444 at_spell = NULL; 444 at_spell = NULL;
445 } 445 }
446 } 446 }
448 /* OK - we didn't find a spell - presume the 'of' 448 /* OK - we didn't find a spell - presume the 'of'
449 * in this case means its an artifact. 449 * in this case means its an artifact.
450 */ 450 */
451 if (!at_spell) 451 if (!at_spell)
452 { 452 {
453 if (find_artifactlist (at->clone.type) == NULL) 453 if (find_artifactlist (at->type) == NULL)
454 new_draw_info_format (NDI_UNIQUE, 0, op, "No artifact list for type %d\n", at->clone.type); 454 new_draw_info_format (NDI_UNIQUE, 0, op, "No artifact list for type %d\n", at->type);
455 else 455 else
456 { 456 {
457 art = find_artifactlist (at->clone.type)->items; 457 art = find_artifactlist (at->type)->items;
458 458
459 while (art) 459 while (art)
460 { 460 {
461 if (!strcmp (art->item->name, cp)) 461 if (!strcmp (art->item->name, cp))
462 break; 462 break;
463 463
464 art = art->next; 464 art = art->next;
465 } 465 }
466 466
467 if (!art) 467 if (!art)
468 new_draw_info_format (NDI_UNIQUE, 0, op, "No such artifact ([%d] of %s)", at->clone.type, cp); 468 new_draw_info_format (NDI_UNIQUE, 0, op, "No such artifact ([%d] of %s)", at->type, cp);
469 } 469 }
470 470
471 LOG (llevDebug, "%s creates: (%d) (%d) (%s) of (%s)\n", &op->name, set_nrof ? nrof : 0, set_magic ? magic : 0, bp, cp); 471 LOG (llevDebug, "%s creates: (%d) (%d) (%s) of (%s)\n", &op->name, set_nrof ? nrof : 0, set_magic ? magic : 0, bp, cp);
472 } 472 }
473 } /* if cp */ 473 } /* if cp */
474 474
475 if ((at->clone.type == ROD || at->clone.type == WAND || at->clone.type == SCROLL || 475 if ((at->type == ROD || at->type == WAND || at->type == SCROLL ||
476 at->clone.type == HORN || at->clone.type == SPELLBOOK) && !at_spell) 476 at->type == HORN || at->type == SPELLBOOK) && !at_spell)
477 { 477 {
478 new_draw_info_format (NDI_UNIQUE, 0, op, "Unable to find spell %s for object that needs it, or it is of wrong type", cp); 478 new_draw_info_format (NDI_UNIQUE, 0, op, "Unable to find spell %s for object that needs it, or it is of wrong type", cp);
479 return 1; 479 return 1;
480 } 480 }
481 481
572 new_draw_info_format (NDI_UNIQUE, 0, op, "(%s#%d)->%s", &tmp->name, tmp->count, bp2); 572 new_draw_info_format (NDI_UNIQUE, 0, op, "(%s#%d)->%s", &tmp->name, tmp->count, bp2);
573 573
574 bp2 = bp3 + 1; 574 bp2 = bp3 + 1;
575 } 575 }
576 576
577 if (at->clone.nrof) 577 if (at->nrof)
578 { 578 {
579 if (at_spell) 579 if (at_spell)
580 insert_ob_in_ob (arch_to_object (at_spell), tmp); 580 insert_ob_in_ob (arch_to_object (at_spell), tmp);
581 581
582 tmp->x = op->x; 582 tmp->x = op->x;
617 { 617 {
618 head = dup; 618 head = dup;
619 tmp->copy_to (dup); 619 tmp->copy_to (dup);
620 } 620 }
621 621
622 dup->x = op->x + dup->arch->clone.x; 622 dup->x = op->x + dup->arch->x;
623 dup->y = op->y + dup->arch->clone.y; 623 dup->y = op->y + dup->arch->y;
624 dup->map = op->map; 624 dup->map = op->map;
625 625
626 if (head != dup) 626 if (head != dup)
627 { 627 {
628 dup->head = head; 628 dup->head = head;
638 int size_x = 0; 638 int size_x = 0;
639 int size_y = 0; 639 int size_y = 0;
640 640
641 while (check) 641 while (check)
642 { 642 {
643 size_x = MAX (size_x, check->arch->clone.x); 643 size_x = MAX (size_x, check->arch->x);
644 size_y = MAX (size_y, check->arch->clone.y); 644 size_y = MAX (size_y, check->arch->y);
645 check = check->more; 645 check = check->more;
646 } 646 }
647 647
648 if (out_of_map (op->map, head->x + size_x, head->y + size_y)) 648 if (out_of_map (op->map, head->x + size_x, head->y + size_y))
649 { 649 {
675 /* Wonder if we really want to push all of these, but since 675 /* Wonder if we really want to push all of these, but since
676 * things like rods have nrof 0, we want to cover those. 676 * things like rods have nrof 0, we want to cover those.
677 */ 677 */
678 dm_stack_push (op->contr, head->count); 678 dm_stack_push (op->contr, head->count);
679 679
680 if (at->clone.randomitems != NULL && !at_spell) 680 if (at->randomitems != NULL && !at_spell)
681 create_treasure (at->clone.randomitems, head, GT_APPLY, op->map->difficulty, 0); 681 create_treasure (at->randomitems, head, GT_APPLY, op->map->difficulty, 0);
682 682
683 esrv_send_item (op, head); 683 esrv_send_item (op, head);
684 } 684 }
685 685
686 /* free the one we used to copy */ 686 /* free the one we used to copy */
1132 size_t spell_name_length; 1132 size_t spell_name_length;
1133 1133
1134 /* First check for full name matches. */ 1134 /* First check for full name matches. */
1135 conflict_found = 0; 1135 conflict_found = 0;
1136 found = NULL; 1136 found = NULL;
1137 for (at = first_archetype; at != NULL; at = at->next) 1137 for_all_archetypes (at)
1138 { 1138 {
1139 if (at->clone.type != SPELL) 1139 if (at->type != SPELL)
1140 continue; 1140 continue;
1141 1141
1142 if (strncmp (at->archname, "spelldirect_", 12) == 0) 1142 if (strncmp (at->archname, "spelldirect_", 12) == 0)
1143 continue; 1143 continue;
1144 1144
1145 if (strcmp (at->clone.name, spell_name) != 0) 1145 if (strcmp (at->object::name, spell_name) != 0)
1146 continue; 1146 continue;
1147 1147
1148 if (found != NULL) 1148 if (found != NULL)
1149 { 1149 {
1150 if (!conflict_found) 1150 if (!conflict_found)
1171 1171
1172 /* No full match found: now check for partial matches. */ 1172 /* No full match found: now check for partial matches. */
1173 spell_name_length = strlen (spell_name); 1173 spell_name_length = strlen (spell_name);
1174 conflict_found = 0; 1174 conflict_found = 0;
1175 found = NULL; 1175 found = NULL;
1176 for (at = first_archetype; at != NULL; at = at->next) 1176 for_all_archetypes (at)
1177 { 1177 {
1178 if (at->clone.type != SPELL) 1178 if (at->type != SPELL)
1179 continue; 1179 continue;
1180 1180
1181 if (strncmp (at->archname, "spelldirect_", 12) == 0) 1181 if (strncmp (at->archname, "spelldirect_", 12) == 0)
1182 continue; 1182 continue;
1183 1183
1184 if (strncmp (at->clone.name, spell_name, spell_name_length) != 0) 1184 if (strncmp (at->object::name, spell_name, spell_name_length) != 0)
1185 continue; 1185 continue;
1186 1186
1187 if (found != NULL) 1187 if (found != NULL)
1188 { 1188 {
1189 if (!conflict_found) 1189 if (!conflict_found)
1190 { 1190 {
1191 conflict_found = 1; 1191 conflict_found = 1;
1192 new_draw_info_format (NDI_UNIQUE, 0, op, "More than one spell matches %s:", spell_name); 1192 new_draw_info_format (NDI_UNIQUE, 0, op, "More than one spell matches %s:", spell_name);
1193 new_draw_info_format (NDI_UNIQUE, 0, op, "- %s", &found->clone.name); 1193 new_draw_info_format (NDI_UNIQUE, 0, op, "- %s", &found->object::name);
1194 } 1194 }
1195 new_draw_info_format (NDI_UNIQUE, 0, op, "- %s", &at->clone.name); 1195 new_draw_info_format (NDI_UNIQUE, 0, op, "- %s", &at->object::name);
1196 continue; 1196 continue;
1197 } 1197 }
1198 1198
1199 found = at; 1199 found = at;
1200 } 1200 }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines