Re: [Flightgear-devel] Re: [Flightgear-users] [PATCH] classifying development status of aircraft extending fgrun

2004-10-28 Thread Erik Hofman
Boris Koenig wrote:
Well, everybody who wants to give it a try can now do so easily: I've
made a quick stab at it this morning, because I was messing around with
the corresponding files anyway.
I've committed this patch in a slightly modified form:
--min-status={alpha,beta,early-production,production}
So maturity-level has become status-level and the levels have 
changed name a bit.

Erik
___
Flightgear-devel mailing list
[EMAIL PROTECTED]
http://mail.flightgear.org/mailman/listinfo/flightgear-devel
2f585eeea02e2c79d7b1d8c4963bae2d


[Flightgear-devel] Re: [Flightgear-users] [PATCH] classifying development status of aircraft extending fgrun

2004-10-23 Thread Paul Kahler
I'm not big on XML (done HTML before) but this:
maturityalpha/maturity
doesn't seem right. I would expect something more like:
modeltag maturity=alpha   /modeltag
Where modeltag would encompase the whole model definition. Again,
I'm not really familiar with just how bloated XML is supposed to be
but if this is how you define a property of something it seems more
wasteful than I ever thought. An even more complex thing would be to
allow:
modeltag
   bunch of stuff...
  maturity = alpha
 less developed part of model 
  /maturity
/modeltag
Again, I'm no authority and I don't even know if this second thing
makes sense in this context.
Thanks,
Paul
Boris Koenig wrote:
Ampere K. Hardraade wrote:
whereas level can be anything between
pre-alpha,alpha,pre-beta,beta and done
Of course running something like
fgfs --min-maturity=alpha --show-aircraft
should not return any aircraft right now, as none of the
current aircraft definition files in your base-package is using the
required
maturity/maturity
tag - but you can easily give it a try by adding something like
maturityalpha/maturity
to abitrary aircraft ($FG_ROOT/data/Aircraft/.../*-set.xml) files.

___
Flightgear-devel mailing list
[EMAIL PROTECTED]
http://mail.flightgear.org/mailman/listinfo/flightgear-devel
2f585eeea02e2c79d7b1d8c4963bae2d


Re: [Flightgear-devel] Re: [Flightgear-users] [PATCH] classifying development status of aircraft extending fgrun

2004-10-23 Thread Boris Koenig
Paul Kahler wrote:
I'm not big on XML (done HTML before) but this:
maturityalpha/maturity
doesn't seem right. I would expect something more like:
modeltag maturity=alpha   /modeltag
You are right - and wrong, actually it doesn't matter at all,
logically you are of course somehat right, personally I would
also often use parameters where FlightGear uses separate tags,
but on the other hand it's definitely easier the way it is done
now, taking into account that an XML file is parsed recursively
to be put into FG's global property tree.
You'll notice that only very few of FlightGear's XML files really
use parameters ...
Where modeltag would encompase the whole model definition. Again,
I'm not really familiar with just how bloated XML is supposed to be
it's not XML's fault - it's just a matter of the exact implementation,
look into any of the aircraft XML files, you'll see a lot of stuff that
you'd normally expect to be a parameter of a tag rather than a separate
tag, personally I did also consider this somewhat confusing in the
beginning.

but if this is how you define a property of something it seems more
wasteful than I ever thought.
you can do it either way, XML itself doesn't care whether you store
data separately or as a parameter.
An even more complex thing would be to allow:
modeltag
   bunch of stuff...
  maturity = alpha
 less developed part of model 
  /maturity
/modeltag
Again, I'm no authority and I don't even know if this second thing
makes sense in this context.
it's a matter of convenience - and also of habits, I'd say: FG offers
the functionality to easily obtain a particular node, because that's
exactly what FG is doing all the time, while doing it the other way
would seem to make more sense, it would not be conventional in FG
terms ;-)
But again: this was just meant as a suggestion - in case that it should
be accepted to become a temporary solution for FG, I'd recommend to let
me refine it anyway - e.g. I was already told that the maturity levels
wouldn't be adequate ;-)
--
Boris
___
Flightgear-devel mailing list
[EMAIL PROTECTED]
http://mail.flightgear.org/mailman/listinfo/flightgear-devel
2f585eeea02e2c79d7b1d8c4963bae2d


[Flightgear-devel] Re: [Flightgear-users] [PATCH] classifying development status of aircraft extending fgrun

2004-10-22 Thread Boris Koenig
Ampere K. Hardraade wrote:
On October 20, 2004 10:05 pm, Boris Koenig wrote:
Personally, I'd hence still prefer getting everything and being able
to tell FlightGear what maturity level I require for all aircraft
minimally.
I'm sure your method of showing maturity of aircrafts will come in handy, but 
we *really* have to drop that download size.
Well, everybody who wants to give it a try can now do so easily: I've
made a quick stab at it this morning, because I was messing around with
the corresponding files anyway.
After applying the attached patches (based on latest CVS) you should
have a new option available within your version that should also
show up using fgfs --help, the syntax is:
fgfs --min-maturity={level} --show-aircraft
whereas level can be anything between
pre-alpha,alpha,pre-beta,beta and done
Of course running something like
fgfs --min-maturity=alpha --show-aircraft
should not return any aircraft right now, as none of the
current aircraft definition files in your base-package is using the
required
maturity/maturity
tag - but you can easily give it a try by adding something like
maturityalpha/maturity
to abitrary aircraft ($FG_ROOT/data/Aircraft/.../*-set.xml) files.
The tag should be placed as a sub-tag within sim - so directly behind
the description tag would be just fine and straight-forward.
Essentially, this is a quick hack, but actually it could already turn
out to be useful:
At least as soon as most aircraft have been classified based on their
development status - that way one could easily modify preferences.xml in
the base package to make --show-aircraft use only beta or done
aircraft by default.
Everything can still be easily overriden - using either said new option
or directly by using the property node /sim/aircraft-maturity-level
Also, I would not mind extending the whole thing a bit to provide some
more information, possibly directly within fgrund was has been discussed
before - that way one could also provide a detailed description within
the aircraft selection dialog.

-
Boris

--- preferences.xml.origFri Oct 22 09:20:52 2004
+++ preferences.xml.new Fri Oct 22 09:10:41 2004
@@ -292,6 +292,9 @@
enabled type=booltrue/enabled
!-- scenarioaircraft_demo/scenario --
   /ai
+  
+  !--to provide a default value that shows ALL aircraft regardless of development 
status--
+  aircraft-min-maturityall/aircraft-min-maturity
 
  /sim
 
--- options.cxx.origFri Oct 22 10:05:12 2004
+++ options.cxx Fri Oct 22 09:43:11 2004
@@ -1333,6 +1333,7 @@
 {nav2, true,  OPTION_FUNC,   , false, , fgOptNAV2 },
 {adf,  true,  OPTION_FUNC,   , false, , fgOptADF },
 {dme,  true,  OPTION_FUNC,   , false, , fgOptDME },
+{min-maturity, true,  OPTION_STRING,  
/sim/aircraft-min-maturity, false, all, 0 },
 {0}
 };
 
@@ -1683,9 +1684,29 @@
 #endif
 }
 
+//CHANGED: a simple function to return an integer depending on the position
+//of the maturity string within the array in order to determine the hierarchy.
+unsigned int getNumMaturity(const char * str) 
+{
+//a simple char array to hold supported maturity levels (vectors would be overkill) 
;-)
+//changes should also be reflected in $FG_ROOT/data/options.xml  
+//$FG_ROOT/data/Translations/string-default.xml
+
+const char   levels[6][10]= {  pre-alpha,alpha,pre-beta,beta,done,0}; 
+
+
+for (int i=0; i(sizeof(levels)/sizeof(levels[0])-1);i++) 
+   if (strcmp(str,levels[i])==0)
+   return i;
+
+return 0;
+};
+
+
 static void fgSearchAircraft(const SGPath path, string_list aircraft,
  bool recursive)
-{
+{   
+   
ulDirEnt* dire;
ulDir *dirp = ulOpenDir(path.str().c_str());
if (dirp == NULL) {
@@ -1720,28 +1741,60 @@
   }
 
   SGPropertyNode *desc = NULL;
+ //allow for specification of an additional maturity tag within the xml file
+ SGPropertyNode *maturity = NULL;
+ 
   SGPropertyNode *node = root.getNode(sim);
   if (node) {
  desc = node-getNode(description);
+// if a maturity tag is found, read it in
+if (node-hasValue(maturity))
+   maturity = node-getNode(maturity);
   }
 
   char cstr[96];
+ //additionally display maturity information where it is available
+ char maturity_level[12]=;
+ strcpy(maturity_level,(maturity) ? maturity-getStringValue() :  );
+ 
   if (strlen(dire-d_name) = 27) {
- snprintf(cstr, 96,%-27s  %s, dire-d_name,
-  (desc) ? desc-getStringValue() :  );
+ snprintf(cstr, 96,%-27s  %s %s, dire-d_name,
+  (desc) ? desc-getStringValue() : ,
+  maturity_level );
 
   } else {
- snprintf(cstr, 96,%-27s\n%32c%s, dire-d_name, ' ',
-  

Re: [Flightgear-devel] Re: [Flightgear-users] [PATCH] classifying development status of aircraft extending fgrun

2004-10-22 Thread Boris Koenig
Oops, I forgot to add the patch for options.xml
--
Boris
--- options.xml.origFri Oct 22 10:01:51 2004
+++ ../options.xml  Fri Oct 22 08:50:27 2004
@@ -420,6 +420,42 @@
/option
 
option
+   !--in order to allow users to specify a minimum development status for aircraft,
+   this option requires the aircraft *-set.xml files to contain one additional tag
+   within the sim tag:
+   
+
+   maturity/maturity
+   
+   it should hold any of the following status strings: (may be subject to change)
+   
+   pre-alpha   - for all pre-alpha version aircraft
+   alpha   - for all alpha version aircraft
+   pre-beta- for all pre-beta version aircraft
+   beta- for all beta version aircraft
+   done- for all aircraft that are (relatively) 'done'
+
+   ('all' is also supported, but simply bypasses the new stuff)
+   
+Aircraft definition files that don't contain a corresponding maturity tag will
+still be dealt normally with, however they are not going to show up if the user
+provides a minimally required maturity level, the same applies for mis-spelt or 
otherwise
+unsupported maturity levels.
+
+The revamped  fgSearchAircraft() function in $FG_SRC/Main/options.cxx will now by 
default
+look for a value within the property tree (/sim/aircraft-min-maturity) - this 
node will hold
+the value that's provided via --min-maturity=level, in order to be able to rely 
on a standard
+value for this node, it will by default be set to all, so that 
fgSearchAircraft() can still 
+easily deal with conventional aircraft definition files that do not contain the 
new tag.
+   
+--
+namemin-maturity/name
+arg{pre-alpha,alpha,pre-beta,beta,done}/arg
+descriptionstrings/min-aircraft-maturity/description
+brief/
+   /option
+
+   option
 namefdm/name
 argname/arg
 descriptionstrings/fdm-desc/description
___
Flightgear-devel mailing list
[EMAIL PROTECTED]
http://mail.flightgear.org/mailman/listinfo/flightgear-devel
2f585eeea02e2c79d7b1d8c4963bae2d