* The house is under attack in the form of a structure being hit. * @param houseID The house who is being attacked. */
| 1931 | * @param houseID The house who is being attacked. |
| 1932 | */ |
| 1933 | void Structure_HouseUnderAttack(uint8 houseID) |
| 1934 | { |
| 1935 | PoolFindStruct find; |
| 1936 | House *h; |
| 1937 | |
| 1938 | h = House_Get_ByIndex(houseID); |
| 1939 | |
| 1940 | if (houseID != g_playerHouseID && h->flags.doneFullScaleAttack) return; |
| 1941 | h->flags.doneFullScaleAttack = true; |
| 1942 | |
| 1943 | if (h->flags.human) { |
| 1944 | if (h->timerStructureAttack != 0) return; |
| 1945 | |
| 1946 | Sound_Output_Feedback(48); |
| 1947 | |
| 1948 | h->timerStructureAttack = 8; |
| 1949 | return; |
| 1950 | } |
| 1951 | |
| 1952 | /* ENHANCEMENT -- Dune2 originally only searches for units with type 0 (Carry-all). In result, the rest of this function does nothing. */ |
| 1953 | if (!g_dune2_enhanced) return; |
| 1954 | |
| 1955 | find.houseID = houseID; |
| 1956 | find.index = 0xFFFF; |
| 1957 | find.type = 0xFFFF; |
| 1958 | |
| 1959 | while (true) { |
| 1960 | const UnitInfo *ui; |
| 1961 | Unit *u; |
| 1962 | |
| 1963 | u = Unit_Find(&find); |
| 1964 | if (u == NULL) break; |
| 1965 | |
| 1966 | ui = &g_table_unitInfo[u->o.type]; |
| 1967 | |
| 1968 | if (ui->bulletType == UNIT_INVALID) continue; |
| 1969 | |
| 1970 | /* XXX -- Dune2 does something odd here. What was their intention? */ |
| 1971 | if ((u->actionID == ACTION_GUARD && u->actionID == ACTION_AMBUSH) || u->actionID == ACTION_AREA_GUARD) Unit_SetAction(u, ACTION_HUNT); |
| 1972 | } |
| 1973 | } |
| 1974 | |
| 1975 | /** |
| 1976 | * Find the next object to build. |
no test coverage detected