Add a Lua method for forcing recalculation of GrooveStats hash.

This commit is contained in:
Michael Votaw
2025-03-23 01:26:45 -07:00
committed by teejusb
parent a70f1a015a
commit c845205de5
2 changed files with 12 additions and 4 deletions
+11 -3
View File
@@ -783,9 +783,9 @@ const RString Steps::GetGrooveStatsHash() const
return GrooveStatsHash; return GrooveStatsHash;
} }
void Steps::CalculateGrooveStatsHash() void Steps::CalculateGrooveStatsHash(bool forceRecalculate)
{ {
if (m_bIsCachedGrooveStatsHashJustLoaded == true) if (!forceRecalculate && m_bIsCachedGrooveStatsHashJustLoaded == true)
{ {
m_bIsCachedGrooveStatsHashJustLoaded = false; m_bIsCachedGrooveStatsHashJustLoaded = false;
return; return;
@@ -1167,12 +1167,19 @@ public:
{ {
if(p->GetGrooveStatsHash().empty()) if(p->GetGrooveStatsHash().empty())
{ {
p->CalculateGrooveStatsHash(); p->CalculateGrooveStatsHash(true);
} }
lua_pushstring(L, p->GetGrooveStatsHash()); lua_pushstring(L, p->GetGrooveStatsHash());
return 1; return 1;
} }
static int CalculateGrooveStatsHash(T *p, lua_State *L)
{
p->CalculateGrooveStatsHash(true);
lua_pushstring(L, p->GetGrooveStatsHash());
return 1;
}
static int GetChartName(T *p, lua_State *L) static int GetChartName(T *p, lua_State *L)
{ {
lua_pushstring(L, p->GetChartName()); lua_pushstring(L, p->GetChartName());
@@ -1270,6 +1277,7 @@ public:
ADD_METHOD( GetHash ); ADD_METHOD( GetHash );
ADD_METHOD( GetMinimizedChartString ); ADD_METHOD( GetMinimizedChartString );
ADD_METHOD( GetGrooveStatsHash ); ADD_METHOD( GetGrooveStatsHash );
ADD_METHOD( CalculateGrooveStatsHash );
ADD_METHOD( GetMeter ); ADD_METHOD( GetMeter );
ADD_METHOD( HasSignificantTimingChanges ); ADD_METHOD( HasSignificantTimingChanges );
ADD_METHOD( HasAttacks ); ADD_METHOD( HasAttacks );
+1 -1
View File
@@ -140,7 +140,7 @@ public:
RString MinimizedChartString(); RString MinimizedChartString();
/** @brief Generates a hash used for GrooveStats integration. */ /** @brief Generates a hash used for GrooveStats integration. */
void CalculateGrooveStatsHash(); void CalculateGrooveStatsHash(bool forceRecalculate);
const RString GetGrooveStatsHash() const; const RString GetGrooveStatsHash() const;
/** @brief Produces a chart that's reduced to it's smallest unique representable form. */ /** @brief Produces a chart that's reduced to it's smallest unique representable form. */