Re: [Code][Long] Coins Snippet -> thoughts about it.

From: The Merciless Lord of Everything (serces@mud.dk)
Date: 06/15/00


On Thu, 15 Jun 2000, Pure Krome wrote:

> so either i should check for all places where OBJ WEIGHT is checked (eg.
or replace the GET_WEIGHT(ch) macro with a float|int|long
get_weight(ch) function? Checking the Weight of a person then add up the
coins afterwards.

something like (This is mailercode, so I'm not responsible for
anything! :)

float money_weight[NUM_MONEY_TYPES] = {
   0.1,  /* Platinum */
   0.01, /* Gold     */
   0.005 /* Silver   */
   0.001 /* Copper   */
};

float get_weight(struct char_data *ch)
{
  float weight = 0; /* Assume that player has nothing! */
  int i = 0;
/*
** One way of doing this could be to keep the old GET_WEIGHT macro
*/
  weight += GET_WEIGHT(ch);
  for (i=0;i < NUM_MONEY_TYPES;i++) {
    weight += ch->points.money[i] * gold_weight[i];
  }
  return weight;
}

Hopla, this of course only checks for weight and do not set it.. Could
definately be made more flexible.. :) (It could even be made into a macro,
but I'm too tired to see how right now.. :)

> players running around with 100,000 gold coins?  [I HATE IT - but that's me]
:) I know the feeling "gold player - player has 20.000.000 coins" *argh*


My 2 cents (I don't know if they're gold, platinum or copper.. :)

/Serces

"The Law of Self Sacrifice"
When you starve with a tiger, the tiger starves last.


     +------------------------------------------------------------+
     | 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