Communication with group
| 1861 | } |
| 1862 | |
| 1863 | // Communication with group |
| 1864 | void AISubgroup::ReceiveCommand(Command& cmd) |
| 1865 | { |
| 1866 | #if LOG_COMM |
| 1867 | char buffer[256]; |
| 1868 | CreateUnitsList(GetUnitsList(), buffer); |
| 1869 | Log("Receive command: Subgroup %s (%s): Command %d (context %d)", (const char*)GetDebugName(), buffer, cmd._message, |
| 1870 | cmd._context); |
| 1871 | #endif |
| 1872 | |
| 1873 | AI_ERROR(cmd._id >= 0); |
| 1874 | SetDiscretion(cmd._discretion); |
| 1875 | |
| 1876 | // note: it looks like AISubgroup may be destroyed during Clear(&context) |
| 1877 | SetCommandState(cmd._id, CSReceived, this); |
| 1878 | |
| 1879 | AISubgroupContext context(this); |
| 1880 | switch (cmd._context) |
| 1881 | { |
| 1882 | case Command::CtxMission: |
| 1883 | ClearMissionCommands(); |
| 1884 | EnqueueTask(cmd, &context); |
| 1885 | break; |
| 1886 | case Command::CtxUI: |
| 1887 | Clear(&context); |
| 1888 | PushTask(cmd, &context); |
| 1889 | break; |
| 1890 | case Command::CtxEscape: |
| 1891 | ClearEscapeCommands(); |
| 1892 | PushTask(cmd, &context); |
| 1893 | break; |
| 1894 | case Command::CtxUIWithJoin: |
| 1895 | Clear(&context); |
| 1896 | // continue |
| 1897 | case Command::CtxAuto: |
| 1898 | case Command::CtxAutoSilent: |
| 1899 | case Command::CtxJoin: |
| 1900 | case Command::CtxAutoJoin: |
| 1901 | PushTask(cmd, &context); |
| 1902 | break; |
| 1903 | default: |
| 1904 | Fail("Context"); |
| 1905 | return; |
| 1906 | } |
| 1907 | } |
| 1908 | |
| 1909 | void AISubgroup::SendAnswer(Answer answer) |
no test coverage detected