Implement/match HistoryBook::~HistoryBook (#1139)

This commit is contained in:
Christian Semmler 2024-11-10 09:07:48 -07:00 committed by GitHub
parent 0b94b4803b
commit 40159b43c7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 28 additions and 2 deletions

View file

@ -131,6 +131,9 @@ class LegoGameState {
void WriteScoreHistory(); void WriteScoreHistory();
void FUN_1003ccf0(LegoFile&); 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]; } ScoreItem* GetScore(MxS16 p_index) { return p_index >= m_count ? NULL : &m_scores[p_index]; }
MxS16 m_count; // 0x00 MxS16 m_count; // 0x00

View file

@ -21,10 +21,33 @@ HistoryBook::HistoryBook()
NotificationManager()->Register(this); NotificationManager()->Register(this);
} }
// STUB: LEGO1 0x100824d0 // FUNCTION: LEGO1 0x100824d0
// FUNCTION: BETA10 0x1002b63e
HistoryBook::~HistoryBook() 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 // FUNCTION: LEGO1 0x10082610