TheAssemblyArmada / Thyme

An open source re-implementation of Generals : Zero Hour written in C++.
GNU General Public License v2.0
584 stars 59 forks source link

Misc optimizations in InGameUI #1070

Open xezon opened 9 months ago

xezon commented 9 months ago

1

InGameUI::InGameUI()
...
    m_placeIcon = new Drawable *[g_theWriteableGlobalData->m_maxLineBuildObjects];

    for (int i = 0; i < g_theWriteableGlobalData->m_maxLineBuildObjects; i++) {
        m_placeIcon[i] = nullptr;
    }

Can be rewritten as.

    m_placeIcon = new Drawable *[g_theWriteableGlobalData->m_maxLineBuildObjects]();

2

InGameUI::InGameUI()
...
    m_currentlyPlayingMovie.Clear();
...
    for (int i = 0; i < MAX_UI_MESSAGES; i++) {
        m_uiMessages[i].full_text.Clear();
        m_uiMessages[i].display_string = nullptr;
        m_uiMessages[i].timestamp = 0;
        m_uiMessages[i].color = 0;
    }
FloatingTextData::FloatingTextData()
...
    m_text.Clear();

Clear() in constructors are obsolete.