On 22.07.2012 16:25, Michael T. Pope wrote: > On Sun, 22 Jul 2012 03:16:19 PM Michael Vehrs wrote: > >> In order to implement Disasters properly, I need to add modifiers to a >> colony or player. It does not seem to be possible to use the ChangeSet >> like this (see comment in ServerPlayer, line 3380ff), so I'd have to >> send the whole colony or player, which is clearly inefficient. >> > Quite right. ATM we are just usually sending the whole thing, and wearing the > inefficiency. > > >> How >> should one extend ChangeSet to handle FeatureContainers, or children in >> general? >> > I have wanted some sort of generic container handling for a while. Here are > some options: > > We could have generic addTo and removeFrom messages (distinct from the > existing remove message which really means remove-from-the-game, and might be > better renamed dispose), which just extract a parent id, get the > FreeColObject, and call its addTo/removeFrom method with the child object. > There is an issue there with whether we pass the full child or not (as in the > animation code), and in complex objects like the Player there are multiple > containers to choose between, but this could be made to work. > > Or we could generalize further and extend the partial update mechanism to > allow container manipulation calls as well as the existing setFoo() forms. > Argument handling issues might bog that down, but this is probably the elegant > long term goal. > > Or just expediently extend the existing hacks in the client InGameInputHandler > addObject method which I put in as temporary solutions to this sort of problem > (e.g. adding a FoundingFather) until I could get around to one of the better > methods above:-). > > Cheers, > Mike Pope >
I think I'll take the easy road just now. However, it would seem possible to leverage the readFromXML code, provided that we do not reset values that are not present to their defaults. I'll think about that some more. Regards Michael ------------------------------------------------------------------------------ Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ _______________________________________________ Freecol-developers mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/freecol-developers
