Revert "fix: optimization: Various PVS-Studio warnings"
This commit is contained in:
@@ -44,7 +44,8 @@ GUI::GUI() {
|
||||
container->add(tooltip);
|
||||
}
|
||||
|
||||
GUI::~GUI() = default;
|
||||
GUI::~GUI() {
|
||||
}
|
||||
|
||||
std::shared_ptr<Menu> GUI::getMenu() {
|
||||
return menu;
|
||||
|
||||
@@ -52,7 +52,7 @@ InventoryBuilder::InventoryBuilder() {
|
||||
|
||||
void InventoryBuilder::addGrid(
|
||||
int cols, int count,
|
||||
const glm::vec2 &pos,
|
||||
glm::vec2 pos,
|
||||
int padding,
|
||||
bool addpanel,
|
||||
const SlotLayout& slotLayout
|
||||
@@ -126,7 +126,7 @@ void SlotView::draw(const DrawContext* pctx, Assets* assets) {
|
||||
langs::get(util::str2wstr_utf8(def->caption))
|
||||
);
|
||||
} else {
|
||||
tooltip.clear();
|
||||
tooltip = L"";
|
||||
}
|
||||
}
|
||||
prevItem = itemid;
|
||||
@@ -381,7 +381,7 @@ void InventoryView::setPos(glm::vec2 pos) {
|
||||
Container::setPos(pos - origin);
|
||||
}
|
||||
|
||||
void InventoryView::setOrigin(const glm::vec2 &origin) {
|
||||
void InventoryView::setOrigin(glm::vec2 origin) {
|
||||
this->origin = origin;
|
||||
}
|
||||
|
||||
|
||||
@@ -93,7 +93,7 @@ namespace gui {
|
||||
|
||||
virtual void setPos(glm::vec2 pos) override;
|
||||
|
||||
void setOrigin(const glm::vec2 &origin);
|
||||
void setOrigin(glm::vec2 origin);
|
||||
glm::vec2 getOrigin() const;
|
||||
|
||||
void setSelected(int index);
|
||||
@@ -130,7 +130,7 @@ namespace gui {
|
||||
/// @param slotLayout slot settings (index and position are ignored)
|
||||
void addGrid(
|
||||
int cols, int count,
|
||||
const glm::vec2 &pos,
|
||||
glm::vec2 pos,
|
||||
int padding,
|
||||
bool addpanel,
|
||||
const SlotLayout& slotLayout
|
||||
|
||||
@@ -145,7 +145,7 @@ uint Label::getLineByYOffset(int offset) const {
|
||||
|
||||
uint Label::getLineByTextIndex(size_t index) const {
|
||||
for (size_t i = 0; i < cache.lines.size(); i++) {
|
||||
if (cache.lines[i].offset > index) {
|
||||
if (cache.lines.at(i).offset > index) {
|
||||
return i-1;
|
||||
}
|
||||
}
|
||||
@@ -195,7 +195,7 @@ void Label::draw(const DrawContext* pctx, Assets* assets) {
|
||||
|
||||
if (multiline) {
|
||||
for (size_t i = 0; i < cache.lines.size(); i++) {
|
||||
auto& line = cache.lines[i];
|
||||
auto& line = cache.lines.at(i);
|
||||
size_t offset = line.offset;
|
||||
std::wstring_view view(text.c_str()+offset, text.length()-offset);
|
||||
if (i < cache.lines.size()-1) {
|
||||
|
||||
@@ -203,7 +203,7 @@ static void _readPanel(UiXmlReader& reader, const xml::xmlelement& element, Pane
|
||||
panel.setMaxLength(element->attr("max-length").asInt());
|
||||
}
|
||||
if (element->has("orientation")) {
|
||||
const auto &oname = element->attr("orientation").getText();
|
||||
auto oname = element->attr("orientation").getText();
|
||||
if (oname == "horizontal") {
|
||||
panel.setOrientation(Orientation::horizontal);
|
||||
}
|
||||
@@ -286,7 +286,7 @@ static std::shared_ptr<UINode> readButton(UiXmlReader& reader, const xml::xmlele
|
||||
|
||||
std::shared_ptr<Button> button;
|
||||
auto& elements = element->getElements();
|
||||
if (!elements.empty() && elements[0]->getTag() != "#") {
|
||||
if (!elements.empty() && elements.at(0)->getTag() != "#") {
|
||||
auto inner = reader.readUINode(element->getElements().at(0));
|
||||
if (inner != nullptr) {
|
||||
button = std::make_shared<Button>(inner, padding);
|
||||
|
||||
Reference in New Issue
Block a user