From: Mark S. <mar...@gm...> - 2008-10-31 21:26:13
|
I ran through a quick test on 1830, and it sets the price, but throws the same NULL Pointer on the same line. And after that there are still no available shares to be bought in the Stock Round Window. So the fix did not resolve the problem entirely. (there may be another NULL Pointer being thrown). I would point it out to you, but a Puppy on my lap is keeping me from proper debugging mode. Mark On Fri, Oct 31, 2008 at 4:11 PM, Erik Vos <eri...@hc...> wrote: > Note in the PublicCompany Class, the routine to get the ParPrice, and > hasParPrice are checking the boolean flag 'hasParPrice. What I really don't > understand is why have this boolean at all? If the company has a Par Price, > the variable 'parPrice' will NOT be null. > > hasParPrice is a static (not in the java sense) game parameter, set at game > loading time. It only means: there is a par price that is not necessarily > equal to the current price. This price does not need to have been set yet. > One use of hasParPrice is to create an extra"ParPrice" column in the Game > status, which is absent in games like 1851 that do not have a separate par > price. > > parPrice is 0 until a price has been set. > > > If it is null, than there is no Par Price. Now, if you are trying to use > the boolean hasParPrice to indicate that the Company is available for > purchase, then it should be named 'availableForPurchase'. This way you can > have a "Fixed" Par Price set before you can actually buy the stock. > > Yes, but that it not what it means. > > But your "fix" to change line 178 to 'if (comp.getParPrice() != null) {' > moves the test from the PublicCompany Class back out to the setBuyableCerts > Class which I feel is not right right way to fix it. If you have the > 'hasParPrice' routine perform the test instead it would be a better > solution. > > Perhaps we need a extra method hasAPriceBeenSet or such. We'll see. > > Mark > > |