Application: improve how invalid IDs are handled.
This commit is contained in:
parent
9469518a4e
commit
9629047fbc
1 changed files with 3 additions and 3 deletions
|
@ -467,8 +467,8 @@ Application::drawWeaponEditor(GameObjects::Weapon& weapon) {
|
||||||
if(map->find(part.id) != map->cend()) {
|
if(map->find(part.id) != map->cend()) {
|
||||||
ImGui::TextUnformatted(map->at(part.id).cbegin(), map->at(part.id).cend());
|
ImGui::TextUnformatted(map->at(part.id).cbegin(), map->at(part.id).cend());
|
||||||
}
|
}
|
||||||
else if(part.id == -1) {
|
else if(part.id < 0) {
|
||||||
ImGui::TextUnformatted("<none>");
|
ImGui::TextUnformatted("<invalid part ID>");
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
ImGui::Text("ID: %i", part.id);
|
ImGui::Text("ID: %i", part.id);
|
||||||
|
@ -498,7 +498,7 @@ Application::drawWeaponEditor(GameObjects::Weapon& weapon) {
|
||||||
|
|
||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
if(ImGui::SmallButton("Hide part " ICON_FA_QUESTION_CIRCLE)) {
|
if(ImGui::SmallButton("Hide part " ICON_FA_QUESTION_CIRCLE)) {
|
||||||
part.id = 96 + (part.id / 100) * 100;
|
part.id = 96 + part.id >= 0 ? (part.id / 100) * 100 : 0;
|
||||||
}
|
}
|
||||||
drawTooltip(_selectedWeaponPart == 0 ?
|
drawTooltip(_selectedWeaponPart == 0 ?
|
||||||
"This will hide the selected part, but not its accessories. "
|
"This will hide the selected part, but not its accessories. "
|
||||||
|
|
Loading…
Reference in a new issue