From: Stewart T. <wsr...@ho...> - 2005-02-28 23:44:59
|
Brett, As promised, you'll find atached my sketched out object model in UML for the core generic framework. Rather than try sending a Visio file, I'm sending a snapshot as a PNG file. A few explanatory words are probably called for. I've modelled "Bank", "Player" and "Company" as subclasses of a common "Entity" class. This allows inherited code to take care of common functionality and in particular relationships. "Stock" can be held by any of "Bank", "Player" or "Company" in some 18xx games. In 1841, IIRC, major companies can even hold stock in other companies. This brings an opportunity to write very simple code for functionality like dividends: some "payDividend" (with amount parameter) method on "Company" simply loops round all issued "Stock" (follows the "issues" relationship), calling a "payDividend" method on each "Stock" object, which pays the correct amount (adjusted for percentage share) to the owning "Entity" (follows the inverse "owns" relationship). Similarly, all Stock trades can be implemented with a single method that changes the owner. I've subclassed "Tile" into "VariableTile" and "FixedTile". My idea is that we represent all of the printed map hexes as instances of "FixedTile". This mean that they can all be drawn in GUI in the same way, and those printed portions of the map that can have tokens placed on them, or upgraded in later phases do not need to be treated as a special case. I've separated the "Tile" from the "Location", so that relationships with "Token" don't need to be adjusted when a tile is upgraded. The "Round" hierarchy hanging off "Game" is really just a placeholder. If you want to keep an audit trail of player and company actions for future analysis or replay, then this is where I would put it in the object model. I've split "Company" into "Major" and "Minor" because in some 18xx games, they are governed by different rules. This is very much a first attempt at an object model. At this stage I've concentrated on the objects themselves and their relationships. I have made no attempt to fill in each object's attributes and methods. If you have any questions please email me and I'll be happy to answer them. cheers Stewart |