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

Comparing deliantra/server/common/loader.C (file contents):
Revision 1.118 by elmex, Sun Aug 31 15:49:13 2008 UTC vs.
Revision 1.123 by root, Mon Sep 29 10:32:50 2008 UTC

385 if (ip > 2 * item_power && ip > (item_power + 3)) 385 if (ip > 2 * item_power && ip > (item_power + 3))
386 LOG (llevDebug, "Object %s seems to have too low item power? %d > %d\n", debug_desc (), ip, item_power); 386 LOG (llevDebug, "Object %s seems to have too low item power? %d > %d\n", debug_desc (), ip, item_power);
387#endif 387#endif
388 } 388 }
389 389
390 /* Old spellcasting object - need to load in the appropiate object */ 390 /* old style spellcasting object (pretty common) - need to load in the appropiate object */
391 /* (schmorp) old really doesn't mean old, imho, just a more compact way to store such objects */
391 if ((type == ROD 392 if ((type == ROD
392 || type == WAND 393 || type == WAND
393 || type == SCROLL 394 || type == SCROLL
394 || type == HORN 395 || type == HORN
395 || type == FIREWALL 396 || type == FIREWALL
396 /* POTIONS and ALTARS don't always cast spells, but if they do, update them */ 397 /* POTIONS and ALTARS don't always cast spells, but if they do, update them */
397 || ((type == POTION || type == ALTAR) && stats.sp)) // watchout: sp = 0 is still magic bullet. 398 || ((type == POTION || type == ALTAR) && stats.sp)) // watchout: sp = 0 is still magic bullet.
398 && !inv 399 && !inv
399 && !loading_arch 400 && !loading_arch
400 && !randomitems) // by elmex: not _any_ rod or horn we find on a map, which has randomitems is an old spellcasting 401 && stats.sp) // watchout: old magic bullet stuff directly on the map is going to break here!
401 // object. For instance lythanders pipe got it's spell in the treasurelist in the randomitems, 402 // TODO: at least one watchout-comments is redundant - investigate/remove
402 // same goes for normal rods.
403 { 403 {
404 // TODO: fix firewall object on map
404 /* Firewall is bizarre in that spell type was stored in dam. Rest are 'normal' 405 /* Firewall is bizarre in that spell type was stored in dam. Rest are 'normal'
405 * in that spell was stored in sp. 406 * in that spell was stored in sp.
406 */ 407 */
407 LOG (llevError, "old spellcasting object found: %s", debug_desc ()); 408 //LOG (llevError, "old spellcasting object found: %s", debug_desc ());
408 object *tmp = get_archetype (spell_mapping[type == FIREWALL ? stats.dam : stats.sp]); 409 object *tmp = get_archetype (spell_mapping[type == FIREWALL ? stats.dam : stats.sp]);
409 insert_ob_in_ob (tmp, this); 410 insert_ob_in_ob (tmp, this);
411 randomitems = 0;
410 } 412 }
411 413
412 /* spellbooks & runes use slaying. But not to arch name, but to spell name */ 414 /* spellbooks & runes use slaying. But not to arch name, but to spell name */
413 if ((type == SPELLBOOK || type == RUNE) && slaying && !inv && !loading_arch) 415 if ((type == SPELLBOOK || type == RUNE) && slaying && !inv && !loading_arch)
414 { 416 {
558 case KW_race: f.get_ornull (race); break; 560 case KW_race: f.get_ornull (race); break;
559 case KW_slaying: f.get_ornull (slaying); break; 561 case KW_slaying: f.get_ornull (slaying); break;
560 case KW_tag: f.get_ornull (tag); break; 562 case KW_tag: f.get_ornull (tag); break;
561 563
562 case KW_arch: 564 case KW_arch:
563 {
564 object *tmp = object::read (f); 565 if (object *tmp = object::read (f))
565 tmp->deactivate ();
566
567 { 566 {
567 tmp->deactivate ();
568
568 // was: insert_ob_in_ob (tmp, op); 569 // was: insert_ob_in_ob (tmp, op);
569 // but manually adding it can improve map loading times a lot 570 // but manually adding it can improve map loading times a lot
570 // also, appending instead of prepending keeps the 571 // also, appending instead of prepending keeps the
571 // save ordering the same between repeated load/saves. 572 // save ordering the same between repeated load/saves.
572 // and finally we do not want any funny effects 573 // and finally we do not want any funny effects
589 590
590 tmp->below = 0; 591 tmp->below = 0;
591 tmp->env = this; 592 tmp->env = this;
592 op_inv = tmp; 593 op_inv = tmp;
593 } 594 }
594 } 595 else
596 LOG (llevError, "ERROR: couldn't load inventory object, file corrupted?\n");
597
595 continue; 598 continue;
596 599
597 case KW_other_arch: 600 case KW_other_arch:
598 if (loading_arch == this) 601 if (loading_arch == this)
599 archetype::postpone_arch_ref (loading_arch->other_arch, f.get_str ()); 602 archetype::postpone_arch_ref (loading_arch->other_arch, f.get_str ());
1056 // instance() activates, this should be fixed properly 1059 // instance() activates, this should be fixed properly
1057 op->deactivate (); 1060 op->deactivate ();
1058 1061
1059 if (!op->parse_kv (f)) 1062 if (!op->parse_kv (f))
1060 { 1063 {
1061 op->destroy (true); 1064 op->destroy ();
1062 return 0; 1065 return 0;
1063 } 1066 }
1064 1067
1065 op->post_load_check (); 1068 op->post_load_check ();
1066 return op; 1069 return op;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines