MCPcopy Create free account
hub / github.com/OpenDUNE/OpenDUNE / Structure_GetStructuresBuilt

Function Structure_GetStructuresBuilt

src/structure.c:697–725  ·  view source on GitHub ↗

* Get a bitmask of all built structure types for the given House. * * @param h The house to get built structures for. * @return The bitmask. */

Source from the content-addressed store, hash-verified

695 * @return The bitmask.
696 */
697uint32 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.

Callers 4

Structure_PlaceFunction · 0.85
Structure_RemoveFunction · 0.85
Unit_EnterStructureFunction · 0.85
Game_PrepareFunction · 0.85

Calls 1

Structure_FindFunction · 0.85

Tested by

no test coverage detected