Re: [Flightgear-devel] pilot list error

2009-09-13 Thread Stuart Buchanan
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.
 
 Torsten

Thanks for working this out Torsten. I suspected that the problem was related
to the valid property, but didn't manage to get to the bottom of it.

Is there any mileage in only setting the model-added property in the 
AIManager::attach() function
after mode_init() is complete?

-Stuart (been away for two weeks so only just catching up on developments)



  


--
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
Flightgear-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/flightgear-devel


Re: [Flightgear-devel] pilot list error

2009-09-06 Thread syd adams
Last test shows correct amount of players , pilot list good , model view
good , but now apparently when someone leaves and valid becomes false , they
remain on the pilot list / model view for a short time , though no 3d model
is visible in the model view.
But I need sleep , have to look at it tomorrow.
Cheers

On Sat, Sep 5, 2009 at 10:44 PM, syd adams adams@gmail.com wrote:

 Changing line 275 in multiplayer.nas to

 distance-to-km: distance / 1000.0 or 0,

 appears to get things running again.



--
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
Flightgear-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/flightgear-devel


Re: [Flightgear-devel] pilot list error

2009-09-05 Thread Torsten Dreyer
 As I mentioned before , I've been looking for the missing player in the
 pilot list and model view.
 If I comment out the 2 lines below foreach  , in multiplayer.nas at line
 374 ...

 foreach (var n; props.globals.getNode(ai/models,
 1).getChildren(multiplayer)) {
 #if (!n.getNode(valid, 1).getValue())
 #   continue;

 ... I then get the correct num-players  in /ai/models, and I can now step
 through ALL the players in model view ,
 and they all appear in the pilot list.
 I don't consider this a fix since I dont know why the above lines would
 cause a problem,but it's a start.
 Cheers
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.

Torsten

--
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
Flightgear-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/flightgear-devel


Re: [Flightgear-devel] pilot list error

2009-09-05 Thread John Denker
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
Flightgear-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/flightgear-devel


Re: [Flightgear-devel] pilot list error

2009-09-05 Thread syd adams
Thanks for looking into it.Torsten , just got home from a soggy camping trip
, so I can
dry out and test your changes :)
cheers

On Sat, Sep 5, 2009 at 1:22 PM, Torsten Dreyer tors...@t3r.de wrote:

  As I mentioned before , I've been looking for the missing player in the
  pilot list and model view.
  If I comment out the 2 lines below foreach  , in multiplayer.nas at
 line
  374 ...
 
  foreach (var n; props.globals.getNode(ai/models,
  1).getChildren(multiplayer)) {
  #if (!n.getNode(valid, 1).getValue())
  #   continue;
 
  ... I then get the correct num-players  in /ai/models, and I can now
 step
  through ALL the players in model view ,
  and they all appear in the pilot list.
  I don't consider this a fix since I dont know why the above lines would
  cause a problem,but it's a start.
  Cheers
 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.

 Torsten


 --
 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
 Flightgear-devel@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/flightgear-devel

--
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
Flightgear-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/flightgear-devel


Re: [Flightgear-devel] pilot list error

2009-09-05 Thread syd adams
After the first test I'm getting ...

Nasal runtime error: nil used in numeric context
  at /home/syd/FGFS/data/Nasal/multiplayer.nas, line 275

which of coarse causes the pilot list to not appear. Will
continue testing .
--
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
Flightgear-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/flightgear-devel


Re: [Flightgear-devel] pilot list error

2009-09-05 Thread syd adams
Changing line 275 in multiplayer.nas to

distance-to-km: distance / 1000.0 or 0,

appears to get things running again.
--
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
Flightgear-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/flightgear-devel


[Flightgear-devel] pilot list error

2009-09-02 Thread syd adams
As I mentioned before , I've been looking for the missing player in the
pilot list and model view.
If I comment out the 2 lines below foreach  , in multiplayer.nas at line
374 ...

foreach (var n; props.globals.getNode(ai/models,
1).getChildren(multiplayer)) {
#if (!n.getNode(valid, 1).getValue())
#   continue;

... I then get the correct num-players  in /ai/models, and I can now step
through ALL the players in model view ,
and they all appear in the pilot list.
I don't consider this a fix since I dont know why the above lines would
cause a problem,but it's a start.
Cheers
--
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
Flightgear-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/flightgear-devel