Skip to content

Commit

Permalink
refact/improv: items.cpp and usages
Browse files Browse the repository at this point in the history
  • Loading branch information
phacUFPE committed Jun 5, 2024
1 parent 549e363 commit 6bd2b4d
Show file tree
Hide file tree
Showing 10 changed files with 96 additions and 95 deletions.
4 changes: 2 additions & 2 deletions source/carpet_brush.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ bool CarpetBrush::load(pugi::xml_node node, wxArrayString &warnings) {

int32_t chance = attribute.as_int();

ItemType* type = g_items.getRawItemType(id);
auto type = g_items.getRawItemType(id);
if (!type) {
warnings.push_back("There is no itemtype with id " + std::to_string(id));
continue;
Expand Down Expand Up @@ -117,7 +117,7 @@ bool CarpetBrush::load(pugi::xml_node node, wxArrayString &warnings) {
}

uint16_t id = attribute.as_uint();
ItemType* type = g_items.getRawItemType(id);
auto type = g_items.getRawItemType(id);
if (!type) {
warnings.push_back("There is no itemtype with id " + std::to_string(id));
return false;
Expand Down
4 changes: 2 additions & 2 deletions source/doodad_brush.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ bool DoodadBrush::loadAlternative(pugi::xml_node node, wxArrayString &warnings,
continue;
}

ItemType* type = g_items.getRawItemType(item->getID());
auto type = g_items.getRawItemType(item->getID());
if (type) {
type->doodad_brush = this;
}
Expand Down Expand Up @@ -147,7 +147,7 @@ bool DoodadBrush::loadAlternative(pugi::xml_node node, wxArrayString &warnings,
if (item) {
items.push_back(item);

ItemType* type = g_items.getRawItemType(item->getID());
auto type = g_items.getRawItemType(item->getID());
if (type) {
type->doodad_brush = this;
}
Expand Down
10 changes: 5 additions & 5 deletions source/ground_brush.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ bool AutoBorder::load(pugi::xml_node node, wxArrayString &warnings, GroundBrush*

const std::string &orientation = attribute.as_string();

ItemType* type = g_items.getRawItemType(itemid);
auto type = g_items.getRawItemType(itemid);
if (!type) {
warnings.push_back("Invalid item ID " + std::to_string(itemid) + " for border " + std::to_string(id));
continue;
Expand All @@ -91,7 +91,7 @@ bool AutoBorder::load(pugi::xml_node node, wxArrayString &warnings, GroundBrush*
type->ground_equivalent = ground_equivalent;
type->brush = owner;

ItemType* type2 = g_items.getRawItemType(ground_equivalent);
auto type2 = g_items.getRawItemType(ground_equivalent);
type2->has_equivalent = type2->id != 0;
}

Expand Down Expand Up @@ -166,7 +166,7 @@ bool GroundBrush::load(pugi::xml_node node, wxArrayString &warnings) {
uint16_t itemId = childNode.attribute("id").as_uint();
int32_t chance = childNode.attribute("chance").as_int();

ItemType* type = g_items.getRawItemType(itemId);
auto type = g_items.getRawItemType(itemId);
if (!type) {
warnings.push_back("\nInvalid item id " + std::to_string(itemId));
return false;
Expand Down Expand Up @@ -416,7 +416,7 @@ bool GroundBrush::load(pugi::xml_node node, wxArrayString &warnings) {
AutoBorder* autoBorder = itt->second;
ASSERT(autoBorder != nullptr);

ItemType* type = g_items.getRawItemType(with_id);
auto type = g_items.getRawItemType(with_id);
if (!type) {
return false;
}
Expand All @@ -439,7 +439,7 @@ bool GroundBrush::load(pugi::xml_node node, wxArrayString &warnings) {
}

int32_t with_id = attribute.as_int();
ItemType* type = g_items.getRawItemType(with_id);
auto type = g_items.getRawItemType(with_id);
if (!type) {
return false;
}
Expand Down
Loading

0 comments on commit 6bd2b4d

Please sign in to comment.