Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Useless condition in Compute_Total_Height #1091

Open
xezon opened this issue Feb 8, 2024 · 0 comments
Open

Useless condition in Compute_Total_Height #1091

xezon opened this issue Feb 8, 2024 · 0 comments

Comments

@xezon
Copy link
Contributor

xezon commented Feb 8, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant