1 /*SENI, Search for Extra Nibiru Intelligence*/
4 This program is free software: you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation, either version 3 of the License, or
7 (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program. If not, see <http://www.gnu.org/licenses/>.
19 Copyright SSW Team 2010
32 Config::Config(const sConf
*s
)
37 void Config::setDefault(void)
39 this->conf
.resx
= 1024;
40 this->conf
.resy
= 768;
41 this->conf
.bitres
= 24;
42 this->conf
.sdlflags
= SDL_FULLSCREEN
| SDL_DOUBLEBUF
| SDL_HWSURFACE
| SDL_OPENGLBLIT
;
45 void Config::setErrorMode(void)
47 this->conf
.resx
= 640;
48 this->conf
.resy
= 480;
49 this->conf
.bitres
= 16;
50 this->conf
.sdlflags
= SDL_SWSURFACE
;
53 void Config::setConfig(const sConf
*s
)
55 this->conf
.sdlflags
= s
->sdlflags
;
56 this->conf
.resx
= s
->resx
;
57 this->conf
.resy
= s
->resy
;
58 this->conf
.bitres
= s
->bitres
;
61 void Config::getConfig(sConf
*s
)
63 s
->sdlflags
= this->conf
.sdlflags
;
64 s
->resx
= this->conf
.resx
;
65 s
->resy
= this->conf
.resy
;
66 s
->bitres
= this->conf
.bitres
;
69 int Config::saveConfig(const char *n
)
74 return CONFIG_FILE_ERROR
;
75 fwrite(&conf
, sizeof(sConf
), 1, f
);
77 return CONFIG_NO_ERROR
;
80 int Config::loadConfig(const char *n
)
85 return CONFIG_FILE_ERROR
;
86 fread(&conf
, sizeof(sConf
), 1, f
);
88 return CONFIG_NO_ERROR
;
91 int Config::doRes(const char *r
, int *x
, int *y
)
95 c
= (char *)strchr(r
, 'x');
97 c
= (char *)strchr(r
, 'X');
100 for(i
= 0; r
[i
]; i
++){
101 if((r
[i
] < '0' || r
[i
] > '9') && r
+i
!= c
)