mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2024-09-19 18:29:36 +00:00
load scores before showing custom modes
This commit is contained in:
parent
00644cb2ef
commit
70747f938d
@ -816,7 +816,7 @@ EX void showChangeMode() {
|
|||||||
dialog::addItem(XLAT("highlights & achievements"), 'h');
|
dialog::addItem(XLAT("highlights & achievements"), 'h');
|
||||||
dialog::add_action_push(mode_higlights);
|
dialog::add_action_push(mode_higlights);
|
||||||
dialog::addItem(XLAT("custom mode manager"), 'm');
|
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::addBack();
|
||||||
dialog::display();
|
dialog::display();
|
||||||
@ -1262,7 +1262,9 @@ int read_menu_args() {
|
|||||||
PHASEFROM(2); launch_dialog(showChangeMode);
|
PHASEFROM(2); launch_dialog(showChangeMode);
|
||||||
}
|
}
|
||||||
else if(argis("-d:custom")) {
|
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")) {
|
else if(argis("-d:history")) {
|
||||||
PHASEFROM(2); launch_dialog(history::history_menu);
|
PHASEFROM(2); launch_dialog(history::history_menu);
|
||||||
|
20
scores.cpp
20
scores.cpp
@ -315,7 +315,7 @@ void show() {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
void load() {
|
void load_only() {
|
||||||
if(scorefile == "") return;
|
if(scorefile == "") return;
|
||||||
scores.clear();
|
scores.clear();
|
||||||
FILE *f = fopen(scorefile.c_str(), "rt");
|
FILE *f = fopen(scorefile.c_str(), "rt");
|
||||||
@ -368,6 +368,19 @@ 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();
|
saveBox();
|
||||||
score sc;
|
score sc;
|
||||||
for(int i=0; i<POSSCORE; i++) sc.box[i] = save.box[i];
|
for(int i=0; i<POSSCORE; i++) sc.box[i] = save.box[i];
|
||||||
@ -376,7 +389,6 @@ void load() {
|
|||||||
sc.yasc_message = canmove ? "on the run" : yasc_message;
|
sc.yasc_message = canmove ? "on the run" : yasc_message;
|
||||||
scores.push_back(sc);
|
scores.push_back(sc);
|
||||||
|
|
||||||
fclose(f);
|
|
||||||
clearMessages();
|
clearMessages();
|
||||||
// addMessage(its(isize(scores))+" games have been recorded in "+scorefile);
|
// addMessage(its(isize(scores))+" games have been recorded in "+scorefile);
|
||||||
pushScreen(show);
|
pushScreen(show);
|
||||||
@ -392,10 +404,6 @@ void load() {
|
|||||||
|
|
||||||
EX map<int, int> qty_scores_for;
|
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
|
#endif
|
||||||
|
@ -1485,8 +1485,6 @@ EX string mode_to_search;
|
|||||||
EX void list_saved_custom_modes() {
|
EX void list_saved_custom_modes() {
|
||||||
dialog::start_list(2000, 2000, 'a');
|
dialog::start_list(2000, 2000, 'a');
|
||||||
|
|
||||||
count_scores();
|
|
||||||
|
|
||||||
auto current_mc = modecode();
|
auto current_mc = modecode();
|
||||||
|
|
||||||
int unidentified = 0;
|
int unidentified = 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user