@@ -87,14 +87,14 @@ FILE *openConfig(bool readMode, Settings settings) {
8787//
8888// returns the next integer from the file
8989//
90- int nextInteger (FILE *fp, int def) {
90+ int nextInteger (FILE *fp, int min, int def) {
9191 int result = 0 ;
9292 for (int c = fgetc (fp); c != EOF && c != ' ,' && c != ' \n ' ; c = fgetc (fp)) {
9393 if (c != ' \r ' ) {
9494 result = (result * 10 ) + (c - ' 0' );
9595 }
9696 }
97- if (! result) {
97+ if (result < min ) {
9898 result = def;
9999 }
100100 return result;
@@ -160,14 +160,14 @@ void restorePath(FILE *fp, bool restoreDir) {
160160void restoreSettings (SDL_Rect &rect, int &fontScale, bool debug, bool restoreDir) {
161161 FILE *fp = openConfig (true , debug ? k_debug : k_window);
162162 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 );
171171 for (int i = 0 ; i < THEME_COLOURS; i++) {
172172 g_user_theme[i] = nextHex (fp, g_user_theme[i]);
173173 }
0 commit comments