----- send functions -----
| 111 | |
| 112 | // ----- send functions ----- |
| 113 | static inline bool RepackMsg(const CMsgPacker *pMsg, CPacker &Packer, bool Sixup) |
| 114 | { |
| 115 | int MsgId = pMsg->m_MsgId; |
| 116 | Packer.Reset(); |
| 117 | |
| 118 | if(Sixup && !pMsg->m_NoTranslate) |
| 119 | { |
| 120 | if(pMsg->m_System) |
| 121 | { |
| 122 | if(MsgId >= OFFSET_UUID) |
| 123 | ; |
| 124 | else if(MsgId == NETMSG_INFO || MsgId == NETMSG_REQUEST_MAP_DATA) |
| 125 | ; |
| 126 | else if(MsgId == NETMSG_READY) |
| 127 | MsgId = protocol7::NETMSG_READY; |
| 128 | else if(MsgId == NETMSG_RCON_CMD) |
| 129 | MsgId = protocol7::NETMSG_RCON_CMD; |
| 130 | else if(MsgId == NETMSG_ENTERGAME) |
| 131 | MsgId = protocol7::NETMSG_ENTERGAME; |
| 132 | else if(MsgId == NETMSG_INPUT) |
| 133 | MsgId = protocol7::NETMSG_INPUT; |
| 134 | else if(MsgId == NETMSG_RCON_AUTH) |
| 135 | MsgId = protocol7::NETMSG_RCON_AUTH; |
| 136 | else if(MsgId == NETMSG_PING) |
| 137 | MsgId = protocol7::NETMSG_PING; |
| 138 | else |
| 139 | { |
| 140 | log_error("net", "0.7 DROP send sys %d", MsgId); |
| 141 | return false; |
| 142 | } |
| 143 | } |
| 144 | else |
| 145 | { |
| 146 | if(MsgId >= 0 && MsgId < OFFSET_UUID) |
| 147 | MsgId = Msg_SixToSeven(MsgId); |
| 148 | |
| 149 | if(MsgId < 0) |
| 150 | return false; |
| 151 | } |
| 152 | } |
| 153 | |
| 154 | if(pMsg->m_MsgId < OFFSET_UUID) |
| 155 | { |
| 156 | Packer.AddInt((MsgId << 1) | (pMsg->m_System ? 1 : 0)); |
| 157 | } |
| 158 | else |
| 159 | { |
| 160 | Packer.AddInt(pMsg->m_System ? 1 : 0); // NETMSG_EX, NETMSGTYPE_EX |
| 161 | g_UuidManager.PackUuid(pMsg->m_MsgId, &Packer); |
| 162 | } |
| 163 | Packer.AddRaw(pMsg->Data(), pMsg->Size()); |
| 164 | |
| 165 | return true; |
| 166 | } |
| 167 | |
| 168 | int CClient::SendMsg(int Conn, CMsgPacker *pMsg, int Flags) |
| 169 | { |