Remove needless references in range loops

This commit is contained in:
Luke Street 2021-05-26 19:01:26 -04:00
parent 0e54d55bf7
commit c6a75a242f
1 changed files with 11 additions and 11 deletions

View File

@ -145,8 +145,8 @@ static void ShowInspectWindow(bool* isOpen) {
CObjectList& list = *g_StateManager->GetObjectList(); CObjectList& list = *g_StateManager->GetObjectList();
ImGui::Text("Objects: %d / 1024", list.size()); ImGui::Text("Objects: %d / 1024", list.size());
if (ImGui::Button("Deselect all")) { if (ImGui::Button("Deselect all")) {
for (const auto& item : list) { for (const auto ent : list) {
if (TCastToPtr<CActor> act = item) { if (TCastToPtr<CActor> act = ent) {
act->m_debugSelected = false; act->m_debugSelected = false;
} }
} }
@ -199,11 +199,11 @@ static void ShowInspectWindow(bool* isOpen) {
} }
} }
} }
for (const auto& item : items) { for (const auto ent : items) {
TUniqueId uid = item->GetUniqueId(); TUniqueId uid = ent->GetUniqueId();
ImGui::PushID(uid.Value()); ImGui::PushID(uid.Value());
ImGui::TableNextRow(); ImGui::TableNextRow();
bool isActive = item->GetActive(); bool isActive = ent->GetActive();
if (!isActive) { if (!isActive) {
ImGui::PushStyleColor(ImGuiCol_Text, 0xAAFFFFFF); ImGui::PushStyleColor(ImGuiCol_Text, 0xAAFFFFFF);
} }
@ -211,7 +211,7 @@ static void ShowInspectWindow(bool* isOpen) {
auto text = fmt::format(FMT_STRING("{:x}"), uid.Value()); auto text = fmt::format(FMT_STRING("{:x}"), uid.Value());
bool tmp = false; bool tmp = false;
bool* selected = &tmp; bool* selected = &tmp;
TCastToPtr<CActor> act = item; TCastToPtr<CActor> act = ent;
if (act != nullptr) { if (act != nullptr) {
selected = &act->m_debugSelected; selected = &act->m_debugSelected;
} }
@ -222,7 +222,7 @@ static void ShowInspectWindow(bool* isOpen) {
ImGui::PopStyleColor(); ImGui::PopStyleColor();
} }
if (ImGui::MenuItem(isActive ? "Deactivate" : "Activate")) { if (ImGui::MenuItem(isActive ? "Deactivate" : "Activate")) {
item->SetActive(!isActive); ent->SetActive(!isActive);
} }
ImGui::EndPopup(); ImGui::EndPopup();
if (!isActive) { if (!isActive) {
@ -231,10 +231,10 @@ static void ShowInspectWindow(bool* isOpen) {
} }
} }
if (ImGui::TableNextColumn()) { if (ImGui::TableNextColumn()) {
ImGuiStringViewText(item->ImGuiType()); ImGuiStringViewText(ent->ImGuiType());
} }
if (ImGui::TableNextColumn()) { if (ImGui::TableNextColumn()) {
ImGuiStringViewText(item->GetName()); ImGuiStringViewText(ent->GetName());
} }
if (ImGui::TableNextColumn()) { if (ImGui::TableNextColumn()) {
if (ImGui::SmallButton("View")) { if (ImGui::SmallButton("View")) {
@ -307,8 +307,8 @@ void ImGuiConsole::proc() {
iter++; iter++;
} }
} }
for (const auto& item : *g_StateManager->GetObjectList()) { for (const auto ent : *g_StateManager->GetObjectList()) {
if (TCastToPtr<CActor> act = item) { if (TCastToPtr<CActor> act = ent) {
if (act->m_debugSelected) { if (act->m_debugSelected) {
LerpActorColor(act); LerpActorColor(act);
} }