On 09/05/09 13:22, Torsten Dreyer wrote: > Looks like this is a chicken-egg problem: > > The chicken: > The model class in multiplayer.nas listens on the > property /ai/models/model-added and checks for all models the > property "valid" to be true. > > The egg: > When AIManager attaches a model, it first loads the model by calling > model->init(); > FGAIBase::init() calls FGAIBase::load3DModel() which calls > FGAIBase::initModel() which sets property /ai/models/model-added. (This > triggers the chicken, but "valid" is not yet set to true) > _AFTER_ model->init() in AIManager::atach() is finished, the property "valid" > in the /ai/models/multiplayer[n] is set to true. > > This causes new latest addition to the multiplayer list to be ignored. > > I think the behaviour of FGAIBase and AIManager is correct to set the "valid" > property to true after the initialization is complete. > I also think that the check for "valid" in the model class in multiplayer.nas > is required to stay there. > > I have just commited a patch for multiplayer.nas that ignores the "valid" > flag > for the latest pilot that has joined. > > Please check if this solves the problem.
The conventional technique for dealing with such problems is to have three states: 00 invalid 01 incipient, i.e. usable for some purposes 10 fully_valid, i.e. usable for all purposes Initialization routines typically require incipient or fully_valid, while other routines typically insist on fully_valid. This is less risky and more maintainable than simply ignoring the valid flag. ------------------------------------------------------------------------------ Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july _______________________________________________ Flightgear-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/flightgear-devel

