Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit d07e55f

Browse files
committed
don't call jitems items; it's just confusing
1 parent 13b8c92 commit d07e55f

6 files changed

Lines changed: 29 additions & 30 deletions

File tree

library/include/modules/Items.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ namespace DFHack
9393
bool find(const std::string &token);
9494

9595
bool matches(df::job_item_vector_id vec_id);
96-
bool matches(const df::job_item &item, MaterialInfo *mat = NULL,
96+
bool matches(const df::job_item &jitem, MaterialInfo *mat = NULL,
9797
bool skip_vector = false,
9898
df::item_type itype = df::item_type::NONE);
9999
};

library/include/modules/Materials.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ namespace DFHack
152152

153153
bool matches(const df::job_material_category &cat) const;
154154
bool matches(const df::dfhack_material_category &cat) const;
155-
bool matches(const df::job_item &item,
155+
bool matches(const df::job_item &jitem,
156156
df::item_type itype = df::item_type::NONE) const;
157157
};
158158

library/modules/Items.cpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -300,18 +300,18 @@ bool ItemTypeInfo::matches(df::job_item_vector_id vec_id)
300300
return true;
301301
}
302302

303-
bool ItemTypeInfo::matches(const df::job_item &item, MaterialInfo *mat,
303+
bool ItemTypeInfo::matches(const df::job_item &jitem, MaterialInfo *mat,
304304
bool skip_vector, df::item_type itype)
305305
{
306306
using namespace df::enums::item_type;
307307

308308
if (!isValid())
309-
return mat ? mat->matches(item, itype) : false;
309+
return mat ? mat->matches(jitem, itype) : false;
310310

311311
if (Items::isCasteMaterial(type) && mat && !mat->isNone())
312312
return false;
313313

314-
if (!skip_vector && !matches(item.vector_id))
314+
if (!skip_vector && !matches(jitem.vector_id))
315315
return false;
316316

317317
df::job_item_flags1 ok1, mask1, item_ok1, item_mask1, xmask1;
@@ -504,12 +504,12 @@ bool ItemTypeInfo::matches(const df::job_item &item, MaterialInfo *mat,
504504
mask1.whole &= ~xmask1.whole;
505505
mask2.whole &= ~xmask2.whole;
506506

507-
return bits_match(item.flags1.whole, ok1.whole, mask1.whole) &&
508-
bits_match(item.flags2.whole, ok2.whole, mask2.whole) &&
509-
bits_match(item.flags3.whole, ok3.whole, mask3.whole) &&
510-
bits_match(item.flags1.whole, item_ok1.whole, item_mask1.whole) &&
511-
bits_match(item.flags2.whole, item_ok2.whole, item_mask2.whole) &&
512-
bits_match(item.flags3.whole, item_ok3.whole, item_mask3.whole);
507+
return bits_match(jitem.flags1.whole, ok1.whole, mask1.whole) &&
508+
bits_match(jitem.flags2.whole, ok2.whole, mask2.whole) &&
509+
bits_match(jitem.flags3.whole, ok3.whole, mask3.whole) &&
510+
bits_match(jitem.flags1.whole, item_ok1.whole, item_mask1.whole) &&
511+
bits_match(jitem.flags2.whole, item_ok2.whole, item_mask2.whole) &&
512+
bits_match(jitem.flags3.whole, item_ok3.whole, item_mask3.whole);
513513
}
514514

515515
df::item * Items::findItemByID(int32_t id)

library/modules/Job.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -578,31 +578,31 @@ bool DFHack::Job::attachJobItem(df::job *job, df::item *item,
578578
return true;
579579
}
580580

581-
bool Job::isSuitableItem(const df::job_item *item, df::item_type itype, int isubtype)
581+
bool Job::isSuitableItem(const df::job_item *jitem, df::item_type itype, int isubtype)
582582
{
583-
CHECK_NULL_POINTER(item);
583+
CHECK_NULL_POINTER(jitem);
584584

585585
if (itype == item_type::NONE)
586586
return true;
587587

588588
ItemTypeInfo iinfo(itype, isubtype);
589-
MaterialInfo minfo(item);
589+
MaterialInfo minfo(jitem);
590590

591-
return iinfo.isValid() && iinfo.matches(*item, &minfo, false, itype);
591+
return iinfo.isValid() && iinfo.matches(*jitem, &minfo, false, itype);
592592
}
593593

594594
bool Job::isSuitableMaterial(
595-
const df::job_item *item, int mat_type, int mat_index, df::item_type itype)
595+
const df::job_item *jitem, int mat_type, int mat_index, df::item_type itype)
596596
{
597-
CHECK_NULL_POINTER(item);
597+
CHECK_NULL_POINTER(jitem);
598598

599599
if (mat_type == -1 && mat_index == -1)
600600
return true;
601601

602-
ItemTypeInfo iinfo(item);
602+
ItemTypeInfo iinfo(jitem);
603603
MaterialInfo minfo(mat_type, mat_index);
604604

605-
return minfo.isValid() && iinfo.matches(*item, &minfo, false, itype);
605+
return minfo.isValid() && iinfo.matches(*jitem, &minfo, false, itype);
606606
}
607607

608608
std::string Job::getName(df::job *job)

library/modules/Materials.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -443,7 +443,7 @@ bool MaterialInfo::matches(const df::dfhack_material_category &cat) const
443443

444444
#undef TEST
445445

446-
bool MaterialInfo::matches(const df::job_item &item, df::item_type itype) const
446+
bool MaterialInfo::matches(const df::job_item &jitem, df::item_type itype) const
447447
{
448448
if (!isValid()) return false;
449449

@@ -459,9 +459,9 @@ bool MaterialInfo::matches(const df::job_item &item, df::item_type itype) const
459459
xmask2.bits.non_economic = itype != df::item_type::BOULDER;
460460
mask2.whole &= ~xmask2.whole;
461461

462-
return bits_match(item.flags1.whole, ok1.whole, mask1.whole) &&
463-
bits_match(item.flags2.whole, ok2.whole, mask2.whole) &&
464-
bits_match(item.flags3.whole, ok3.whole, mask3.whole);
462+
return bits_match(jitem.flags1.whole, ok1.whole, mask1.whole) &&
463+
bits_match(jitem.flags2.whole, ok2.whole, mask2.whole) &&
464+
bits_match(jitem.flags3.whole, ok3.whole, mask3.whole);
465465
}
466466

467467
void MaterialInfo::getMatchBits(df::job_item_flags1 &ok, df::job_item_flags1 &mask) const

plugins/buildingplan/buildingplan_cycle.cpp

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -144,23 +144,22 @@ bool matchesFilters(df::item * item, const df::job_item * jitem, HeatSafety heat
144144
&& !item->hasToolUse(jitem->has_tool_use))
145145
return false;
146146

147-
if (item->getType() == df::item_type::SLAB && specials.count("engraved")
147+
auto itype = item->getType();
148+
149+
if (itype == df::item_type::SLAB && specials.count("engraved")
148150
&& static_cast<df::item_slabst *>(item)->engraving_type != df::slab_engraving_type::Memorial)
149151
return false;
150152

151-
if (item->getType() == df::item_type::CAGE && specials.count("empty")
153+
if (itype == df::item_type::CAGE && specials.count("empty")
152154
&& (Items::getGeneralRef(item, df::general_ref_type::CONTAINS_UNIT)
153155
|| Items::getGeneralRef(item, df::general_ref_type::CONTAINS_ITEM)))
154156
return false;
155157

156158
if (!matchesHeatSafety(item->getMaterial(), item->getMaterialIndex(), heat))
157159
return false;
158160

159-
return Job::isSuitableItem(
160-
jitem, item->getType(), item->getSubtype())
161-
&& Job::isSuitableMaterial(
162-
jitem, item->getMaterial(), item->getMaterialIndex(),
163-
item->getType())
161+
return Job::isSuitableItem(jitem, itype, item->getSubtype())
162+
&& Job::isSuitableMaterial(jitem, item->getMaterial(), item->getMaterialIndex(), itype)
164163
&& item_filter.matches(item);
165164
}
166165

0 commit comments

Comments
 (0)