Package: cultivation / 9+dfsg1-2

abs_paths.patch Patch series | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
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