NEWBIE: Adding other types of money? (fwd)

From: Billy H. Chan (bhchan@po.EECS.Berkeley.EDU)
Date: 05/09/96


A few ideas came up last round this was asked (around November)
One simple way was to simple do some % and / playing and allow automatic
currency transforms (if you have 10 coppers, it gets changed into a silver
automatically)... then, say 10 c = 1 s, you could have 
	i = GET_GOLD(ch);
	silver = i / 10
	copper = i % 10
(of course, you don't need the i in the first place, but I tend toward 
 memoizing values... steming back to a memory-space vs. processor time
 debate.  Memoizing a value is probably only efficient when the value 
 comes from a long chain of functions... since GET_GOLD is a macro, there's
 no benefit.  Sorry for the lecture...)

This method is simple and doesn't entail a pwipe... loath to some existing/
open'ed sites.

Otherwise, you could just add a few more sh_int/int/long slots in char_data
where gold/bank was originally declared.
If this was C++, then of  course gold/bank would point to a subclass with
it's own set of memberfunctions, but since it ain't, you could either replace
it with x types of currency for each, ie: copper, bank_copper, silver,
bank_silver.
Hope this helps.
-- Billy  H. Chan     bhchan@po.eecs.berkeley.edu  bhchan@csua.berkeley.edu
   CogSci/CompSci     http://www.csua.berkeley.edu/~bhchan     ResumeInside



This archive was generated by hypermail 2b30 : 12/18/00 PST