@@ -87,14 +87,14 @@ FILE *openConfig(bool readMode, Settings settings) {
87
87
//
88
88
// returns the next integer from the file
89
89
//
90
- int nextInteger (FILE *fp, int def) {
90
+ int nextInteger (FILE *fp, int min, int def) {
91
91
int result = 0 ;
92
92
for (int c = fgetc (fp); c != EOF && c != ' ,' && c != ' \n ' ; c = fgetc (fp)) {
93
93
if (c != ' \r ' ) {
94
94
result = (result * 10 ) + (c - ' 0' );
95
95
}
96
96
}
97
- if (! result) {
97
+ if (result < min ) {
98
98
result = def;
99
99
}
100
100
return result;
@@ -160,14 +160,14 @@ void restorePath(FILE *fp, bool restoreDir) {
160
160
void restoreSettings (SDL_Rect &rect, int &fontScale, bool debug, bool restoreDir) {
161
161
FILE *fp = openConfig (true , debug ? k_debug : k_window);
162
162
if (fp) {
163
- rect.x = nextInteger (fp, SDL_WINDOWPOS_UNDEFINED);
164
- rect.y = nextInteger (fp, SDL_WINDOWPOS_UNDEFINED);
165
- rect.w = nextInteger (fp, DEFAULT_WIDTH);
166
- rect.h = nextInteger (fp, DEFAULT_HEIGHT);
167
- fontScale = nextInteger (fp, DEFAULT_SCALE);
168
- opt_mute_audio = nextInteger (fp, 0 );
169
- opt_ide = nextInteger (fp, 0 ) ? IDE_INTERNAL : IDE_NONE;
170
- g_themeId = nextInteger (fp, 0 );
163
+ rect.x = nextInteger (fp, 0 , SDL_WINDOWPOS_UNDEFINED);
164
+ rect.y = nextInteger (fp, 0 , SDL_WINDOWPOS_UNDEFINED);
165
+ rect.w = nextInteger (fp, 100 , DEFAULT_WIDTH);
166
+ rect.h = nextInteger (fp, 100 , DEFAULT_HEIGHT);
167
+ fontScale = nextInteger (fp, 30 , DEFAULT_SCALE);
168
+ opt_mute_audio = nextInteger (fp, 0 , 0 );
169
+ opt_ide = nextInteger (fp, 0 , 0 ) ? IDE_INTERNAL : IDE_NONE;
170
+ g_themeId = nextInteger (fp, 0 , 0 );
171
171
for (int i = 0 ; i < THEME_COLOURS; i++) {
172
172
g_user_theme[i] = nextHex (fp, g_user_theme[i]);
173
173
}
0 commit comments