From 904a99714e1f1c11d5175e42f692df981bc6625c Mon Sep 17 00:00:00 2001 From: durk Date: Sat, 24 Oct 2009 09:22:20 +0000 Subject: [PATCH 1/4] Two patches: 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 | 2 +- src/Main/bootstrap.cxx | 46 ++++++++++++++++++++++++++++++++++++ src/Main/fg_init.cxx | 1 + src/Main/main.cxx | 4 +++- src/Main/splash.cxx | 52 ++++++++++++++++++++++++++++++++++++++++- 5 files changed, 102 insertions(+), 3 deletions(-) diff --git a/src/Airports/simple.cxx b/src/Airports/simple.cxx index aa5af6825..2b4d76912 100644 --- a/src/Airports/simple.cxx +++ b/src/Airports/simple.cxx @@ -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; } diff --git a/src/Main/bootstrap.cxx b/src/Main/bootstrap.cxx index f4c24345d..a03b839b8 100644 --- a/src/Main/bootstrap.cxx +++ b/src/Main/bootstrap.cxx @@ -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); diff --git a/src/Main/fg_init.cxx b/src/Main/fg_init.cxx index 953e4a254..543e75c6e 100644 --- a/src/Main/fg_init.cxx +++ b/src/Main/fg_init.cxx @@ -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, "========== =========="); diff --git a/src/Main/main.cxx b/src/Main/main.cxx index d16cbf4d6..f4d7d4046 100644 --- a/src/Main/main.cxx +++ b/src/Main/main.cxx @@ -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 ) { diff --git a/src/Main/splash.cxx b/src/Main/splash.cxx index 9dca91cc4..777317158 100644 --- a/src/Main/splash.cxx +++ b/src/Main/splash.cxx @@ -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 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); From c563cd034a164dbf0e2a12ab215d09e73608b522 Mon Sep 17 00:00:00 2001 From: Tim Moore Date: Sat, 24 Oct 2009 22:49:18 +0200 Subject: [PATCH 2/4] delete char array with delete[] --- src/Main/splash.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Main/splash.cxx b/src/Main/splash.cxx index 777317158..403617891 100644 --- a/src/Main/splash.cxx +++ b/src/Main/splash.cxx @@ -185,6 +185,7 @@ static osg::Node* fgCreateSplashCamera() char *namestring = genNameString(); fgSetString("/sim/startup/program-name", namestring); + delete[] namestring; SGPath tpath( globals->get_fg_root() ); if (splash_texture == NULL || !strcmp(splash_texture, "")) { @@ -303,7 +304,6 @@ static osg::Node* fgCreateSplashCamera() 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); From b4eb30a6c592ee75b52f4eb4ca8143cefcb06117 Mon Sep 17 00:00:00 2001 From: durk Date: Sun, 25 Oct 2009 20:09:20 +0000 Subject: [PATCH 3/4] Revoke url change detection code. --- src/Main/bootstrap.cxx | 45 ------------------------------------------ 1 file changed, 45 deletions(-) diff --git a/src/Main/bootstrap.cxx b/src/Main/bootstrap.cxx index a03b839b8..6b4f08569 100644 --- a/src/Main/bootstrap.cxx +++ b/src/Main/bootstrap.cxx @@ -250,55 +250,10 @@ 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); From 61d8aa5bde4e0a3937dcb1ed304168bf01030ef9 Mon Sep 17 00:00:00 2001 From: ehofman Date: Mon, 26 Oct 2009 09:46:05 +0000 Subject: [PATCH 4/4] Adjust fog color. --- src/Time/light.cxx | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/Time/light.cxx b/src/Time/light.cxx index c1d204ac3..20cf3daf8 100644 --- a/src/Time/light.cxx +++ b/src/Time/light.cxx @@ -170,10 +170,10 @@ void FGLight::unbind () { prop->untie("/rendering/dome/sun/red"); prop->untie("/rendering/dome/sun/green"); prop->untie("/rendering/dome/sun/blue"); - prop->untie("/rendering/dome/skyred"); + prop->untie("/rendering/dome/sky/red"); prop->untie("/rendering/dome/sky/green"); prop->untie("/rendering/dome/sky/blue"); - prop->untie("/rendering/dome/fogred"); + prop->untie("/rendering/dome/fog/red"); prop->untie("/rendering/dome/fog/green"); prop->untie("/rendering/dome/fog/blue"); } @@ -200,7 +200,7 @@ void FGLight::update_sky_color () { // if the 4th field is 0.0, this specifies a direction ... // const GLfloat white[4] = { 1.0, 1.0, 1.0, 1.0 }; const GLfloat base_sky_color[4] = { 0.31, 0.43, 0.69, 1.0 }; - const GLfloat base_fog_color[4] = { 0.84, 0.87, 1.0, 1.0 }; + const GLfloat base_fog_color[4] = { 0.60, 0.70, 0.9, 1.0 }; SG_LOG( SG_EVENT, SG_DEBUG, "Updating light parameters." ); @@ -330,9 +330,9 @@ void FGLight::update_adj_fog_color () { // Calculate the fog color in the direction of the sun for // sunrise/sunset effects. // - float s_red = color[0]*color[0]; - float s_green = color[1]*color[1]; - float s_blue = color[2]; + float s_red = color[0]*color[0]*color[0]; + float s_green = color[1]*color[1]*color[1]; + float s_blue = color[2]*color[2]; // interpolate beween the sunrise/sunset color and the color // at the opposite direction of this effect. Take in account