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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
|
diff -ud ../NetherEarth_v0.51-linsrc.orig/3dobject-ase.cpp ./3dobject-ase.cpp
--- ../NetherEarth_v0.51-linsrc.orig/3dobject-ase.cpp 2002-10-26 00:00:00.000000000 +0300
+++ ./3dobject-ase.cpp 2004-04-16 21:42:55.000000000 +0300
@@ -34,7 +34,7 @@
char buffer[256];
FILE *fp;
- fp=fopen(file,"r+");
+ fp=fopen(file,"r");
if (fp==NULL) return false;
/* Look for the materials: */
diff -ud ../NetherEarth_v0.51-linsrc.orig/3dobject.cpp ./3dobject.cpp
--- ../NetherEarth_v0.51-linsrc.orig/3dobject.cpp 2004-01-06 20:49:00.000000000 +0200
+++ ./3dobject.cpp 2004-04-16 21:43:44.000000000 +0300
@@ -74,7 +74,7 @@
int *smooth;
- fp=fopen(file,"r+");
+ fp=fopen(file,"r");
if (fp==NULL) return false;
/* Importar un fichero .ASC de 3DStudio */
diff -ud ../NetherEarth_v0.51-linsrc.orig/bitmap.cpp ./bitmap.cpp
--- ../NetherEarth_v0.51-linsrc.orig/bitmap.cpp 2004-01-06 20:49:00.000000000 +0200
+++ ./bitmap.cpp 2004-04-16 21:45:13.000000000 +0300
@@ -14,7 +14,7 @@
g=0;
b=0;
- fp=fopen(file,"rb+");
+ fp=fopen(file,"rb");
if (fp==NULL) return;
/* Tag: */
diff -ud ../NetherEarth_v0.51-linsrc.orig/mainmenu.cpp ./mainmenu.cpp
--- ../NetherEarth_v0.51-linsrc.orig/mainmenu.cpp 2004-01-06 20:50:00.000000000 +0200
+++ ./mainmenu.cpp 2004-04-16 21:14:14.000000000 +0300
@@ -6,6 +6,9 @@
#include <dirent.h>
#endif
+#include <stdlib.h>
+#include <fcntl.h>
+#include <unistd.h>
#include "string.h"
#include "stdio.h"
#include "math.h"
@@ -483,8 +486,10 @@
{
int v;
FILE *fp;
+ char cfg_path[300];
- fp=fopen("nether.cfg","r");
+ sprintf(cfg_path, "%s/.netherearth/nether.cfg", getenv("HOME"));
+ fp=fopen(cfg_path,"r");
if (fp==0) return;
if (2!=fscanf(fp,"%i %i",&SCREEN_X,&SCREEN_Y)) return;
@@ -510,8 +515,12 @@
void save_configuration(void)
{
FILE *fp;
+ char cfg_path[300];
- fp=fopen("nether.cfg","w");
+ sprintf(cfg_path, "%s/.netherearth", getenv("HOME"));
+ mkdir(cfg_path, 0755);
+ sprintf(cfg_path, "%s/.netherearth/nether.cfg", getenv("HOME"));
+ fp=fopen(cfg_path,"w");
if (fp==0) return;
fprintf(fp,"%i %i\n",SCREEN_X,SCREEN_Y);
diff -ud ../NetherEarth_v0.51-linsrc.orig/nether.cpp ./nether.cpp
--- ../NetherEarth_v0.51-linsrc.orig/nether.cpp 2004-01-06 21:03:00.000000000 +0200
+++ ./nether.cpp 2004-04-16 20:54:54.000000000 +0300
@@ -1203,7 +1203,7 @@
if (option_menu==(i+1)) glColor3f(1.0,0.0,0.0);
else glColor3f(0.5,0.5,1.0);
glTranslatef(0,-2,0);
- sprintf(filename,"savedgame%i.txt",i);
+ sprintf(filename,"%s/.netherearth/savedgame%i.txt", getenv("HOME"), i);
fp=fopen(filename,"r");
if (fp==0) {
scaledglprintf(0.01,0.01,"SLOT%i - EMPTY",i+1);
@@ -1232,7 +1232,7 @@
if (option_menu==(i+1)) glColor3f(1.0,0.0,0.0);
else glColor3f(0.5,0.5,1.0);
glTranslatef(0,-2,0);
- sprintf(filename,"savedgame%i.txt",i);
+ sprintf(filename,"%s/.netherearth/savedgame%i.txt", getenv("HOME"), i);
fp=fopen(filename,"r");
if (fp==0) {
scaledglprintf(0.01,0.01,"SLOT%i - EMPTY",i+1);
@@ -1291,7 +1291,7 @@
case 4:
{
char filename[80];
- sprintf(filename,"savedgame%i.txt",option_menu-1);
+ sprintf(filename,"%s/.netherearth/savedgame%i.txt", getenv("HOME"), option_menu-1);
save_game(filename);
//save_debug_report("debugreport.txt");
game_state=STATE_PAUSE;
@@ -1326,7 +1326,7 @@
case 4:
{
char filename[80];
- sprintf(filename,"savedgame%i.txt",option_menu-1);
+ sprintf(filename,"%s/.netherearth/savedgame%i.txt", getenv("HOME"), option_menu-1);
killmenu(act_menu);
load_game(filename);
newmenu(act_menu);
diff -ud ../NetherEarth_v0.51-linsrc.orig/nethersave.cpp ./nethersave.cpp
--- ../NetherEarth_v0.51-linsrc.orig/nethersave.cpp 2003-09-17 00:00:00.000000000 +0300
+++ ./nethersave.cpp 2004-04-16 21:23:04.000000000 +0300
@@ -2,6 +2,10 @@
#include "windows.h"
#endif
+#include <stdlib.h>
+#include <sys/types.h>
+#include <fcntl.h>
+#include <unistd.h>
#include "string.h"
#include "stdio.h"
#include "math.h"
@@ -40,7 +44,10 @@
ROBOT *r;
BULLET *bul;
EXPLOSION *e;
+ char tmp_path[300];
+ sprintf(tmp_path, "%s/.netherearth", getenv("HOME"));
+ mkdir(tmp_path, 0755);
fp=fopen(filename,"w");
if (fp==0) return false;
|