Author: Miriam Ruiz <little_miry@yahoo.es> Description: Allow the game to be compiled with absolute paths to the data --- a/game2/gameSource/game.cpp +++ b/game2/gameSource/game.cpp @@ -50,6 +50,8 @@ #include <time.h> +#include "defs.h" + #include "minorGems/graphics/openGL/ScreenGL.h" #include "minorGems/graphics/openGL/SceneHandlerGL.h" #include "minorGems/graphics/Color.h" @@ -912,7 +914,7 @@ // load font image TGAImageConverter tga; - File fontFile( NULL, "font.tga" ); + File fontFile( new Path(DATADIR), "font.tga" ); FileInputStream fontInput( &fontFile ); Image *fontImage = tga.deformatImage( &fontInput ); @@ -995,7 +997,7 @@ mCurrentTipStoredItem = -1; // translation language for tool tips - File languageNameFile( NULL, "language.txt" ); + File languageNameFile( new Path(DATADIR), "language.txt" ); if( languageNameFile.exists() ) { char *languageNameText = languageNameFile.readFileContents(); @@ -1008,6 +1010,7 @@ if( numTokens > 0 ) { char *languageName = *( tokens->getElement( 0 ) ); + TranslationManager::setDirectoryName( DATADIR "/languages" ); TranslationManager::setLanguage( languageName ); } else { --- a/game2/gameSource/features.cpp +++ b/game2/gameSource/features.cpp @@ -7,6 +7,7 @@ +#include "defs.h" #include "features.h" #include "minorGems/io/file/File.h" @@ -57,7 +58,7 @@ void initializeFeatures() { - FILE *featuresFile = fopen( "features.txt", "r" ); + FILE *featuresFile = fopen( DATADIR "/features.txt", "r" ); char stringBuffer[100]; int switchValue; --- /dev/null +++ b/game2/gameSource/defs.h @@ -0,0 +1,8 @@ +#ifndef DEFS_INCLUDED +#define DEFS_INCLUDED + +#ifndef DATADIR +#define DATADIR "." +#endif + +#endif