* Get a bitmask of all built structure types for the given House. * * @param h The house to get built structures for. * @return The bitmask. */
| 695 | * @return The bitmask. |
| 696 | */ |
| 697 | uint32 Structure_GetStructuresBuilt(House *h) |
| 698 | { |
| 699 | PoolFindStruct find; |
| 700 | uint32 result; |
| 701 | |
| 702 | if (h == NULL) return 0; |
| 703 | |
| 704 | result = 0; |
| 705 | find.houseID = h->index; |
| 706 | find.index = 0xFFFF; |
| 707 | find.type = 0xFFFF; |
| 708 | |
| 709 | /* Recount windtraps after capture or loading old saved games. */ |
| 710 | h->windtrapCount = 0; |
| 711 | |
| 712 | while (true) { |
| 713 | Structure *s; |
| 714 | |
| 715 | s = Structure_Find(&find); |
| 716 | if (s == NULL) break; |
| 717 | if (s->o.flags.s.isNotOnMap) continue; |
| 718 | if (s->o.type == STRUCTURE_SLAB_1x1 || s->o.type == STRUCTURE_SLAB_2x2 || s->o.type == STRUCTURE_WALL) continue; |
| 719 | result |= 1 << s->o.type; |
| 720 | |
| 721 | if (s->o.type == STRUCTURE_WINDTRAP) h->windtrapCount++; |
| 722 | } |
| 723 | |
| 724 | return result; |
| 725 | } |
| 726 | |
| 727 | /** |
| 728 | * Checks if the given position is a valid location for the given structure type. |
no test coverage detected