On 5/21/06, Erik Vos <eri...@hc...> wrote:
> I seem to have managed to implement emergency train buying.
>
> The president can now add cash in those cases where the 1830
> rules allow that (including extra cash up to list price if
> a train is bought from another company).
> If the president must sell shares, a short "ShareSellingRound"
> is thrown in (a subclass of StockRound).
>
> To make this happen, the ORPanel/OperatingRound interface has changed,
> and most of the old decision logic has been moved from ORPanel
> to OperatingRound, where it belongs. The model now decides which
> trains are for sale, and what special actions are allowed or even
> required (such as adding cash). A new class BuyableTrain holds
> this info, and the model returns a List of BuyableTrain objects
> to the view. This list only includes trains that the company actually
> can buy in one way or another. If there is insufficient cash, only
> the cheapest train in the bank can be bought (or any company train).
> The view (GUI) returns the actually chosen BuyableTrain to the model,
> for further processing.
>
> It all seems to work (I tested this with a fictituous 1830 game
> without privates, where companies float at 20% and where the smallest
> trains are 6-trains).
>
> Bankruptcy is not yet detected, that will be the last thing,
> together with the long-awaited end-of-game report.
>
> In addition I have added coordinates to the stock chart (an old wish of
> mine).
> This was far less easy than it looks, mostly because, despite all
> documentation, JLabel preferred and minimum sizes do not seem to be
> honoured by BoxLayout. I guess I did something wrong, but I can't figure =
out
> what.
> The current coordinate display is not perfect, but should be good enough.
>
> Erik.
>
>
Awesome. I'll see if I can get some time to test it out.
---Brett.
|