Skip to content

Useless condition in Compute_Total_Height #1091

@xezon

Description

@xezon
void Compute_Total_Height(GameWindow *list_box)
{
    int total_height = 0;
    _ListboxData *data = static_cast<_ListboxData *>(list_box->Win_Get_User_Data());
    WinInstanceData *instance_data = list_box->Win_Get_Instance_Data();

    for (int i = 0; i < data->m_endPos; i++) {
        if (data->m_listData[i].m_cell == nullptr) {
            continue;
        }

        int height = 0;

        for (int j = 0; j < data->m_columns; j++) {
            int new_height = 0;

            if (data->m_listData[i].m_cell[j].m_cellType != LISTBOX_TEXT) {
                if (data->m_listData[i].m_cell[j].m_cellType != LISTBOX_IMAGE) {
                    if (new_height > height) {
                        height = new_height;
                    }

                    continue;
                }
...

It looks as if the

                    if (new_height > height) {
                        height = new_height;
                    }

part is useless. Both new_height and height will always be 0, so this condition can never be true.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions