From: Brett L. <wak...@ea...> - 2005-12-26 04:48:51
|
>> 3. For the token drawing... is it deliberate that it's not >> currently being drawn, or is it a bug (and should I look into >> fixing the bug)? > >The problem is in the Token laying code, which requires the token >to be known by the Model before it can be shown. This is unlike tiles, >which are only reported as being laid to the Model when "Done" is pressed. > >The idea is that the token should already be drawn if GUIHex or GUITile >knows about it >as a "provisionalGUIToken", similar to the existing "provisionalGUITile". >I was intending to handle tokens similarly, but to enable that token laying >(positioning) and token drawing should be decoupled. > >Trying to fix this, I got lost in all kinds of changes all over >the place, and finally reverted everything for a fresh start. > >Among the things I was working on are: > >- Unless absolutely needed, I would have left the stock chart tokens >out of the TokenHolder implementors (the stock chart token is a totally >different thing, only its physical representation is identical for >practical reasons). I think the Stock Chart was perfect as it was. > >- I was creating a new model-side BaseToken object, linked to both a company >and (optionally) a station (the exiting Token would be renamed to GUIToken). >This would make it easier to enumerate and manage laid and unlaid tokens >(in some games tokens can come back to the company). > >(Talking about enumeration, we don't count laid tiles yet against >the maximum available number. I think I'll do that first now >for better inspiration on how to manage the tokens). > >- I'm am not sure if we should really use the rather fluid existing Station >object (per tile) to hold tokens, rather than a new Station-like object that > >is persistent, and would because of that better be suited to act as a node >in the Route network that we will have to build one day. >Tile-linked station objects come and go as tiles are laid and upgraded. >I think we need a more persistent kind of object. > >But I found that all these things need more thought (and I got lost, as I >said). Wow. Now I can see why you got lost. You've nested the token laying calls quite deeply. I think much of this could be simplified, but for now it works with the one-line change I've committed. In PublicCompany.layBaseToken() you were adding the token to the company, but weren't adding the token to the hex. After including a call to hex.addToken(), the token is being drawn on the map. Now we just need to add in the logic for selecting the station for hexes with multiple stations. ---Brett. |