bool ServerLobbyRoomProtocol::notifyEventAsynchronous(Event* event) { assert(m_setup); // assert that the setup exists if (event->getType() == EVENT_TYPE_MESSAGE) { const NetworkString &data = event->data(); assert(data.size()); // message not empty uint8_t message_type; message_type = data[0]; event->removeFront(1); Log::info("ServerLobbyRoomProtocol", "Message received with type %d.", message_type); switch(message_type) { case LE_CONNECTION_REQUESTED: connectionRequested(event); break; case LE_REQUEST_BEGIN: startSelection(event); break; case LE_KART_SELECTION: kartSelectionRequested(event); break; case LE_VOTE_MAJOR: playerMajorVote(event); break; case LE_VOTE_RACE_COUNT: playerRaceCountVote(event); break; case LE_VOTE_MINOR: playerMinorVote(event); break; case LE_VOTE_TRACK: playerTrackVote(event); break; case LE_VOTE_REVERSE: playerReversedVote(event); break; case LE_VOTE_LAPS: playerLapsVote(event); break; } // switch } // if (event->getType() == EVENT_TYPE_MESSAGE) else if (event->getType() == EVENT_TYPE_CONNECTED) { } // if (event->getType() == EVENT_TYPE_CONNECTED) else if (event->getType() == EVENT_TYPE_DISCONNECTED) { kartDisconnected(event); } // if (event->getType() == EVENT_TYPE_DISCONNECTED) return true; } // notifyEventAsynchronous
bool ServerLobbyRoomProtocol::notifyEventAsynchronous(Event* event) { assert(m_setup); // assert that the setup exists if (event->type == EVENT_TYPE_MESSAGE) { NetworkString data = event->data(); assert(data.size()); // message not empty uint8_t message_type; message_type = data[0]; event->removeFront(1); Log::info("ServerLobbyRoomProtocol", "Message received with type %d.", message_type); if (message_type == 0x01) // player requesting connection connectionRequested(event); else if (message_type == 0x02) // player requesting kart selection kartSelectionRequested(event); else if (message_type == 0xc0) // vote for major mode playerMajorVote(event); else if (message_type == 0xc1) // vote for race count playerRaceCountVote(event); else if (message_type == 0xc2) // vote for minor mode playerMinorVote(event); else if (message_type == 0xc3) // vote for track playerTrackVote(event); else if (message_type == 0xc4) // vote for reversed mode playerReversedVote(event); else if (message_type == 0xc5) // vote for laps playerLapsVote(event); } // if (event->type == EVENT_TYPE_MESSAGE) else if (event->type == EVENT_TYPE_CONNECTED) { } // if (event->type == EVENT_TYPE_CONNECTED) else if (event->type == EVENT_TYPE_DISCONNECTED) { kartDisconnected(event); } // if (event->type == EVENT_TYPE_DISCONNECTED) return true; }