| 996 | } |
| 997 | |
| 998 | void AIGroup::SendState(RadioMessageState* msg, bool silent) |
| 999 | { |
| 1000 | // usually called with new |
| 1001 | // if message is not queued we have the only reference to the message |
| 1002 | Ref<RadioMessageState> ref = msg; |
| 1003 | AIUnit* leader = Leader(); |
| 1004 | for (int i = 0; i < MAX_UNITS_PER_GROUP; i++) |
| 1005 | { |
| 1006 | AIUnit* unit = UnitWithID(i + 1); |
| 1007 | if (!unit) |
| 1008 | { |
| 1009 | continue; |
| 1010 | } |
| 1011 | if (!msg->IsTo(unit)) |
| 1012 | { |
| 1013 | continue; |
| 1014 | } |
| 1015 | |
| 1016 | if (!leader || unit == leader || silent) |
| 1017 | { |
| 1018 | // leader command is executed directly |
| 1019 | Ref<RadioMessageState> temp = msg->Clone(); |
| 1020 | temp->ClearTo(); |
| 1021 | temp->AddTo(unit); |
| 1022 | temp->Transmitted(); |
| 1023 | msg->DeleteTo(unit); |
| 1024 | continue; |
| 1025 | } |
| 1026 | } |
| 1027 | if (leader && msg->IsToSomeone()) |
| 1028 | { |
| 1029 | GetRadio().Transmit(msg, GetCenter()->GetLanguage()); |
| 1030 | } |
| 1031 | } |
| 1032 | |
| 1033 | void AIGroup::SendReportStatus(PackedBoolArray list) |
| 1034 | { |
no test coverage detected