| 1153 | } |
| 1154 | |
| 1155 | void MapExtras::Block::init_item_counts() |
| 1156 | { |
| 1157 | if (item_counts) return; |
| 1158 | |
| 1159 | item_counts = new T_item_counts[16]; |
| 1160 | memset(item_counts, 0, sizeof(T_item_counts)*16); |
| 1161 | |
| 1162 | if (!block) return; |
| 1163 | |
| 1164 | for (size_t i = 0; i < block->items.size(); i++) |
| 1165 | { |
| 1166 | auto it = df::item::find(block->items[i]); |
| 1167 | if (!it || !it->flags.bits.on_ground) |
| 1168 | continue; |
| 1169 | |
| 1170 | df::coord tidx = it->pos - block->map_pos; |
| 1171 | if (!is_valid_tile_coord(tidx) || tidx.z != 0) |
| 1172 | continue; |
| 1173 | |
| 1174 | item_counts[tidx.x][tidx.y]++; |
| 1175 | } |
| 1176 | } |
| 1177 | |
| 1178 | bool MapExtras::Block::addItemOnGround(df::item *item) |
| 1179 | { |
nothing calls this directly
no test coverage detected