MCPcopy Create free account
hub / github.com/DFHack/dfhack / addItemOnGround

Method addItemOnGround

library/modules/MapCache.cpp:1178–1200  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1176}
1177
1178bool MapExtras::Block::addItemOnGround(df::item *item)
1179{
1180 if (!block)
1181 return false;
1182
1183 init_item_counts();
1184
1185 bool inserted;
1186 insert_into_vector(block->items, item->id, &inserted);
1187
1188 if (inserted)
1189 {
1190 int &count = index_tile(item_counts,item->pos);
1191
1192 if (count++ == 0)
1193 {
1194 index_tile(occupancy,item->pos).bits.item = true;
1195 index_tile(block->occupancy,item->pos).bits.item = true;
1196 }
1197 }
1198
1199 return inserted;
1200}
1201
1202bool MapExtras::Block::removeItemOnGround(df::item *item)
1203{

Callers

nothing calls this directly

Calls 3

insert_into_vectorFunction · 0.85
index_tileFunction · 0.85
BlockAtTileFunction · 0.85

Tested by

no test coverage detected