From 0b7a28d2371798a8138e78e5789d0014b16b4534 Mon Sep 17 00:00:00 2001 From: Barinade Date: Mon, 20 Jul 2020 23:23:10 -0500 Subject: [PATCH] fully reset meta row/hand/interval info fixes an issue with persistent calc information leaking into calculations on new files -> 437 --- .../MinaCalc/Agnostic/MetaIntervalInfo.h | 22 +++++++++++++++++++ src/Etterna/MinaCalc/Agnostic/MetaRowInfo.h | 17 ++++++++++++++ src/Etterna/MinaCalc/MinaCalc.cpp | 2 +- src/Etterna/MinaCalc/Ulbu.h | 13 +++++++++++ 4 files changed, 53 insertions(+), 1 deletion(-) diff --git a/src/Etterna/MinaCalc/Agnostic/MetaIntervalInfo.h b/src/Etterna/MinaCalc/Agnostic/MetaIntervalInfo.h index cae86923ff..42a608ccf7 100644 --- a/src/Etterna/MinaCalc/Agnostic/MetaIntervalInfo.h +++ b/src/Etterna/MinaCalc/Agnostic/MetaIntervalInfo.h @@ -40,6 +40,28 @@ struct metaItvInfo // end bool basically_vibro = true; + void reset() + { + // at the moment this also resets to default + _itvi.handle_interval_end(); + + _idx = 0; + seriously_not_js = 0; + definitely_not_jacks = 0; + actual_jacks = 0; + actual_jacks_cj = 0; + not_js = 0; + not_hs = 0; + zwop = 0; + shared_chord_jacks = 0; + dunk_it = false; + + row_variations.fill(0); + num_var = 0; + + basically_vibro = 0; + } + void handle_interval_end() { // isn't reset, preserve behavior. this essentially just tracks longer diff --git a/src/Etterna/MinaCalc/Agnostic/MetaRowInfo.h b/src/Etterna/MinaCalc/Agnostic/MetaRowInfo.h index ec033e735c..f70f78d4df 100644 --- a/src/Etterna/MinaCalc/Agnostic/MetaRowInfo.h +++ b/src/Etterna/MinaCalc/Agnostic/MetaRowInfo.h @@ -26,6 +26,23 @@ struct metaRowInfo bool gluts_maybe = false; // not really used/tested yet bool twas_jack = false; + void reset() + { + time = s_init; + ms_now = ms_init; + count = 0; + last_count = 0; + last_last_count = 0; + notes = 0; + last_notes = 0; + last_last_notes = 0; + + alternating_chordstream = false; + alternating_chord_single = false; + gluts_maybe = false; + twas_jack = false; + } + void set_row_variations(metaItvInfo& mitvi) const { // already determined there's enough variation in this interval diff --git a/src/Etterna/MinaCalc/MinaCalc.cpp b/src/Etterna/MinaCalc/MinaCalc.cpp index c1037e10e6..1ef6bd971d 100644 --- a/src/Etterna/MinaCalc/MinaCalc.cpp +++ b/src/Etterna/MinaCalc/MinaCalc.cpp @@ -915,7 +915,7 @@ MinaSDCalcDebug( } } -int mina_calc_version = 436; +int mina_calc_version = 437; auto GetCalcVersion() -> int { diff --git a/src/Etterna/MinaCalc/Ulbu.h b/src/Etterna/MinaCalc/Ulbu.h index a7fd25b4a3..ee517dbf9b 100644 --- a/src/Etterna/MinaCalc/Ulbu.h +++ b/src/Etterna/MinaCalc/Ulbu.h @@ -130,6 +130,8 @@ struct TheGreatBazoinkazoinkInTheSky // should redundant but w.e not sure full_hand_reset(); + full_agnostic_reset(); + reset_row_sequencing(); run_agnostic_pmod_loop(); run_dependent_pmod_loop(); @@ -154,6 +156,12 @@ struct TheGreatBazoinkazoinkInTheSky _tt2.setup(); } + void full_agnostic_reset() + { + _mri.get()->reset(); + _last_mri.get()->reset(); + } + void set_agnostic_pmods(const int& itv) { /* these pattern mods operate on all columns, only need basic meta @@ -293,6 +301,11 @@ struct TheGreatBazoinkazoinkInTheSky _diffz.full_reset(); } + void reset_row_sequencing() + { + _mitvi.reset(); + } + void handle_dependent_interval_end(const int& itv) { /* this calls itvhi's interval end, which is what updates the hand