| 76 | |
| 77 | |
| 78 | void NetworkManager::ExtendNetworking() |
| 79 | { |
| 80 | auto client = GetClient(); |
| 81 | if (client == nullptr) return; |
| 82 | |
| 83 | if (client->NetMessageFactory->MessagePools.size() > (unsigned)net::ExtenderMessage::MessageId) { |
| 84 | return; |
| 85 | } |
| 86 | |
| 87 | protocol_ = new ExtenderProtocol(); |
| 88 | client->ProtocolList.insert_at(0, protocol_); |
| 89 | client->ProtocolMap.set(ExtenderProtocol::ProtocolId, protocol_); |
| 90 | |
| 91 | auto extenderMsg = new net::ExtenderMessage(); |
| 92 | client->NetMessageFactory->Register((uint32_t)net::ExtenderMessage::MessageId, extenderMsg); |
| 93 | gExtender->GetHooks().HookNetworkMessages(client->NetMessageFactory); |
| 94 | DEBUG("Registered custom client network protocol"); |
| 95 | } |
| 96 | |
| 97 | net::GameClient* NetworkManager::GetClient() const |
| 98 | { |
no test coverage detected