Rev 136 | Rev 150 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 136 | Rev 145 | ||
---|---|---|---|
Line 47... | Line 47... | ||
47 | options.clock_color = INIFile_ReadEntryAsUnsignedLong (inifile, L"options", L"game clock color", 0x00007f00); // dark blue, in RGBA |
47 | options.clock_color = INIFile_ReadEntryAsUnsignedLong (inifile, L"options", L"game clock color", 0x00007f00); // dark blue, in RGBA |
48 | options.want_history = (INIFile_ReadEntryAsBool (inifile, L"options", L"show game history", true) > 0); |
48 | options.want_history = (INIFile_ReadEntryAsBool (inifile, L"options", L"show game history", true) > 0); |
49 | options.history_color = INIFile_ReadEntryAsUnsignedLong (inifile, L"options", L"game history color", 0xe7e7e700); // light grey, in RGBA |
49 | options.history_color = INIFile_ReadEntryAsUnsignedLong (inifile, L"options", L"game history color", 0xe7e7e700); // light grey, in RGBA |
50 | options.want_sepiafilter = (INIFile_ReadEntryAsBool (inifile, L"options", L"use sepia filter for past moves", true) > 0); |
50 | options.want_sepiafilter = (INIFile_ReadEntryAsBool (inifile, L"options", L"use sepia filter for past moves", true) > 0); |
51 | options.want_autorotateon1vs1 = (INIFile_ReadEntryAsBool (inifile, L"options", L"auto-rotate board",true) > 0); |
51 | options.want_autorotateon1vs1 = (INIFile_ReadEntryAsBool (inifile, L"options", L"auto-rotate board",true) > 0); |
52 | options.rotate_speed = INIFile_ReadEntryAsLong (inifile, L"options", L"rotation speed", |
52 | options.rotate_speed = INIFile_ReadEntryAsLong (inifile, L"options", L"rotation speed", 10); |
53 | 53 | ||
54 | // [display] |
54 | // [display] |
55 | READ_WIDESTRING (temp_string, inifile, L"display", L"language", L"auto"); // first, try to read the language from the config file |
55 | READ_WIDESTRING (temp_string, inifile, L"display", L"language", L"auto"); // first, try to read the language from the config file |
56 | is_language_auto = (wcscmp (temp_string, L"auto") == 0); // remember is language is set to be automatically chosen |
56 | is_language_auto = (wcscmp (temp_string, L"auto") == 0); // remember is language is set to be automatically chosen |
57 | for (language_index = 0; language_index < language_count; language_index++) |
57 | for (language_index = 0; language_index < language_count; language_index++) |
Line 92... | Line 92... | ||
92 | 92 | ||
93 | // [sound] |
93 | // [sound] |
94 | options.want_sounds = (INIFile_ReadEntryAsBool (inifile, L"sound", L"play sounds", true) > 0); |
94 | options.want_sounds = (INIFile_ReadEntryAsBool (inifile, L"sound", L"play sounds", true) > 0); |
95 | 95 | ||
96 | // [theme] |
96 | // [theme] |
97 | READ_WIDESTRING (wantedtheme_name, inifile, L"theme", L"theme name", L" |
97 | READ_WIDESTRING (wantedtheme_name, inifile, L"theme", L"theme name", L"Default"); |
98 | want_grid = (INIFile_ReadEntryAsBool (inifile, L"theme", L"show grid", |
98 | want_grid = (INIFile_ReadEntryAsBool (inifile, L"theme", L"show grid", true) > 0); |
99 | want_flaticons = (INIFile_ReadEntryAsBool (inifile, L"theme", L"flat icons instead", |
99 | want_flaticons = (INIFile_ReadEntryAsBool (inifile, L"theme", L"flat icons instead", true) > 0); |
100 | want_custombackground = (INIFile_ReadEntryAsBool (inifile, L"theme", L"use custom background", false) > 0); |
100 | want_custombackground = (INIFile_ReadEntryAsBool (inifile, L"theme", L"use custom background", false) > 0); |
101 | READ_WIDESTRING (custombackground_pathname, inifile, L"theme", L"custom background picture", L""); |
101 | READ_WIDESTRING (custombackground_pathname, inifile, L"theme", L"custom background picture", L""); |
102 | 102 | ||
103 | // [engine] |
103 | // [engine] |
104 | Config_LoadEngines (); // discover all engine parameters from the engines folder |
104 | Config_LoadEngines (); // discover all engine parameters from the engines folder |
Line 107... | Line 107... | ||
107 | READ_WIDESTRING (temp_string, inifile, L"engine", L"program", L"Stockfish"); |
107 | READ_WIDESTRING (temp_string, inifile, L"engine", L"program", L"Stockfish"); |
108 | if (_wcsicmp (temp_string, options.engine.programs[program_index].folder) == 0) |
108 | if (_wcsicmp (temp_string, options.engine.programs[program_index].folder) == 0) |
109 | break; // identify the preferred engine, break as soon as we find it |
109 | break; // identify the preferred engine, break as soon as we find it |
110 | } |
110 | } |
111 | options.engine.selected_program = (program_index < options.engine.program_count ? program_index : 0); // consistency check |
111 | options.engine.selected_program = (program_index < options.engine.program_count ? program_index : 0); // consistency check |
112 | options.engine.depth = INIFile_ReadEntryAsLong (inifile, L"engine", L"allowed depth", |
112 | options.engine.depth = INIFile_ReadEntryAsLong (inifile, L"engine", L"allowed depth", 10); |
113 | options.engine.max_depth = INIFile_ReadEntryAsLong (inifile, L"engine", L"maximum depth", |
113 | options.engine.max_depth = INIFile_ReadEntryAsLong (inifile, L"engine", L"maximum depth", 20); |
114 | options.engine.blunder_chances = INIFile_ReadEntryAsLong (inifile, L"engine", L"blunder chances", |
114 | options.engine.blunder_chances = INIFile_ReadEntryAsLong (inifile, L"engine", L"blunder chances", 5); |
115 | options.engine.obstinacy_level = INIFile_ReadEntryAsLong (inifile, L"engine", L"obstinacy", |
115 | options.engine.obstinacy_level = INIFile_ReadEntryAsLong (inifile, L"engine", L"obstinacy", -1); |
116 | options.engine.is_expert_mode = (INIFile_ReadEntryAsBool (inifile, L"engine", L"expert mode", false) > 0); |
116 | options.engine.is_expert_mode = (INIFile_ReadEntryAsBool (inifile, L"engine", L"expert mode", false) > 0); |
117 | 117 | ||
118 | // [network] |
118 | // [network] |
119 | READ_WIDESTRING (options.network.server_address, inifile, L"network", L"server address", L"freechess.org"); |
119 | READ_WIDESTRING (options.network.server_address, inifile, L"network", L"server address", L"freechess.org"); |
120 | options.network.server_port = INIFile_ReadEntryAsLong (inifile, L"network", L"server port", 5000); |
120 | options.network.server_port = INIFile_ReadEntryAsLong (inifile, L"network", L"server port", 5000); |
Line 127... | Line 127... | ||
127 | // [registration] |
127 | // [registration] |
128 | READ_WIDESTRING (options.registration.user_email, inifile, L"registration", L"user email", L""); |
128 | READ_WIDESTRING (options.registration.user_email, inifile, L"registration", L"user email", L""); |
129 | options.registration.activation_code = (unsigned __int32) INIFile_ReadEntryAsLong (inifile, L"registration", L"activation code", 0); |
129 | options.registration.activation_code = (unsigned __int32) INIFile_ReadEntryAsLong (inifile, L"registration", L"activation code", 0); |
130 | 130 | ||
131 | // [smilies] |
131 | // [smilies] |
- | 132 | if (inifile == NULL) |
|
- | 133 | { |
|
- | 134 | // if the .ini file doesn't exist yet, re-create one with the default smilies set |
|
- | 135 | inifile = INIFile_NewINIFile (); |
|
- | 136 | WRITE_WIDESTRING (L"smilies", L"\"o:)\"", L"angel.txt"); |
|
- | 137 | WRITE_WIDESTRING (L"smilies", L"\"0:)\"", L"angel.txt"); |
|
- | 138 | WRITE_WIDESTRING (L"smilies", L"\"o:-)\"", L"angel.txt"); |
|
- | 139 | WRITE_WIDESTRING (L"smilies", L"\"0:-)\"", L"angel.txt"); |
|
- | 140 | WRITE_WIDESTRING (L"smilies", L"\":-@\"", L"angry.txt"); |
|
- | 141 | WRITE_WIDESTRING (L"smilies", L"\">:(\"", L"angry.txt"); |
|
- | 142 | WRITE_WIDESTRING (L"smilies", L"\">:-(\"", L"angry.txt"); |
|
- | 143 | WRITE_WIDESTRING (L"smilies", L"\":,(\"", L"cry.txt"); |
|
- | 144 | WRITE_WIDESTRING (L"smilies", L"\":,-(\"", L"cry.txt"); |
|
- | 145 | WRITE_WIDESTRING (L"smilies", L"\":,,,(\"", L"cry.txt"); |
|
- | 146 | WRITE_WIDESTRING (L"smilies", L"\":'(\"", L"cry.txt"); |
|
- | 147 | WRITE_WIDESTRING (L"smilies", L"\":'-(\"", L"cry.txt"); |
|
- | 148 | WRITE_WIDESTRING (L"smilies", L"\":'''(\"", L"cry.txt"); |
|
- | 149 | WRITE_WIDESTRING (L"smilies", L"\"t_t\"", L"cry.txt"); |
|
- | 150 | WRITE_WIDESTRING (L"smilies", L"\"t.t\"", L"cry.txt"); |
|
- | 151 | WRITE_WIDESTRING (L"smilies", L"\"8d\"", L"dumb.txt"); |
|
- | 152 | WRITE_WIDESTRING (L"smilies", L"\"8-d\"", L"dumb.txt"); |
|
- | 153 | WRITE_WIDESTRING (L"smilies", L"\"oo\"", L"dumb.txt"); |
|
- | 154 | WRITE_WIDESTRING (L"smilies", L"\":d\"", L"grin.txt"); |
|
- | 155 | WRITE_WIDESTRING (L"smilies", L"\":-d\"", L"grin.txt"); |
|
- | 156 | WRITE_WIDESTRING (L"smilies", L"\":))\"", L"happy.txt"); |
|
- | 157 | WRITE_WIDESTRING (L"smilies", L"\"xd\"", L"laugh.txt"); |
|
- | 158 | WRITE_WIDESTRING (L"smilies", L"\"x-d\"", L"laugh.txt"); |
|
- | 159 | WRITE_WIDESTRING (L"smilies", L"\":x\"", L"mute.txt"); |
|
- | 160 | WRITE_WIDESTRING (L"smilies", L"\":-x\"", L"mute.txt"); |
|
- | 161 | WRITE_WIDESTRING (L"smilies", L"\"plz\"", L"please.txt"); |
|
- | 162 | WRITE_WIDESTRING (L"smilies", L"\":(\"", L"sad.txt"); |
|
- | 163 | WRITE_WIDESTRING (L"smilies", L"\":-(\"", L"sad.txt"); |
|
- | 164 | WRITE_WIDESTRING (L"smilies", L"\":)\"", L"smile.txt"); |
|
- | 165 | WRITE_WIDESTRING (L"smilies", L"\":-)\"", L"smile.txt"); |
|
- | 166 | WRITE_WIDESTRING (L"smilies", L"\":s\"", L"sorry.txt"); |
|
- | 167 | WRITE_WIDESTRING (L"smilies", L"\":-s\"", L"sorry.txt"); |
|
- | 168 | WRITE_WIDESTRING (L"smilies", L"\"b)\"", L"star.txt"); |
|
- | 169 | WRITE_WIDESTRING (L"smilies", L"\"b-)\"", L"star.txt"); |
|
- | 170 | WRITE_WIDESTRING (L"smilies", L"\":p\"", L"tongue.txt"); |
|
- | 171 | WRITE_WIDESTRING (L"smilies", L"\":-p\"", L"tongue.txt"); |
|
- | 172 | WRITE_WIDESTRING (L"smilies", L"\";p\"", L"tongue.txt"); |
|
- | 173 | WRITE_WIDESTRING (L"smilies", L"\";-p\"", L"tongue.txt"); |
|
- | 174 | WRITE_WIDESTRING (L"smilies", L"\":/\"", L"unsure.txt"); |
|
- | 175 | WRITE_WIDESTRING (L"smilies", L"\":-/\"", L"unsure.txt"); |
|
- | 176 | WRITE_WIDESTRING (L"smilies", L"\":\\\"", L"unsure.txt"); |
|
- | 177 | WRITE_WIDESTRING (L"smilies", L"\":-\\\"", L"unsure.txt"); |
|
- | 178 | WRITE_WIDESTRING (L"smilies", L"\";)\"", L"wink.txt"); |
|
- | 179 | WRITE_WIDESTRING (L"smilies", L"\";-)\"", L"wink.txt"); |
|
- | 180 | } |
|
132 | smilies = NULL; |
181 | smilies = NULL; |
133 | smiley_count = 0; |
182 | smiley_count = 0; |
134 | while ((smiley_name = INIFile_GetEntryName (inifile, L"smilies", smiley_count)) != NULL) |
183 | while ((smiley_name = INIFile_GetEntryName (inifile, L"smilies", smiley_count)) != NULL) |
135 | { |
184 | { |
136 | // for each smiley we can read, reallocate smilies array to hold one smiley more |
185 | // for each smiley we can read, reallocate smilies array to hold one smiley more |