1
0
Fork 0

Erik Hofman:

This patch fixes some bugs for correctly reporting un-updated
configuration files, and adds support for a --language=<code>
commandline option, overriding the language specified by the OS.
This commit is contained in:
curt 2002-10-04 15:19:07 +00:00
parent 29eb5f7f5d
commit 5cf14e78c4
2 changed files with 55 additions and 17 deletions

View file

@ -477,6 +477,15 @@ void fgRenderFrame() {
glEnable(GL_DEPTH_TEST); glEnable(GL_DEPTH_TEST);
glEnable(GL_BLEND); glEnable(GL_BLEND);
glBlendFunc( GL_ONE, GL_ONE_MINUS_SRC_ALPHA ) ; glBlendFunc( GL_ONE, GL_ONE_MINUS_SRC_ALPHA ) ;
/*
glEnable( GL_TEXTURE_2D );
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
*/
if ( _bcloud_orig ) { if ( _bcloud_orig ) {
Point3D c = globals->get_scenery()->get_center(); Point3D c = globals->get_scenery()->get_center();
sgClouds3d->Set_Cloud_Orig( &c ); sgClouds3d->Set_Cloud_Orig( &c );
@ -778,6 +787,19 @@ void fgRenderFrame() {
glDisable( GL_FOG ); glDisable( GL_FOG );
glDisable( GL_LIGHTING ); glDisable( GL_LIGHTING );
// cout << "drawing new clouds" << endl; // cout << "drawing new clouds" << endl;
glEnable(GL_DEPTH_TEST);
glEnable(GL_BLEND);
glBlendFunc( GL_ONE, GL_ONE_MINUS_SRC_ALPHA ) ;
/*
glEnable( GL_TEXTURE_2D );
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
*/
sgClouds3d->Draw((sgVec4 *)current__view->get_VIEW()); sgClouds3d->Draw((sgVec4 *)current__view->get_VIEW());
glEnable( GL_FOG ); glEnable( GL_FOG );
glEnable( GL_LIGHTING ); glEnable( GL_LIGHTING );
@ -1449,23 +1471,19 @@ int fgGlutInitEvents( void ) {
} }
// Initialize the localization // Initialize the localization
SGPropertyNode *fgInitLocale() { SGPropertyNode *fgInitLocale(const char *language) {
SGPropertyNode *c_node = NULL, *d_node = NULL; SGPropertyNode *c_node = NULL, *d_node = NULL;
SGPropertyNode *intl = fgGetNode("/sim/intl");
// SG_LOG(SG_GENERAL, SG_INFO, "Selected language: " << language );
// Detect the current language
//
char *language = getenv("LANG");
if (language == NULL) {
SG_LOG(SG_GENERAL, SG_ALERT, "Unable to detect the current language" );
language = "C";
}
SGPropertyNode *intl = fgGetNode("/sim/intl", "");
// localization not defined
if (!intl) if (!intl)
return NULL; return NULL;
//
// Select the proper language from the list
//
vector<SGPropertyNode_ptr> locale = intl->getChildren("locale"); vector<SGPropertyNode_ptr> locale = intl->getChildren("locale");
for (unsigned int i = 0; i < locale.size(); i++) { for (unsigned int i = 0; i < locale.size(); i++) {
@ -1479,6 +1497,9 @@ SGPropertyNode *fgInitLocale() {
} }
} }
// No <locale> tags defined
if (!c_node)
return NULL;
// //
// Load the default strings // Load the default strings
@ -1608,12 +1629,24 @@ int mainLoop( int argc, char **argv ) {
} }
// Initialize the localization routines // Initialize the localization routines
SGPropertyNode *locale = fgInitLocale(); if (globals->get_locale() == NULL) {
if (!locale) char *language = getenv("LANG");
return false; if (language == NULL) {
SG_LOG(SG_GENERAL, SG_ALERT, "Unable to detect the language" );
language = "C";
}
globals->set_locale( locale ); SGPropertyNode *locale = fgInitLocale(language);
if (!locale) {
cerr
<< "Not internationalization settings specified in preferences.xml"
<< endl;
return false;
}
globals->set_locale( locale );
}
// Initialize the Window/Graphics environment. // Initialize the Window/Graphics environment.
if( !fgGlutInit(&argc, argv) ) { if( !fgGlutInit(&argc, argv) ) {

View file

@ -60,6 +60,9 @@
#include "options.hxx" #include "options.hxx"
#include "viewmgr.hxx" #include "viewmgr.hxx"
// Hack: from main.cxx
extern SGPropertyNode *fgInitLocale(const char *);
SG_USING_STD(string); SG_USING_STD(string);
SG_USING_NAMESPACE(std); SG_USING_NAMESPACE(std);
@ -601,6 +604,8 @@ parse_option (const string& arg)
} else if ( (arg == "--verbose") || (arg == "-v") ) { } else if ( (arg == "--verbose") || (arg == "-v") ) {
// verbose help/usage request // verbose help/usage request
return(FG_OPTIONS_VERBOSE_HELP); return(FG_OPTIONS_VERBOSE_HELP);
} else if ( arg.find( "--language=") == 0 ) {
globals->set_locale( fgInitLocale( arg.substr( 11 ).c_str() ) );
} else if ( arg == "--disable-game-mode") { } else if ( arg == "--disable-game-mode") {
fgSetBool("/sim/startup/game-mode", false); fgSetBool("/sim/startup/game-mode", false);
} else if ( arg == "--enable-game-mode" ) { } else if ( arg == "--enable-game-mode" ) {
@ -1147,7 +1152,7 @@ fgParseOptions (const string& path) {
} }
if ( parse_option( line ) == FG_OPTIONS_ERROR ) { if ( parse_option( line ) == FG_OPTIONS_ERROR ) {
cout << endl << "Config file parse error: " << path << " '" cerr << endl << "Config file parse error: " << path << " '"
<< line << "'" << endl; << line << "'" << endl;
fgUsage(); fgUsage();
exit(-1); exit(-1);
@ -1268,7 +1273,7 @@ void fgShowAircraft(void) {
dirp = ulOpenDir(path.c_str()); dirp = ulOpenDir(path.c_str());
if (dirp == NULL) { if (dirp == NULL) {
cout << "Unable to open aircraft directory." << endl; cerr << "Unable to open aircraft directory." << endl;
exit(-1); exit(-1);
} }