… | |
… | |
673 | op->destroy (); |
673 | op->destroy (); |
674 | continue; |
674 | continue; |
675 | } |
675 | } |
676 | } |
676 | } |
677 | |
677 | |
678 | /* This really needs to be better - we should really give |
678 | /* Here we remove duplicated skills (as duplicated spell objects have |
679 | * a substitute spellbook. The problem is that we don't really |
679 | * _very_ confusing effects for players), which could for instance be |
680 | * have a good idea what to replace it with (need something like |
680 | * generated by bad treasurelists. - elmex |
681 | * a first level treasurelist for each skill.) |
|
|
682 | * remove duplicate skills also |
|
|
683 | */ |
681 | */ |
684 | if (op->type == SPELLBOOK || op->type == SKILL) |
682 | if (op->type == SKILL) |
685 | { |
683 | { |
686 | object *tmp; |
|
|
687 | |
|
|
688 | for (tmp = op->below; tmp; tmp = tmp->below) |
684 | for (object *tmp = op->below; tmp; tmp = tmp->below) |
689 | if (tmp->type == op->type && tmp->name == op->name) |
685 | if (tmp->type == op->type && tmp->name == op->name) |
690 | break; |
|
|
691 | |
|
|
692 | if (tmp) |
|
|
693 | { |
686 | { |
694 | op->destroy (); |
687 | op->destroy (); |
|
|
688 | LOG (llevError, |
695 | LOG (llevError, "give_initial_items: Removing duplicate object %s\n", &tmp->name); |
689 | "give_initial_items: Removing duplicate skill %s\n", &tmp->name); |
696 | continue; |
690 | break; |
697 | } |
691 | } |
698 | |
692 | |
699 | if (op->nrof > 1) |
693 | if (op->nrof > 1) |
700 | op->nrof = 1; |
694 | op->nrof = 1; |
701 | } |
695 | } |
702 | |
696 | |