From: Iain A. <ia...@co...> - 2005-03-06 20:39:47
|
John David Galt wrote: >Erik Vos wrote: >> I was talking about objects reporting their state *changes*. >> We need that to create a readable game log (e.g. for PBEM). >I like this in principle. However, since money does not appear or >disappear but goes somewhere, I suggest that all money movements be >handled by a single function ("Transfer" with two arguments) and >logged as a single action. If "add $30 to Player 1" and "subtract >$30 from the Bank" are two separate actions, it"s too easy for one >to get done and the other skipped. That is an excellent point. Instead of any object (Company, Player, etc) holding money, it should be considered a 'MoneyHolder', and the Bank should be responsible for keeping the balance of each MoneyHolder's account. Of course, the 'bank pool' needs to be one of these, and in most (all?) games is the only one which can have a negative balance - the transistion to negative generally causing a 'game end' flag to set. Note that this balance could be positive at game end, since cash can be transferred back (e.g. by train transfers) after the game end is triggered. Iain. |