Recast: fix toggle for all polygon flags

1<<16 will overflow u16 by 1.
This commit is contained in:
Kawe Mazidjatari 2024-09-16 11:49:21 +02:00
parent ebd89d934f
commit dbdafd44e4

View File

@ -127,10 +127,12 @@ void ConvexVolumeTool::handleMenu()
ImGui::Text("Poly Flags");
ImGui::Indent();
for (int i = 0; i < V_ARRAYSIZE(g_navMeshPolyFlagNames); i++)
const int numPolyFlags = V_ARRAYSIZE(g_navMeshPolyFlagNames);
for (int i = 0; i < numPolyFlags; i++)
{
const char* flagName = g_navMeshPolyFlagNames[i];
ImGui::CheckboxFlags(flagName, &m_polyFlags, 1<<i);
ImGui::CheckboxFlags(flagName, &m_polyFlags, i == (numPolyFlags-1) ? EDITOR_POLYFLAGS_ALL : 1<<i);
}
ImGui::Unindent();