1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2024-11-09 15:39:55 +00:00

load scores before showing custom modes

This commit is contained in:
Zeno Rogue 2024-06-02 18:00:47 +02:00
parent 00644cb2ef
commit 70747f938d
3 changed files with 19 additions and 11 deletions

View File

@ -816,7 +816,7 @@ EX void showChangeMode() {
dialog::addItem(XLAT("highlights & achievements"), 'h');
dialog::add_action_push(mode_higlights);
dialog::addItem(XLAT("custom mode manager"), 'm');
dialog::add_action_push(show_custom);
dialog::add_action([] { scores::load_only(); pushScreen(show_custom); });
dialog::addBack();
dialog::display();
@ -1262,7 +1262,9 @@ int read_menu_args() {
PHASEFROM(2); launch_dialog(showChangeMode);
}
else if(argis("-d:custom")) {
PHASEFROM(2); launch_dialog(show_custom);
PHASEFROM(3);
scores::load_only();
launch_dialog(show_custom);
}
else if(argis("-d:history")) {
PHASEFROM(2); launch_dialog(history::history_menu);

View File

@ -315,7 +315,7 @@ void show() {
};
}
void load() {
void load_only() {
if(scorefile == "") return;
scores.clear();
FILE *f = fopen(scorefile.c_str(), "rt");
@ -368,15 +368,27 @@ void load() {
}
}
fclose(f);
qty_scores_for.clear();
for(auto s: scores::scores) {
int modeid = s.box[scores::MODECODE_BOX];
qty_scores_for[get_identify(modeid)]++;
}
}
void load() {
load_only();
saved_modecode = modecode();
saveBox();
score sc;
score sc;
for(int i=0; i<POSSCORE; i++) sc.box[i] = save.box[i];
sc.box[POSSCORE] = 0;
sc.box[MAXBOX-1] = 1; sc.ver = "NOW";
sc.yasc_message = canmove ? "on the run" : yasc_message;
scores.push_back(sc);
fclose(f);
clearMessages();
// addMessage(its(isize(scores))+" games have been recorded in "+scorefile);
pushScreen(show);
@ -392,10 +404,6 @@ void load() {
EX map<int, int> qty_scores_for;
EX void count_scores() {
qty_scores_for.clear();
for(auto s: scores::scores) qty_scores_for[scores::MODECODE_BOX]++;
}
}
#endif

View File

@ -1485,8 +1485,6 @@ EX string mode_to_search;
EX void list_saved_custom_modes() {
dialog::start_list(2000, 2000, 'a');
count_scores();
auto current_mc = modecode();
int unidentified = 0;