Difference for server/gods.c from version 1.41 to 1.42


version 1.41 version 1.42
Line 1
 
Line 1
 /*  /*
  * static char *rcsid_gods_c =   * static char *rcsid_gods_c =
  *   "$Id: gods.c,v 1.41 2004/04/18 07:59:36 mwedel Exp $";   *   "$Id: gods.c,v 1.42 2004/04/18 09:32:30 ryo_saeba Exp $";
  */   */
   
 /*  /*
Line 42
 
Line 42
 #include <sproto.h>  #include <sproto.h>
 #endif  #endif
   
   /**
    * Returns the id of specified god.
    */
 int lookup_god_by_name(char *name) {  int lookup_god_by_name(char *name) {
     int godnr=-1,nmlen = strlen(name);      int godnr=-1,nmlen = strlen(name);
    
Line 55
 
Line 58
     return godnr;      return godnr;
 }  }
   
   /**
    * Returns pointer to specified god's object through pntr_to_god_obj..
    */
 object *find_god(char *name) {  object *find_god(char *name) {
     object *god=NULL;      object *god=NULL;
   
Line 68
 
Line 74
     return god;      return god;
 }  }
   
 /* determine_god() - determines if op worships a god. Returns  /**
  * the godname if they do. In the case of an NPC, if they have   * Determines if op worships a god.
    * Returns the godname if they do. In the case of an NPC, if they have
  * no god, we give them a random one. -b.t.   * no god, we give them a random one. -b.t.
  */   */
   
Line 114
 
Line 121
     return ("none");      return ("none");
 }  }
   
   /**
    * Returns 1 if s1 and s2 are the same - either both NULL, or strcmp( ) == 0
    */
 static int same_string (const char *s1, const char *s2)  static int same_string (const char *s1, const char *s2)
 {  {
     if (s1 == NULL)      if (s1 == NULL)
Line 129
 
Line 139
 }  }
   
   
 /*  /**
  * follower_remove_similar_item - Checks for any occurrence of   * Checks for any occurrence of the given 'item' in the inventory of 'op' (recursively).
  * the given 'item' in the inventory of 'op' (recursively).  
  * Any matching items in the inventory are deleted, and a   * Any matching items in the inventory are deleted, and a
  * message is displayed to the player.   * message is displayed to the player.
  */   */
Line 168
 
Line 177
     }      }
 }  }
   
 /*  /**
  * follower_has_similar_item - Checks for any occurrence of   * Checks for any occurrence of the given 'item' in the inventory of 'op' (recursively).
  * the given 'item' in the inventory of 'op' (recursively).  
  * Returns 1 if found, else 0.   * Returns 1 if found, else 0.
  */   */
 static int follower_has_similar_item (object *op, object *item)  static int follower_has_similar_item (object *op, object *item)
Line 190
 
Line 198
     return 0;      return 0;
 }  }
   
   /**
    * God gives an item to the player.
    */
 static int god_gives_present (object *op, object *god, treasure *tr)  static int god_gives_present (object *op, object *god, treasure *tr)
 {  {
     object *tmp;      object *tmp;
Line 206
 
Line 217
     return 1;      return 1;
 }  }
   
   /**
    * Player prays at altar.
    * Checks for god changing, divine intervention, and so on.
    */
 void pray_at_altar(object *pl, object *altar, object *skill) {  void pray_at_altar(object *pl, object *altar, object *skill) {
     object *pl_god=find_god(determine_god(pl));      object *pl_god=find_god(determine_god(pl));
     int return_pray_script; /* GROS : This is for return value of script */      int return_pray_script; /* GROS : This is for return value of script */
Line 322
 
Line 337
     }      }
 }  }
   
   /**
    * Removes special prayers given by a god.
    */
 static void check_special_prayers (object *op, object *god)  static void check_special_prayers (object *op, object *god)
 {  {
     /* Ensure that 'op' doesn't know any special prayers that are not granted      /* Ensure that 'op' doesn't know any special prayers that are not granted
Line 379
 
Line 397
     }      }
 }  }
   
 /*  /**
  * become_follower - This function is called whenever a player has   * This function is called whenever a player has
  * switched to a new god. It handles basically all the stat changes   * switched to a new god. It handles basically all the stat changes
  * that happen to the player, including the removal of godgiven   * that happen to the player, including the removal of godgiven
  * items (from the former cult).   * items (from the former cult).
Line 527
 
Line 545
     check_special_prayers (op, new_god);      check_special_prayers (op, new_god);
 }  }
   
 /* op is the player.  /**
    * Forbids or let player use something item type.
    * op is the player.
  * exp_obj is the widsom experience.   * exp_obj is the widsom experience.
  * flag is the flag to check against.   * flag is the flag to check against.
  * string is the string to print out.   * string is the string to print out.
Line 548
 
Line 568
   return 0;    return 0;
 }  }
   
 /* stop_using_item() - 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 ) {  void stop_using_item ( object *op, int type, int number ) {
   object *tmp;    object *tmp;
   
Line 559
 
Line 581
     }      }
 }  }
   
 /* update_priest_flag() - if the god does/doesnt have this flag, we  /**
    * If the god does/doesnt have this flag, we
  * give/remove it from the experience object if it doesnt/does   * give/remove it from the experience object if it doesnt/does
  * already exist. For players only!   * already exist. For players only!
  */   */
Line 609
 
Line 632
     return NULL;      return NULL;
 }  }
   
   /**
    * God helps player by removing curse and/or damnation.
    */
 static int god_removes_curse (object *op, int remove_damnation)  static int god_removes_curse (object *op, int remove_damnation)
 {  {
     object *tmp;      object *tmp;
Line 649
 
Line 674
     return (30 + (level - 40) / 4) / difficulty;      return (30 + (level - 40) / 4) / difficulty;
 }  }
   
   /**
    * God wants to enchant weapon.
    * Affected weapon is the applied one (weapon or bow). It's checked to make sure
    * it isn't a weapon for another god. If all is all right, update weapon with
    * attacktype, slaying and such.
    */
 static int god_enchants_weapon (object *op, object *god, object *tr, object *skill)  static int god_enchants_weapon (object *op, object *god, object *tr, object *skill)
 {  {
     char buf[MAX_BUF];      char buf[MAX_BUF];
Line 704
 
Line 735
 }  }
   
   
 /* god_intervention() - called from praying() currently. Every  /**
  * once in a while the god will intervene to help the worshiper.   * Every once in a while the god will intervene to help the worshiper.
  * Later, this fctn can be used to supply quests, etc for the    * Later, this fctn can be used to supply quests, etc for the
  * priest. -b.t.    * priest. -b.t.
    * called from pray_at_altar() currently.
  */   */
   
 void god_intervention (object *op, object *god, object *skill)  void god_intervention (object *op, object *god, object *skill)
Line 929
 
Line 961
     new_draw_info (NDI_UNIQUE, 0, op, "You feel rapture.");      new_draw_info (NDI_UNIQUE, 0, op, "You feel rapture.");
 }  }
   
   /**
    * Checks and maybe punishes someone praying.
    * 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.
    */
 int god_examines_priest (object *op, object *god) {  int god_examines_priest (object *op, object *god) {
     int reaction=1;      int reaction=1;
     object *item=NULL, *skop;      object *item=NULL, *skop;
Line 962
 
Line 998
     return reaction;      return reaction;
 }  }
   
 /* god_likes_item() - your god looks at the item you  /**
  * are using and we return either -1 (bad), 0 (neutral) or   * God checks item the player is using.
    * Return either -1 (bad), 0 (neutral) or
  * 1 (item is ok). If you are using the item of an enemy   * 1 (item is ok). If you are using the item of an enemy
  * god, it can be bad...-b.t. */   * god, it can be bad...-b.t.
    */
   
 int god_examines_item(object *god, object *item) {  int god_examines_item(object *god, object *item) {
   char buf[MAX_BUF];    char buf[MAX_BUF];
Line 992
 
Line 1030
   return 0; /* item is sacred to a non-enemy god/or is otherwise magical */     return 0; /* item is sacred to a non-enemy god/or is otherwise magical */
 }  }
   
 /* get_god() - returns the gods index in linked list   /**
  * if exists, if not, it returns -1. -b.t.  */   * Returns priest's god's id.
    * Straight calls lookup_god_by_name
    */
   
 int get_god(object *priest) {  int get_god(object *priest) {
   int godnr=lookup_god_by_name(determine_god(priest));     int godnr=lookup_god_by_name(determine_god(priest));
Line 1002
 
Line 1042
 }  }
   
   
 /* tailor_god_spell() - changes the attributes of cone, smite,   /**
  * and ball spells as needed by the code. Returns false if there   * Changes the attributes of cone, smite, and ball spells as needed by the code.
  * was no race to assign to the slaying field of the spell, but   * Returns false if there was no race to assign to the slaying field of the spell, but
  * the spell attacktype contains AT_HOLYWORD.  -b.t.   * the spell attacktype contains AT_HOLYWORD.  -b.t.
  */   */
   


Legend:
line(s) removed in v.1.41 
line(s) changed
 line(s) added in v.1.42

File made using version 1.98 of cvs2html by leaf at 2011-07-21 17:33