version 1.59 | | version 1.60 |
---|
| | |
/* | | /* |
* static char *rcsid_gods_c = | | * static char *rcsid_gods_c = |
* "$Id: gods.c,v 1.59 2006/04/06 21:18:35 tchize Exp $"; | | * "$Id: gods.c,v 1.60 2006/05/05 09:26:35 ryo_saeba Exp $"; |
*/ | | */ |
| | |
/* | | /* |
| | |
#include <sproto.h> | | #include <sproto.h> |
#endif | | #endif |
| | |
| | static int worship_forbids_use(object *op, object *exp_obj, uint32 flag, const char *string); |
| | static void stop_using_item(object *op, int type, int number); |
| | static void update_priest_flag (object *god, object *exp_ob, uint32 flag); |
| | static void god_intervention(object *op, object *god, object *skill); |
| | static int god_examines_priest (object *op, object *god); |
| | static int god_examines_item(object *god, object *item); |
| | static const char *get_god_for_race(const char *race); |
| | |
/** | | /** |
* Returns the id of specified god. | | * Returns the id of specified god. |
*/ | | */ |
int lookup_god_by_name(const char *name) { | | static int lookup_god_by_name(const char *name) { |
int godnr=-1; | | int godnr=-1; |
size_t nmlen = strlen(name); | | size_t nmlen = strlen(name); |
| | |
| | |
* string is the string to print out. | | * string is the string to print out. |
*/ | | */ |
| | |
int worship_forbids_use (object *op, object *exp_obj, uint32 flag, const char *string) { | | static int worship_forbids_use (object *op, object *exp_obj, uint32 flag, const char *string) { |
| | |
if(QUERY_FLAG(&op->arch->clone,flag)) | | if(QUERY_FLAG(&op->arch->clone,flag)) |
if(QUERY_FLAG(op,flag)!=QUERY_FLAG(exp_obj,flag)) { | | if(QUERY_FLAG(op,flag)!=QUERY_FLAG(exp_obj,flag)) { |
| | |
/** | | /** |
* Unapplies up to number worth of items of type | | * Unapplies up to number worth of items of type |
*/ | | */ |
void stop_using_item ( object *op, int type, int number ) { | | static void stop_using_item ( object *op, int type, int number ) { |
object *tmp; | | object *tmp; |
| | |
for(tmp=op->inv;tmp&&number;tmp=tmp->below) | | for(tmp=op->inv;tmp&&number;tmp=tmp->below) |
| | |
* already exist. For players only! | | * already exist. For players only! |
*/ | | */ |
| | |
void update_priest_flag (object *god, object *exp_ob, uint32 flag) { | | static void update_priest_flag (object *god, object *exp_ob, uint32 flag) { |
if(QUERY_FLAG(god,flag)&&!QUERY_FLAG(exp_ob,flag)) | | if(QUERY_FLAG(god,flag)&&!QUERY_FLAG(exp_ob,flag)) |
SET_FLAG(exp_ob,flag); | | SET_FLAG(exp_ob,flag); |
else if(QUERY_FLAG(exp_ob,flag)&&!QUERY_FLAG(god,flag)) | | else if(QUERY_FLAG(exp_ob,flag)&&!QUERY_FLAG(god,flag)) |
| | |
* called from pray_at_altar() currently. | | * called from pray_at_altar() currently. |
*/ | | */ |
| | |
void god_intervention (object *op, object *god, object *skill) | | static void god_intervention (object *op, object *god, object *skill) |
{ | | { |
treasure *tr; | | treasure *tr; |
| | |
| | |
* All applied items are examined, if player is using more items of other gods, | | * All applied items are examined, if player is using more items of other gods, |
* s/he loses experience in praying or general experience if no praying. | | * s/he loses experience in praying or general experience if no praying. |
*/ | | */ |
int god_examines_priest (object *op, object *god) { | | static int god_examines_priest (object *op, object *god) { |
int reaction=1; | | int reaction=1; |
object *item=NULL, *skop; | | object *item=NULL, *skop; |
| | |
| | |
* god, it can be bad...-b.t. | | * god, it can be bad...-b.t. |
*/ | | */ |
| | |
int god_examines_item(object *god, object *item) { | | static int god_examines_item(object *god, object *item) { |
char buf[MAX_BUF]; | | char buf[MAX_BUF]; |
| | |
if(!god||!item) return 0; | | if(!god||!item) return 0; |
| | |
* Straight calls lookup_god_by_name | | * Straight calls lookup_god_by_name |
*/ | | */ |
| | |
int get_god(object *priest) { | | static int get_god(object *priest) { |
int godnr=lookup_god_by_name(determine_god(priest)); | | int godnr=lookup_god_by_name(determine_god(priest)); |
| | |
return godnr; | | return godnr; |
| | |
* creature of who has race *race | | * creature of who has race *race |
* if we can't find a god that is appropriate, we return NULL | | * if we can't find a god that is appropriate, we return NULL |
*/ | | */ |
const char *get_god_for_race(const char *race) { | | static const char *get_god_for_race(const char *race) { |
godlink *gl=first_god; | | godlink *gl=first_god; |
const char *godname=NULL; | | const char *godname=NULL; |
| | |