diff --git a/LEGO1/lego/legoomni/include/legogamestate.h b/LEGO1/lego/legoomni/include/legogamestate.h index dc26f8c3..d17e8e2c 100644 --- a/LEGO1/lego/legoomni/include/legogamestate.h +++ b/LEGO1/lego/legoomni/include/legogamestate.h @@ -131,6 +131,9 @@ class LegoGameState { void WriteScoreHistory(); void FUN_1003ccf0(LegoFile&); + // FUNCTION: BETA10 0x1002c2b0 + MxS16 GetCount() { return m_count; } + ScoreItem* GetScore(MxS16 p_index) { return p_index >= m_count ? NULL : &m_scores[p_index]; } MxS16 m_count; // 0x00 diff --git a/LEGO1/lego/legoomni/src/worlds/historybook.cpp b/LEGO1/lego/legoomni/src/worlds/historybook.cpp index bec6764f..e9ca3b4d 100644 --- a/LEGO1/lego/legoomni/src/worlds/historybook.cpp +++ b/LEGO1/lego/legoomni/src/worlds/historybook.cpp @@ -21,10 +21,33 @@ HistoryBook::HistoryBook() NotificationManager()->Register(this); } -// STUB: LEGO1 0x100824d0 +// FUNCTION: LEGO1 0x100824d0 +// FUNCTION: BETA10 0x1002b63e HistoryBook::~HistoryBook() { - // TODO + for (MxS16 scoreIndex = 0; scoreIndex < GameState()->m_history.GetCount(); scoreIndex++) { + if (m_scores[scoreIndex]) { + delete m_scores[scoreIndex]->GetAction(); + delete m_scores[scoreIndex]; + m_scores[scoreIndex] = NULL; + } + + for (MxS16 letterIndex = 0; letterIndex < (MxS16) sizeOfArray(m_names[0]); letterIndex++) { + if (m_names[scoreIndex][letterIndex]) { + delete m_names[scoreIndex][letterIndex]->GetAction(); + delete m_names[scoreIndex][letterIndex]; + m_names[scoreIndex][letterIndex] = NULL; + } + } + } + + InputManager()->UnRegister(this); + if (InputManager()->GetWorld() == this) { + InputManager()->ClearWorld(); + } + + ControlManager()->Unregister(this); + NotificationManager()->Unregister(this); } // FUNCTION: LEGO1 0x10082610