File f1spirit-0.rc9.1615-dir.patch of Package f1spirit
--- sources/filehandling.cpp
+++ sources/filehandling.cpp
@@ -57,6 +57,12 @@
// open file
return(fopen(fname, m));
break;
+
+ case GAMEDOCS:
+ snprintf(fname, STRLEN - 1, "%s/%s", DOCSDIR, f);
+ // open file
+ return(fopen(fname, m));
+ break;
}
#endif
--- sources/filehandling.h
+++ sources/filehandling.h
@@ -7,7 +7,7 @@
#define STRLEN 512
#define GAMENAME "f1spirit"
-enum filetype { GAMEDATA, USERDATA };
+enum filetype { GAMEDATA, USERDATA, GAMEDOCS };
#ifndef _WIN32
int mkdirp(const char *fqfn, mode_t mode);
--- sources/main.cpp
+++ sources/main.cpp
@@ -4,6 +4,7 @@
#include <stdio.h>
#include <stdlib.h>
+#include <unistd.h>
#include "math.h"
#include "string.h"
@@ -256,6 +257,7 @@
int main(int argc, char** argv) {
#endif
+ chdir(DATADIR);
SDL_Surface *screen_sfc;
F1SpiritApp *game;
KEYBOARDSTATE *k;
--- sources/state_menu_draw.cpp
+++ sources/state_menu_draw.cpp
@@ -121,7 +121,7 @@
GLTile *t;
SDL_Surface *sfc;
- fp = f1open("readme.txt", "r", GAMEDATA);
+ fp = f1open("readme.txt", "r", GAMEDOCS);
if (fp != 0) {