Re: About GET_SAVE

From: Mysidia (jmhess@i-55.com)
Date: 06/16/00


On Fri, 16 Jun 2000, Elwartowski, William wrote:

> It seems to me that this is a bit strange.  In the code all that GET_SAVE
> does
> is give the bonus saves.  Wouldn't it be more logical to have GET_SAVE give
> the actual, complete, saving throw?

   Nope, the behavior's correct.  GET_SAVE gets info as it relates to the
character, not the class -- it's a readable/writable macro to get/change
the bonus/penalty save -- the saving throw for each class at a certain
level is a fixed value that should really only be needed where a saving
dice is being thrown; see mag_savingthrow, magic.c.

   IOW, GET_SAVE() is an accessor for a variable, getting the entire
saving throw is a calculation not simple accessing of a data element.

( Most of the GET_* macros are purely variable accessors [-- well except
  the GET_ things that access player_special_data which invoke
  a CHECK_PLAYER_SPECIALS macro that attempts to prevent ignorant people
  from ignorantly accessing the player_specials struct on a mob <chuckle
  -- that thing should abort() instead of logging and trying to protect
  people from their mistakes!>].

--
   If the save total were needed more often than in magic.c it would
prolly make sense for it to have a calculation macro along the lines of
as follows, or perhaps just an inlined (dependant on compiler) function...

<pseudo-code>

#define SAVING_THROW(ch, type, modifier) \
        ((ch && type >= SAVING_PARA && type <= SAVING_SPELL) ?
        (saving_throws((IS_NPC(ch) ? CLASS_WARRIOR: GET_CLASS(ch)), type, \
             (ch)->player.level ) \
        + GET_SAVE(ch, type) + modifier) : 0)

</pseudo-code>

-Mysid


     +------------------------------------------------------------+
     | Ensure that you have read the CircleMUD Mailing List FAQ:  |
     |  http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html  |
     +------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 04/10/01 PDT