MCPcopy Create free account
hub / github.com/BohemiaInteractive/CWR / ReceiveCommand

Method ReceiveCommand

engine/Poseidon/AI/AISubgroup.cpp:1863–1906  ·  view source on GitHub ↗

Communication with group

Source from the content-addressed store, hash-verified

1861}
1862
1863// Communication with group
1864void 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
1909void AISubgroup::SendAnswer(Answer answer)

Callers 3

SendCommandMethod · 0.80
TransmittedMethod · 0.80
IssueCommandMethod · 0.80

Calls 3

CreateUnitsListFunction · 0.85
GetUnitsListFunction · 0.85
SetCommandStateFunction · 0.85

Tested by

no test coverage detected