Skip to content

Commit 6795a4a

Browse files
committed
Further simplify check for engraved slabs
1 parent 27ff6c9 commit 6795a4a

1 file changed

Lines changed: 4 additions & 12 deletions

File tree

plugins/autoslab.cpp

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -193,13 +193,6 @@ static void checkslabs(color_ostream &out)
193193
histToJob[order->hist_figure_id] = order->id;
194194
}
195195

196-
// Get list of engraved slab items on map
197-
std::vector<df::item *> engravedSlabs;
198-
std::copy_if(world->items.all.begin(), world->items.all.end(),
199-
std::back_inserter(engravedSlabs),
200-
[](df::item *item)
201-
{ return item->getType() == df::item_type::SLAB && item->getSlabEngravingType() == df::slab_engraving_type::Memorial; });
202-
203196
// Build list of ghosts
204197
std::vector<df::unit *> ghosts;
205198
std::copy_if(world->units.all.begin(), world->units.all.end(),
@@ -211,11 +204,10 @@ static void checkslabs(color_ostream &out)
211204
{
212205
// Only create a job is the map has no existing jobs for that historical figure or no existing engraved slabs
213206
if (histToJob.count(ghost->hist_figure_id) == 0 &&
214-
!std::any_of(engravedSlabs.begin(),
215-
engravedSlabs.end(),
216-
[&ghost](df::item *slab){
217-
auto slabst = virtual_cast<df::item_slabst>(slab);
218-
return slabst->topic == ghost->hist_figure_id;
207+
!std::any_of(world->items.other.SLAB.begin(),
208+
world->items.other.SLAB.end(),
209+
[&ghost,&out](df::item_slabst *slab){
210+
return slab->engraving_type == df::slab_engraving_type::Memorial && slab->topic == ghost->hist_figure_id;
219211
})
220212
)
221213
{

0 commit comments

Comments
 (0)