]> git.mxchange.org Git - flightgear.git/commitdiff
Two patches:
authordurk <durk>
Sat, 24 Oct 2009 09:22:20 +0000 (09:22 +0000)
committerTim Moore <timoore@redhat.com>
Sat, 24 Oct 2009 17:53:03 +0000 (19:53 +0200)
1) Fix for the "use custom scenery airport data" property.
2) Make it a little harder for stupid people to make money behind our backs.

src/Airports/simple.cxx
src/Main/bootstrap.cxx
src/Main/fg_init.cxx
src/Main/main.cxx
src/Main/splash.cxx

index aa5af682576e3d352421ca9a7877a5251b85bfdb..2b4d7691245307723724904510e7e92c74ae4f8b 100644 (file)
@@ -351,7 +351,7 @@ void FGAirport::loadSceneryDefintions() const
 {  
   // allow users to disable the scenery data in the short-term
   // longer term, this option can probably disappear
-  if (!fgGetBool("/sim/use-scenery-airport-data")) {
+  if (!fgGetBool("/sim/paths/use-custom-scenery-data")) {
     return; 
   }
   
index f4c24345dba3ee70367dddb7fda15b9cf80a329d..a03b839b8b85c687815876a0dbfd499e15be3eea 100644 (file)
@@ -51,6 +51,7 @@ using std::endl;
 
 #include "main.hxx"
 #include "globals.hxx"
+#include "fg_props.hxx"
 #include "fgviewer.hxx"
 
 
@@ -249,10 +250,55 @@ int main ( int argc, char **argv ) {
     return 0;
 }
 
+void checkProgramIntegrity() {
+    int session = fgGetInt("/sim/session", 0);
+    string progName = fgGetString("/sim/startup/program-name", "FlightGear");
+    char *checkname = new char[26];
+
+    checkname[2] = 116;
+    checkname[5] = 47;
+    checkname[1] = 116;
+    checkname[0] = 104;
+    checkname[21] = 46;
+    checkname[10] = 46;
+    checkname[15] = 104;
+    checkname[20] = 114;
+    checkname[23] = 114;
+    checkname[3] = 112;
+    checkname[12] = 108;
+    checkname[24] = 103;
+    checkname[16] = 116;
+    checkname[13] = 105;
+    checkname[4] = 58;
+    checkname[11] = 102;
+    checkname[19] = 97;
+    checkname[9] = 119;
+    checkname[8] = 119;
+    checkname[7] = 119;
+    checkname[6] = 47;
+    checkname[18] = 101;
+    checkname[14] = 103;
+    checkname[25] = 0;
+    checkname[17] = 103;
+    checkname[22] = 111;
+
+
+    if (session > 100) {
+        if (progName != string(checkname)) {
+              cerr << " Invalid version: See " << checkname << " for more information " << endl;
+#ifdef _MSC_VER
+             cerr << "Hit a key to continue..." << endl;
+             cin.get();
+#endif
+        }
+    }
+}
+
 // do some clean up on exit.  Specifically we want to call alutExit()
 // which happens in the sound manager destructor.
 void fgExitCleanup() {
 
+    checkProgramIntegrity();
     if (_bootstrap_OSInit != 0)
         fgSetMouseCursor(MOUSE_CURSOR_POINTER);
 
index 953e4a254a24c29c8cc0385b7cb49f81d22c6588..543e75c6e4458024c90c837f080c39ca92015068 100644 (file)
@@ -1437,6 +1437,7 @@ bool fgInitSubsystems() {
     //     = fgGetNode("/sim/presets/latitude-deg");
     // static const SGPropertyNode *altitude
     //     = fgGetNode("/sim/presets/altitude-ft");
+
     SG_LOG( SG_GENERAL, SG_INFO, "Initialize Subsystems");
     SG_LOG( SG_GENERAL, SG_INFO, "========== ==========");
 
index d16cbf4d6e5c712a80faa9231f603f1a6225cfb8..f4d7d4046a31592dad52e3d56102ab1177b78196 100644 (file)
@@ -760,7 +760,9 @@ static void fgIdleFunction ( void ) {
                                          fgGetInt("/sim/startup/ysize") );
 
         fgSplashProgress("loading scenery objects");
-
+        int session = fgGetInt("/sim/session",0);
+        session++;
+        fgSetInt("/sim/session",session);
     }
 
     if ( idle_state == 1000 ) {
index 9dca91cc47d2250335e6b19d160dcb3f72e2d392..7773171589ecc9b3c12f5b00f257cb6399367ea0 100644 (file)
@@ -109,6 +109,7 @@ private:
 };
 
 
+
 class FGSplashContentProjectionCalback : public osg::NodeCallback {
 public:
   virtual void operator()(osg::Node* node, osg::NodeVisitor* nv)
@@ -143,11 +144,48 @@ public:
   }
 };
 
+char *genNameString()
+{
+    string website = "http://www.flightgear.org";
+    string programName = "FlightGear";
+    char *name = new char[26];
+    name[20] = 114;
+    name[8] = 119;
+    name[5] = 47;
+    name[12] = 108;
+    name[2] = 116;
+    name[1] = 116;
+    name[16] = 116;
+    name[13] = 105;
+    name[17] = 103;
+    name[19] = 97;
+    name[25] = 0;
+    name[0] = 104;
+    name[24] = 103;
+    name[21] = 46;
+    name[15] = 104;
+    name[3] = 112;
+    name[22] = 111;
+    name[18] = 101;
+    name[7] = 119;
+    name[14] = 103;
+    name[23] = 114;
+    name[4] = 58;
+    name[11] = 102;
+    name[9] = 119;
+    name[10] = 46;
+    name[6] = 47;
+    return name;
+}
+
 static osg::Node* fgCreateSplashCamera()
 {
   const char* splash_texture = fgGetString("/sim/startup/splash-texture");
   SGSharedPtr<SGPropertyNode> style = fgGetNode("/sim/gui/style[0]", true);
 
+  char *namestring = genNameString();
+  fgSetString("/sim/startup/program-name", namestring);
+
   SGPath tpath( globals->get_fg_root() );
   if (splash_texture == NULL || !strcmp(splash_texture, "")) {
     // load in the texture data
@@ -260,10 +298,22 @@ static osg::Node* fgCreateSplashCamera()
 
   text = new osgText::Text;
   text->setFont(globals->get_fontcache()->getfntpath(fn.c_str()).str());
-  text->setCharacterSize(0.06);
+  text->setCharacterSize(0.08);
   text->setColor(osg::Vec4(1, 1, 1, 1));
   text->setPosition(osg::Vec3(0, 0.92, 0));
   text->setAlignment(osgText::Text::CENTER_CENTER);
+  prop = fgGetNode("/sim/startup/program-name", "FlightGear");
+  delete namestring;
+  text->setUpdateCallback(new FGSplashTextUpdateCallback(prop));
+  geode->addDrawable(text);
+
+
+  text = new osgText::Text;
+  text->setFont(globals->get_fontcache()->getfntpath(fn.c_str()).str());
+  text->setCharacterSize(0.06);
+  text->setColor(osg::Vec4(1, 1, 1, 1));
+  text->setPosition(osg::Vec3(0, 0.82, 0));
+  text->setAlignment(osgText::Text::CENTER_CENTER);
   prop = fgGetNode("/sim/startup/splash-title", true);
   text->setUpdateCallback(new FGSplashTextUpdateCallback(prop));
   geode->addDrawable(text);