[Flightgear-devel] New Feature -- selective model loading on Multiplayer [patch]

2011-12-10 Thread Dan DeGraw
I did a little tweaking to the multiplayer code to allow you to use a
startup option "--ai-gliders-only" to, by default, load all other
players as the default-model. I accomplish that by inserting some
garbage directory in front of the model path, that way the model loading
functions just treats it as a missing file and loads the default glider
model. Nothing elaborate had to be done, and the MP Pilot list shows the
correct model name but all in orange. I've added a 2nd checkbox next to
ignore to select if you want to load that players actual model. If you
dont have it nothing changes. I was thinking about making the inverse,
of without specifying the startup option, everyones checkbox is marked
already, and then you can selectively unload.. however I dont think FG
truly frees up any memory at this time as a result, but maybe I'm wrong.
Basically it was just to let me and others be able to fly in populated
areas, still see each other, and not have our computers meltdown from
loading 14 different jumbo jets.

A patch for FG, and a replacement for fgdata/Nasal/multiplayer.nas is
attached.

--Dan
diff --git src/AIModel/AIBase.hxx src/AIModel/AIBase.hxx
index f09a96e..a3c96b9 100644
--- src/AIModel/AIBase.hxx
+++ src/AIModel/AIBase.hxx
@@ -323,7 +323,7 @@ inline void FGAIBase::setManager(FGAIManager* mgr, SGPropertyNode* p) {
 }
 
 inline void FGAIBase::setPath(const char* model ) {
-model_path.append(model);
+model_path.assign(model);
 }
 
 inline void FGAIBase::setSMPath(const string& p) {
diff --git src/AIModel/AIMultiplayer.cxx src/AIModel/AIMultiplayer.cxx
index caa45ce..b81d0e4 100644
--- src/AIModel/AIMultiplayer.cxx
+++ src/AIModel/AIMultiplayer.cxx
@@ -64,6 +64,8 @@ bool FGAIMultiplayer::init(bool search_in_AI_path) {
 //	   cout << "isTanker " << isTanker << " " << mCallSign tie("sim/model/show",
+SGRawValuePointer(&RealModel));
+
 #define AIMPROProp(type, name) \
 SGRawValueMethods(*this, &FGAIMultiplayer::get##name)
 
@@ -108,6 +113,7 @@ void FGAIMultiplayer::unbind() {
 props->untie("controls/invisible");
 props->untie("refuel/contact");
 props->untie("tanker");
+props->untie("sim/model/show");
 
 }
 
diff --git src/AIModel/AIMultiplayer.hxx src/AIModel/AIMultiplayer.hxx
index 4c8d50a..6d0772c 100644
--- src/AIModel/AIMultiplayer.hxx
+++ src/AIModel/AIMultiplayer.hxx
@@ -64,6 +64,8 @@ public:
 
   virtual const char* getTypeString(void) const { return "multiplayer"; }
 
+  bool getRealModel(void) { return RealModel; }
+  void setRealModel(bool val) { RealModel = val; }
 private:
 
   // Automatic sorting of motion data according to its timestamp
@@ -90,6 +92,9 @@ private:
   SGPropertyNode_ptr refuel_node;
   bool isTanker;
   bool contact;  // set if this tanker is within fuelling range
+
+  // Show glider or players real model
+  bool RealModel;
 };
 
 #endif  // _FG_AIMultiplayer_HXX
diff --git src/Main/options.cxx src/Main/options.cxx
index 00624af..bc56ece 100644
--- src/Main/options.cxx
+++ src/Main/options.cxx
@@ -1355,6 +1355,7 @@ struct OptionDesc {
 {"metar",true,  OPTION_STRING, "/environment/metar/data", false, "", 0 },
 {"disable-ai-models",false, OPTION_BOOL,   "/sim/ai/enabled", false, "", 0 },
 {"enable-ai-models", false, OPTION_BOOL,   "/sim/ai/enabled", true, "", 0 },
+{"ai-gliders-only",  false, OPTION_BOOL,   "/sim/ai/gliders-only", true, "", 0 },
 {"disable-ai-traffic",   false, OPTION_BOOL,   "/sim/traffic-manager/enabled", false, "", 0 },
 {"enable-ai-traffic",false, OPTION_BOOL,   "/sim/traffic-manager/enabled", true,  "", 0 },
 {"disable-freeze",   false, OPTION_BOOL,   "/sim/freeze/master", false, "", 0 },
diff --git src/MultiPlayer/multiplaymgr.cxx src/MultiPlayer/multiplaymgr.cxx
index 123317c..3e5ff17 100644
--- src/MultiPlayer/multiplaymgr.cxx
+++ src/MultiPlayer/multiplaymgr.cxx
@@ -1097,7 +1097,48 @@ FGMultiplayMgr::ProcessPosMsg(const FGMultiplayMgr::MsgBuf& Msg,
 << "Position message received with insufficient data" );
 return;
   }
+
+  FGAIMultiplayer* mp = getMultiplayer(MsgHdr->Callsign);
   const T_PositionMsg* PosMsg = Msg.posMsg();
+
+  // Gliders only, check if we should reload model
+  SGPropertyNode *g = fgGetNode("/sim/ai/gliders-only", true);
+  if(g->getBoolValue() == true) {
+ if(mp) {
+if((mp->getRealModel() == true) && (strncmp(mp->_getPath(),
+"dnl/", 4) == 0)) {
+MultiPlayerMap::iterator it = mMultiPlayerMap.begin();
+while(it != mMultiPlayerMap.end()) {
+if(strcmp(it->second->_getCallsign(), MsgHdr->Callsign) == 0) {
+std::string name = it->first;
+it->second->setDie(true);
+it->second->update(0.

Re: [Flightgear-devel] apt.dat update (lowercase names etc.)

2011-12-10 Thread HB-GRAL
Am 11.12.11 01:10, schrieb James J. Brennan:
>
>>   Sure they are marked in some charts as they might be useful in an
>> emergency, but essentially they are not much different from a large
>> parking lot or a wide road.
>
> One came in pretty handy a few years ago when a guy ran out of gas.
> Something about "the glimly glider" (sp?)
>
>
> jj
>

I am running out of gas too somehow. Today I visited KUCA and got a 
chance to speak to my ancestors thanks to this lines in apt.dat I think:

50 11870 ATIS
51 11810 CTAF
51 12295 UNICOM
52 12190 CLNC DEL
53 12190 GND
54 11810 UTICA TWR
55 12092 GRIFFISS APP/DEP

My script marks this airport as "closed" but I am sure heared some voices.

Cheers, Yves

--
Learn Windows Azure Live!  Tuesday, Dec 13, 2011
Microsoft is holding a special Learn Windows Azure training event for 
developers. It will provide a great way to learn Windows Azure and what it 
provides. You can attend the event by watching it streamed LIVE online.  
Learn more at http://p.sf.net/sfu/ms-windowsazure
___
Flightgear-devel mailing list
Flightgear-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/flightgear-devel


Re: [Flightgear-devel] apt.dat update (lowercase names etc.)

2011-12-10 Thread James J. Brennan

>  Sure they are marked in some charts as they might be useful in an
> emergency, but essentially they are not much different from a large
> parking lot or a wide road. 

One came in pretty handy a few years ago when a guy ran out of gas.
Something about "the glimly glider" (sp?) 


jj


--
Learn Windows Azure Live!  Tuesday, Dec 13, 2011
Microsoft is holding a special Learn Windows Azure training event for 
developers. It will provide a great way to learn Windows Azure and what it 
provides. You can attend the event by watching it streamed LIVE online.  
Learn more at http://p.sf.net/sfu/ms-windowsazure
___
Flightgear-devel mailing list
Flightgear-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/flightgear-devel


Re: [Flightgear-devel] Aircraft maintenance

2011-12-10 Thread Durk Talsma
Hi All, 

Just following up on Thorsten's email regarding aircraft maintenance, this 
might be a good opportunity to mention that in the last few weeks I've been 
compiling a set of ideas with respect to the continuation of the aircraft split 
plan. Note that this plan evolved from ideas that were formulated during our 
FSWeekend meeting, and as such reflect a common effort by everybody involved in 
running the booth (Martin, Torsten, Gijs, Jorg, and Thorsten B in particular). 


The ideas and the tentative plan can be found in the wiki, so I will not 
reiterate the entire plan here:
http://wiki.flightgear.org/FlightGear_Git:_splitting_fgdata

I would like to mention that the plan also provides a contingency for necessary 
aircraft maintenance, in case of changes to the flightgear core code. It might 
be worth while to discuss this in the context of the current problems that have 
surfaced with regard to the stereo sound files, and how to deal with them. 

Cheers,
Durk


--
Learn Windows Azure Live!  Tuesday, Dec 13, 2011
Microsoft is holding a special Learn Windows Azure training event for 
developers. It will provide a great way to learn Windows Azure and what it 
provides. You can attend the event by watching it streamed LIVE online.  
Learn more at http://p.sf.net/sfu/ms-windowsazure
___
Flightgear-devel mailing list
Flightgear-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/flightgear-devel


Re: [Flightgear-devel] apt.dat update (lowercase names etc.)

2011-12-10 Thread Vivian Meazza
Yves

> -Original Message-
> From: HB-GRAL [mailto:flightg...@sablonier.ch]
> Sent: 10 December 2011 10:25
> To: FlightGear developers discussions
> Subject: Re: [Flightgear-devel] apt.dat update (lowercase names etc.)
> 
> Am 10.12.11 07:52, schrieb Tuomas Kuosmanen:
> > Wouldn't it be useful to somehow flag the airport as
> > closed/restricted/whatever in the data, so that nav displays and gps/fms
> > units could show a different airfield symbol if desired for closed
> > airports? Does the data format support this?
> 
> There is one "field" left in apt.dat airport line which is deprecated.
> This would be the only possibility to set a flag (0=open, 1=closed ?),
> but I think with this flag set FG apt.dat is not compatible anymore with
> original xplane data.
> 
> I guess some "external" apt.dat readers around use the [X] somehow ?
> 
> (Remark: What I wrote about FAA and "Cl" is wrong, there are three
> states in US data: CI - closed indefinitely; CP - closed permanently; O
> - operational, so closed in apt.dat should mean "CP" I think.)
> 

I think the difference between CI and CP is too subtle to matter to us. If
we only have a binary value then we should think O = 1, 'not O' = 0 where
'not O' = CI or CP.

If we can have a ternary value then O = nil or undefined, CI = 0 and CP = 1
Works for me anyway.

Vivian





--
Learn Windows Azure Live!  Tuesday, Dec 13, 2011
Microsoft is holding a special Learn Windows Azure training event for 
developers. It will provide a great way to learn Windows Azure and what it 
provides. You can attend the event by watching it streamed LIVE online.  
Learn more at http://p.sf.net/sfu/ms-windowsazure
___
Flightgear-devel mailing list
Flightgear-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/flightgear-devel


Re: [Flightgear-devel] apt.dat update (lowercase names etc.)

2011-12-10 Thread Tuomas Kuosmanen
NOTAM has usually a time of validity, so permanent/long term changes
usually end up as an "AIP supplement" which have a longer lifespan.


Closed runways have a big white X on both ends of the runway (I guess if it
is closed both ways? ;))


One more thought: Should completely closed airports be part of apt.dat at
all? They are no longer a part of the air transport system. There is no
guarantee at all that they are suitable for landing or takeoff. Sure they
are marked in some charts as they might be useful in an emergency, but
essentially they are not much different from a large parking lot or a wide
road.


//Tuomas


--

On 10.12.2011 12:23 Erik Hofman wrote:
On Sat, 2011-12-10 at 11:14 +0100, HB-GRAL wrote:
> The airports marked as "closed" are closed at all, no service. And for
> temporary closed runways you will need NOTAM I think, or not?

I don't think NOTAMS are good enough for permanently closed runways.

Erik


--
Learn Windows Azure Live!  Tuesday, Dec 13, 2011
Microsoft is holding a special Learn Windows Azure training event for
developers. It will provide a great way to learn Windows Azure and what it
provides. You can attend the event by watching it streamed LIVE online.
Learn more at http://p.sf.net/sfu/ms-windowsazure
___
Flightgear-devel mailing list
Flightgear-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/flightgear-devel
--
Learn Windows Azure Live!  Tuesday, Dec 13, 2011
Microsoft is holding a special Learn Windows Azure training event for 
developers. It will provide a great way to learn Windows Azure and what it 
provides. You can attend the event by watching it streamed LIVE online.  
Learn more at http://p.sf.net/sfu/ms-windowsazure___
Flightgear-devel mailing list
Flightgear-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/flightgear-devel


[Flightgear-devel] Aircraft maintenance

2011-12-10 Thread ThorstenB
Following up on the sound file maintenance discussion, I have created a 
Wiki page to collect information on aircraft maintenance. This is 
somehow connected to our FG release change log, however it also contains 
other issues: things that were detected/reported and should be 
adapted/fixed for aircraft. The idea is that this can be extended when 
we notice something that aircraft developers should consider. And it 
should be something that covers more than one FG release - since things 
aren't usually adapted so fast.

http://wiki.flightgear.org/Aircraft_maintenance

Maybe this is too organized, maybe this is an effort in vain. And maybe 
this is "teaching pigs how to fly" - but this is FlightGear, we already 
have a

* flying Ogel, http://wiki.flightgear.org/Ogel
* flying Santa, http://wiki.flightgear.org/Santa
* flying Dutchman, http://goo.gl/Fgn8w
* flying paper plane, http://wiki.flightgear.org/Paper_airplane
* flying UFO, of course, http://wiki.flightgear.org/Ufo
* even a Scottish Navaid System soon, http://goo.gl/m6X0W

All sounds impossible, but apparently almost everything is possible with 
FlightGear. So maybe this helps a bit after all. And maybe we'll even 
have a flying FlightGear pig one day (anyone?)...

cheers,
Thorsten




--
Learn Windows Azure Live!  Tuesday, Dec 13, 2011
Microsoft is holding a special Learn Windows Azure training event for 
developers. It will provide a great way to learn Windows Azure and what it 
provides. You can attend the event by watching it streamed LIVE online.  
Learn more at http://p.sf.net/sfu/ms-windowsazure
___
Flightgear-devel mailing list
Flightgear-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/flightgear-devel


Re: [Flightgear-devel] apt.dat update (lowercase names etc.)

2011-12-10 Thread HB-GRAL
Am 10.12.11 07:52, schrieb Tuomas Kuosmanen:
> Wouldn't it be useful to somehow flag the airport as
> closed/restricted/whatever in the data, so that nav displays and gps/fms
> units could show a different airfield symbol if desired for closed
> airports? Does the data format support this?

There is one "field" left in apt.dat airport line which is deprecated. 
This would be the only possibility to set a flag (0=open, 1=closed ?), 
but I think with this flag set FG apt.dat is not compatible anymore with 
original xplane data.

I guess some "external" apt.dat readers around use the [X] somehow ?

(Remark: What I wrote about FAA and "Cl" is wrong, there are three 
states in US data: CI - closed indefinitely; CP - closed permanently; O 
- operational, so closed in apt.dat should mean "CP" I think.)

Cheers, Yves

--
Learn Windows Azure Live!  Tuesday, Dec 13, 2011
Microsoft is holding a special Learn Windows Azure training event for 
developers. It will provide a great way to learn Windows Azure and what it 
provides. You can attend the event by watching it streamed LIVE online.  
Learn more at http://p.sf.net/sfu/ms-windowsazure
___
Flightgear-devel mailing list
Flightgear-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/flightgear-devel


Re: [Flightgear-devel] apt.dat update (lowercase names etc.)

2011-12-10 Thread Erik Hofman
On Sat, 2011-12-10 at 11:14 +0100, HB-GRAL wrote:
> The airports marked as "closed" are closed at all, no service. And for 
> temporary closed runways you will need NOTAM I think, or not?

I don't think NOTAMS are good enough for permanently closed runways.

Erik


--
Learn Windows Azure Live!  Tuesday, Dec 13, 2011
Microsoft is holding a special Learn Windows Azure training event for 
developers. It will provide a great way to learn Windows Azure and what it 
provides. You can attend the event by watching it streamed LIVE online.  
Learn more at http://p.sf.net/sfu/ms-windowsazure
___
Flightgear-devel mailing list
Flightgear-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/flightgear-devel


Re: [Flightgear-devel] apt.dat update (lowercase names etc.)

2011-12-10 Thread HB-GRAL
Am 10.12.11 10:29, schrieb Erik Hofman:
> On Sat, 2011-12-10 at 00:49 +0100, HB-GRAL wrote:
>> Am 08.12.11 13:36, schrieb HB-GRAL:
>>> Hi all
>>
>> Hi again
>>
>> About marking "closed" airports in apt.dat:
>>
>> - marking the name with "[X] " might be closer to charts I guess and
>> most airports marked as closed in apt.dat comes with the x
>> - removing x and marking with "(closed)" at end of name is possible in
>> most cases without having<  40 chars, but this is some kind of "new
>> convention" ?
>> - FAA marks closed airports with "Cl"
>>
>> What do you prefer for the apt.dat names ?
>
> It might be (but that's just a hunch) that [X] marks only closed runways
> but not specifically closed airports?
>
> Erik


The airports marked as "closed" are closed at all, no service. And for 
temporary closed runways you will need NOTAM I think, or not?

Cheers, Yves

--
Learn Windows Azure Live!  Tuesday, Dec 13, 2011
Microsoft is holding a special Learn Windows Azure training event for 
developers. It will provide a great way to learn Windows Azure and what it 
provides. You can attend the event by watching it streamed LIVE online.  
Learn more at http://p.sf.net/sfu/ms-windowsazure
___
Flightgear-devel mailing list
Flightgear-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/flightgear-devel


Re: [Flightgear-devel] apt.dat update (lowercase names etc.)

2011-12-10 Thread Erik Hofman
On Sat, 2011-12-10 at 00:49 +0100, HB-GRAL wrote:
> Am 08.12.11 13:36, schrieb HB-GRAL:
> > Hi all
> 
> Hi again
> 
> About marking "closed" airports in apt.dat:
> 
> - marking the name with "[X] " might be closer to charts I guess and 
> most airports marked as closed in apt.dat comes with the x
> - removing x and marking with "(closed)" at end of name is possible in 
> most cases without having < 40 chars, but this is some kind of "new 
> convention" ?
> - FAA marks closed airports with "Cl"
> 
> What do you prefer for the apt.dat names ?

It might be (but that's just a hunch) that [X] marks only closed runways
but not specifically closed airports?

Erik


--
Learn Windows Azure Live!  Tuesday, Dec 13, 2011
Microsoft is holding a special Learn Windows Azure training event for 
developers. It will provide a great way to learn Windows Azure and what it 
provides. You can attend the event by watching it streamed LIVE online.  
Learn more at http://p.sf.net/sfu/ms-windowsazure
___
Flightgear-devel mailing list
Flightgear-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/flightgear-devel


Re: [Flightgear-devel] Stereo sound files and affected aircraft

2011-12-10 Thread Erik Hofman
On Fri, 2011-12-09 at 22:48 +, Martin Spott wrote:
> Erik Hofman wrote:
> 
> > There already is, fgdata/Sounds
> > If more than 4 aircraft use the same file I'd say put them there
> > instead.
> 
> Coordinating aircraft development   errm, teaching pigs how to
> fly !?  ;-)

I have to try once in a while, but that might just be me :)

Erik


--
Learn Windows Azure Live!  Tuesday, Dec 13, 2011
Microsoft is holding a special Learn Windows Azure training event for 
developers. It will provide a great way to learn Windows Azure and what it 
provides. You can attend the event by watching it streamed LIVE online.  
Learn more at http://p.sf.net/sfu/ms-windowsazure
___
Flightgear-devel mailing list
Flightgear-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/flightgear-devel