| 1907 | } |
| 1908 | |
| 1909 | void 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 | |
| 1949 | void CStaticMapMain::IssueWatch(float x, float y) |
| 1950 | { |
nothing calls this directly
no test coverage detected