| 161 | //========================================================================================================== |
| 162 | |
| 163 | void save_profile() { |
| 164 | color_ostream_proxy out(Core::getInstance().getConsole()); |
| 165 | |
| 166 | FILE* outfile = fopen(profile_file_name, "w"); |
| 167 | fields i = first_fields; |
| 168 | size_t civ = 0; |
| 169 | |
| 170 | while (true) { |
| 171 | for (size_t k = 0; k < state->plotinfo[static_cast<int8_t>(i)]->list.size(); k++) { |
| 172 | if (state->plotinfo[static_cast<int8_t>(i) + civ]->current_value == state->plotinfo[static_cast<int8_t>(i) + civ]->list[k].key) { |
| 173 | fprintf(outfile, "[%s:%s]\n", state->finder_list[static_cast<int8_t>(i) + civ].text.c_str(), state->plotinfo[static_cast<int8_t>(i) + civ]->list[k].text.c_str()); |
| 174 | break; |
| 175 | } |
| 176 | } |
| 177 | // fprintf(outfile, "[%s:%i]\n", state->finder_list[static_cast<int8_t>(i)].text.c_str(), state->plotinfo[static_cast<int8_t>(i)]->current_value); |
| 178 | if (i == last_fields) { |
| 179 | civ++; |
| 180 | |
| 181 | if (civ == state->civs.size()) { |
| 182 | break; // done |
| 183 | } |
| 184 | } |
| 185 | else { |
| 186 | i = static_cast <fields>(static_cast<int8_t>(i) + 1); |
| 187 | } |
| 188 | } |
| 189 | |
| 190 | fclose(outfile); |
| 191 | } |
| 192 | |
| 193 | //========================================================================================================== |
| 194 | |