Skip to content

Commit

Permalink
fully reset meta row/hand/interval info
Browse files Browse the repository at this point in the history
fixes an issue with persistent calc information leaking into calculations on new files -> 437
  • Loading branch information
poco0317 committed Jul 21, 2020
1 parent 1d205c7 commit 0b7a28d
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 1 deletion.
22 changes: 22 additions & 0 deletions src/Etterna/MinaCalc/Agnostic/MetaIntervalInfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
17 changes: 17 additions & 0 deletions src/Etterna/MinaCalc/Agnostic/MetaRowInfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/Etterna/MinaCalc/MinaCalc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -915,7 +915,7 @@ MinaSDCalcDebug(
}
}

int mina_calc_version = 436;
int mina_calc_version = 437;
auto
GetCalcVersion() -> int
{
Expand Down
13 changes: 13 additions & 0 deletions src/Etterna/MinaCalc/Ulbu.h
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 0b7a28d

Please sign in to comment.