version 1.91 | | version 1.92 |
---|
| | |
/* | | /* |
* static char *rcsid_apply_c = | | * static char *rcsid_apply_c = |
* "$Id: apply.c,v 1.91 2003/10/24 20:02:30 ryo_saeba Exp $"; | | * "$Id: apply.c,v 1.92 2003/11/10 05:39:50 mwedel Exp $"; |
*/ | | */ |
/* | | /* |
CrossFire, A Multiplayer game for X-windows | | CrossFire, A Multiplayer game for X-windows |
| | |
return 0; | | return 0; |
} | | } |
| | |
static void insert_special_prayer_mark (object *op, char *spell) | | |
{ | | |
object *force = get_archetype ("force"); | | |
force->speed = 0; | | |
update_ob_speed (force); | | |
force->slaying = add_string ("special prayer"); | | |
if (force->name) free_string(force->name); | | |
force->name = add_string(spell); | | |
insert_ob_in_ob (force, op); | | |
} | | |
| | |
void do_learn_spell (object *op, object *spell, int special_prayer) | | void do_learn_spell (object *op, object *spell, int special_prayer) |
{ | | { |
object *tmp = find_special_prayer_mark (op, spell->name); | | object *tmp; |
| | |
if (op->type != PLAYER) { | | if (op->type != PLAYER) { |
LOG (llevError, "BUG: do_learn_spell(): not a player\n"); | | LOG (llevError, "BUG: do_learn_spell(): not a player\n"); |
| | |
} | | } |
| | |
/* Upgrade special prayers to normal prayers */ | | /* Upgrade special prayers to normal prayers */ |
if (check_spell_known (op, spell->name)) { | | if ((tmp=check_spell_known (op, spell->name))!=NULL) { |
if (special_prayer || ! tmp) { | | if (special_prayer && !QUERY_FLAG(tmp, FLAG_STARTEQUIP)) { |
LOG (llevError, "BUG: do_learn_spell(): spell already known, but can't upgrade it\n"); | | LOG (llevError, "BUG: do_learn_spell(): spell already known, but not marked as startequip\n"); |
return; | | return; |
} | | } |
remove_ob (tmp); | | |
free_object (tmp); | | |
return; | | return; |
} | | } |
| | |
/* Learn new spell/prayer */ | | |
if (tmp) { | | |
LOG (llevError, "BUG: do_learn_spell(): spell unknown, but special prayer mark present\n"); | | |
remove_ob (tmp); | | |
free_object (tmp); | | |
} | | |
play_sound_player_only (op->contr, SOUND_LEARN_SPELL, 0, 0); | | play_sound_player_only (op->contr, SOUND_LEARN_SPELL, 0, 0); |
tmp = get_object(); | | tmp = get_object(); |
copy_object(spell, tmp); | | copy_object(spell, tmp); |
insert_ob_in_ob(tmp, op); | | insert_ob_in_ob(tmp, op); |
| | |
/* For godgiven spells the player gets a reminder-mark inserted, | | |
* that this spell must be removed on changing cults! | | |
*/ | | |
if (special_prayer) { | | if (special_prayer) { |
insert_special_prayer_mark (op, spell->name); | | |
SET_FLAG(tmp, FLAG_STARTEQUIP); | | SET_FLAG(tmp, FLAG_STARTEQUIP); |
} | | } |
| | |