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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
|
Only in ./: 1.0-gentoo-paths.patch
diff -ud ../../abe-1.0/src/Game.c ./Game.c
--- ../../abe-1.0/src/Game.c 2003-04-12 22:42:03.000000000 +0300
+++ ./Game.c 2004-04-12 13:07:59.000000000 +0300
@@ -6,14 +6,14 @@
void deleteSavedGame() {
char path[300];
// version 2
- sprintf(path, "%s%ssave%d.dat", SAVEGAME_DIR, PATH_SEP, (int)GAME_VERSION);
+ sprintf(path, "%s%s%s%ssave%d.dat", getenv("HOME"), PATH_SEP, SAVEGAME_DIR, PATH_SEP, (int)GAME_VERSION);
remove(path);
- sprintf(path, "%s%ssavedmap%d.dat", SAVEGAME_DIR, PATH_SEP, (int)GAME_VERSION);
+ sprintf(path, "%s%s%s%ssavedmap%d.dat", getenv("HOME"), PATH_SEP, SAVEGAME_DIR, PATH_SEP, (int)GAME_VERSION);
remove(path);
// version 1
- sprintf(path, "%s%ssave.dat", SAVEGAME_DIR, PATH_SEP);
+ sprintf(path, "%s%s%s%ssave.dat", getenv("HOME"), PATH_SEP, SAVEGAME_DIR, PATH_SEP);
remove(path);
- sprintf(path, "%s%ssavedmap.dat", SAVEGAME_DIR, PATH_SEP);
+ sprintf(path, "%s%s%s%ssavedmap.dat", getenv("HOME"), PATH_SEP, SAVEGAME_DIR, PATH_SEP);
remove(path);
}
@@ -23,7 +23,7 @@
char *err;
SDL_RWops *rwop;
- sprintf(path, "%s%ssave%d.dat", SAVEGAME_DIR, PATH_SEP, (int)GAME_VERSION);
+ sprintf(path, "%s%s%s%ssave%d.dat", getenv("HOME"), PATH_SEP, SAVEGAME_DIR, PATH_SEP, (int)GAME_VERSION);
if(!(fp = fopen(path, "wb"))) {
err = strerror(errno);
@@ -51,7 +51,7 @@
SDL_RWclose(rwop);
// save the map in savegame/savedmap.dat
- sprintf(path, "%s%ssavedmap%d.dat", SAVEGAME_DIR, PATH_SEP, (int)GAME_VERSION);
+ sprintf(path, "%s%s%s%ssavedmap%d.dat", getenv("HOME"), PATH_SEP, SAVEGAME_DIR, PATH_SEP, (int)GAME_VERSION);
saveMapPath(path);
}
@@ -66,7 +66,7 @@
version = (int)GAME_VERSION;
// load the map from savegame/savedmap.dat
- sprintf(path, "%s%ssavedmap%d.dat", SAVEGAME_DIR, PATH_SEP, version);
+ sprintf(path, "%s%s%s%ssavedmap%d.dat", getenv("HOME"), PATH_SEP, SAVEGAME_DIR, PATH_SEP, version);
if(!loadMapPath(path, 0)) {
// if can't find saved map load static map
fprintf(stderr, "Can't find current saved map. Will try to use static map.\n");
@@ -82,9 +82,9 @@
// try to find a saved game of any version
while(version > 0) {
if(version > 1) {
- sprintf(path, "%s%ssave%d.dat", SAVEGAME_DIR, PATH_SEP, version);
+ sprintf(path, "%s%s%s%ssave%d.dat", getenv("HOME"), PATH_SEP, SAVEGAME_DIR, PATH_SEP, version);
} else {
- sprintf(path, "%s%ssave.dat", SAVEGAME_DIR, PATH_SEP);
+ sprintf(path, "%s%s%s%ssave.dat", getenv("HOME"), PATH_SEP, SAVEGAME_DIR, PATH_SEP);
}
fprintf(stderr, "Trying to load saved game: %s\n", path);
fflush(stderr);
diff -ud ../../abe-1.0/src/Game.h ./Game.h
--- ../../abe-1.0/src/Game.h 2003-04-12 23:55:37.000000000 +0300
+++ ./Game.h 2004-04-12 13:08:03.000000000 +0300
@@ -19,7 +19,7 @@
#define SPRING_JUMP 30
-#define SAVEGAME_DIR "savegame"
+#define SAVEGAME_DIR ".abe"
#define MAX_HEALTH 100
diff -ud ../../abe-1.0/src/Image.c ./Image.c
--- ../../abe-1.0/src/Image.c 2003-04-12 21:16:13.000000000 +0300
+++ ./Image.c 2004-04-12 13:31:33.000000000 +0300
@@ -305,7 +305,9 @@
int block = 0;
image_count = 0;
- sprintf(tmp_path, "%s%s%s", IMAGES_DIR, PATH_SEP, "tmp.bmp");
+ sprintf(tmp_path, "%s%s%s", getenv("HOME"), PATH_SEP, ".abe");
+ mkdir(tmp_path, 0755);
+ sprintf(tmp_path, "%s%s%s%s%s", getenv("HOME"), PATH_SEP, ".abe", PATH_SEP, "tmp.bmp");
sprintf(path, "%s%s%s", IMAGES_DIR, PATH_SEP, "images.tar");
fprintf(stderr, "Opening %s for reading.\n", path);
|