Sends off the input message the player was typing
| 829 | |
| 830 | // Sends off the input message the player was typing |
| 831 | void SendOffHUDInputMessage() { |
| 832 | if (Doing_input_message == HUD_MESSAGE_NONE) |
| 833 | return; |
| 834 | |
| 835 | if (Game_mode & GM_MULTI) { |
| 836 | if (HudInputMessage[0] == '$') // special command |
| 837 | { |
| 838 | DLLInfo.input_string = HudInputMessage; |
| 839 | CallGameDLL(EVT_CLIENT_INPUT_STRING, &DLLInfo); |
| 840 | } else { |
| 841 | char str[255]; |
| 842 | snprintf(str, sizeof(str), TXT_HUDSAY, Players[Player_num].callsign, HudInputMessage); |
| 843 | |
| 844 | switch (Doing_input_message) { |
| 845 | case HUD_MESSAGE_GENERAL: { |
| 846 | int to_who; |
| 847 | |
| 848 | const char *colon_pos = GetMessageDestination(HudInputMessage, &to_who); |
| 849 | |
| 850 | if (to_who != MULTI_SEND_MESSAGE_ALL) { |
| 851 | if (to_who < 0) { |
| 852 | // to a team |
| 853 | snprintf(str, sizeof(str), "[%s]: %s", Players[Player_num].callsign, colon_pos); |
| 854 | } else { |
| 855 | // to a player |
| 856 | // cut out what's after the colon |
| 857 | snprintf(str, sizeof(str), "<%s>:%s", Players[Player_num].callsign, colon_pos); |
| 858 | AddHUDMessage("Sent private message to %s", Players[to_who].callsign); |
| 859 | } |
| 860 | } |
| 861 | |
| 862 | if (Netgame.local_role == LR_SERVER) |
| 863 | MultiSendMessageFromServer(GR_RGB(0, 128, 255), str, to_who); |
| 864 | else |
| 865 | MultiSendMessageToServer(0, str, to_who); |
| 866 | } break; |
| 867 | case HUD_MESSAGE_TEAM: { |
| 868 | int team = MULTI_SEND_MESSAGE_ALL; |
| 869 | switch (Players[Player_num].team) { |
| 870 | case 0: |
| 871 | team = MULTI_SEND_MESSAGE_RED_TEAM; |
| 872 | break; |
| 873 | case 1: |
| 874 | team = MULTI_SEND_MESSAGE_BLUE_TEAM; |
| 875 | break; |
| 876 | case 2: |
| 877 | team = MULTI_SEND_MESSAGE_GREEN_TEAM; |
| 878 | break; |
| 879 | case 3: |
| 880 | team = MULTI_SEND_MESSAGE_YELLOW_TEAM; |
| 881 | break; |
| 882 | } |
| 883 | |
| 884 | if (team != MULTI_SEND_MESSAGE_ALL) { |
| 885 | snprintf(str, sizeof(str), "[%s]: %s", Players[Player_num].callsign, HudInputMessage); |
| 886 | } |
| 887 | |
| 888 | if (Netgame.local_role == LR_SERVER) |
no test coverage detected