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

Method IssueMove

engine/Poseidon/UI/Map/UIMapMain.cpp:1909–1947  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1907}
1908
1909void CStaticMapMain::IssueMove(float x, float y)
1910{
1911 AIUnit* me = GetMyUnit();
1912 AIGroup* myGroup = me ? me->GetGroup() : nullptr;
1913 if (!myGroup)
1914 {
1915 return;
1916 }
1917
1918 PackedBoolArray list = Poseidon::ListSelectedUnits();
1919 if (me == myGroup->Leader() && !list.IsEmpty())
1920 {
1921 // command for units
1922 Command cmd;
1923 cmd._message = Command::Move;
1924 cmd._context = Command::CtxUI;
1925 cmd._destination = ScreenToWorld(DrawCoord(x, y));
1926 cmd._destination[1] = GLOB_LAND->RoadSurfaceY(cmd._destination[0], cmd._destination[2]);
1927 myGroup->SendCommand(cmd, list);
1928
1929 int index = GMainMapInfo.commands.Add();
1930 GMainMapInfo.commands[index].grp = myGroup;
1931 GMainMapInfo.commands[index].id = cmd._id;
1932 GMainMapInfo.commands[index].state = CSSent;
1933 GMainMapInfo.commands[index].position = cmd._destination;
1934 Poseidon::ClearSelectedUnits();
1935 }
1936 else
1937 {
1938 Transport* veh = me->GetVehicleIn();
1939 if (veh && veh->CommanderUnit() == me && veh->PilotUnit() != me)
1940 {
1941 // command for vehicle
1942 Vector3 pos = ScreenToWorld(DrawCoord(x, y));
1943 pos[1] = GLOB_LAND->RoadSurfaceYAboveWater(pos[0], pos[2]);
1944 veh->SendMove(pos);
1945 }
1946 }
1947}
1948
1949void CStaticMapMain::IssueWatch(float x, float y)
1950{

Callers

nothing calls this directly

Calls 13

ListSelectedUnitsFunction · 0.85
ClearSelectedUnitsFunction · 0.85
RoadSurfaceYMethod · 0.80
SendCommandMethod · 0.80
GetVehicleInMethod · 0.80
SendMoveMethod · 0.80
GetGroupMethod · 0.45
LeaderMethod · 0.45
IsEmptyMethod · 0.45
AddMethod · 0.45
CommanderUnitMethod · 0.45

Tested by

no test coverage detected