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

Method SendAutoCommandToUnit

engine/Poseidon/AI/AIGroupCmd.cpp:1228–1257  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1226}
1227
1228void AIGroup::SendAutoCommandToUnit(Command& cmd, AIUnit* unit, bool join, bool channelCenter)
1229{
1230 AI_ERROR(unit);
1231 if (!unit || !unit->IsUnit())
1232 {
1233 return;
1234 }
1235 AISubgroup* subgrp = unit->GetSubgroup();
1236 AI_ERROR(subgrp);
1237 if (!subgrp)
1238 {
1239 return;
1240 }
1241
1242 PackedBoolArray list;
1243 list.Set(unit->ID() - 1, true);
1244
1245 if (join)
1246 {
1247 cmd._joinToSubgroup = subgrp;
1248 cmd._context = Command::CtxAuto;
1249 }
1250 else
1251 {
1252 cmd._context = Command::CtxAuto;
1253 }
1254
1255 AI_ERROR(cmd._message != Command::NoCommand);
1256 SendCommand(cmd, list, channelCenter);
1257}
1258
1259void AIGroup::IssueAutoCommand(Command& cmd, AIUnit* unit)
1260{

Callers 4

CheckAmmoMethod · 0.80
OnHTMLLinkMethod · 0.80
ProcessMenuMethod · 0.80
IssueActionMethod · 0.80

Calls 4

IsUnitMethod · 0.80
GetSubgroupMethod · 0.45
SetMethod · 0.45
IDMethod · 0.45

Tested by

no test coverage detected