| 705 | std::map<DFCoord, uint16_t> spatterHashes; |
| 706 | |
| 707 | bool IsspatterChanged(DFCoord pos) |
| 708 | { |
| 709 | df::map_block * block = Maps::getBlock(pos); |
| 710 | std::vector<df::block_square_event_material_spatterst *> materials; |
| 711 | #if DF_VERSION_INT > 34011 |
| 712 | std::vector<df::block_square_event_item_spatterst *> items; |
| 713 | if (!Maps::SortBlockEvents(block, NULL, NULL, &materials, NULL, NULL, NULL, &items)) |
| 714 | return false; |
| 715 | #else |
| 716 | if (!Maps::SortBlockEvents(block, NULL, NULL, &materials, NULL, NULL)) |
| 717 | return false; |
| 718 | #endif |
| 719 | |
| 720 | uint16_t hash = 0; |
| 721 | |
| 722 | for (size_t i = 0; i < materials.size(); i++) |
| 723 | { |
| 724 | auto mat = materials[i]; |
| 725 | hash ^= fletcher16((uint8_t*)mat, sizeof(df::block_square_event_material_spatterst)); |
| 726 | } |
| 727 | #if DF_VERSION_INT > 34011 |
| 728 | for (size_t i = 0; i < items.size(); i++) |
| 729 | { |
| 730 | auto item = items[i]; |
| 731 | hash ^= fletcher16((uint8_t*)item, sizeof(df::block_square_event_item_spatterst)); |
| 732 | } |
| 733 | #endif |
| 734 | if (spatterHashes[pos] != hash) |
| 735 | { |
| 736 | spatterHashes[pos] = hash; |
| 737 | return true; |
| 738 | } |
| 739 | return false; |
| 740 | } |
| 741 | |
| 742 | std::map<int, uint16_t> itemHashes; |
| 743 |
no test coverage detected