| 973 | } |
| 974 | |
| 975 | void Building::underAttack(GameState &state, StateRef<Organisation> attacker) |
| 976 | { |
| 977 | if (owner->isRelatedTo(attacker) == Organisation::Relation::Hostile) |
| 978 | { |
| 979 | std::list<StateRef<Vehicle>> toLaunch; |
| 980 | for (auto v : currentVehicles) |
| 981 | { |
| 982 | toLaunch.push_back(v); |
| 983 | } |
| 984 | for (auto v : toLaunch) |
| 985 | { |
| 986 | v->setMission(state, VehicleMission::patrol(state, *v, true, 5)); |
| 987 | } |
| 988 | if (timeOfLastAttackEvent + TICKS_ATTACK_EVENT_TIMEOUT < state.gameTime.getTicks()) |
| 989 | { |
| 990 | timeOfLastAttackEvent = state.gameTime.getTicks(); |
| 991 | fw().pushEvent(new GameBuildingEvent(GameEventType::BuildingAttacked, |
| 992 | {&state, shared_from_this()}, attacker)); |
| 993 | } |
| 994 | } |
| 995 | } |
| 996 | |
| 997 | void Building::collapse(GameState &state) |
| 998 | { |
no test coverage detected