mirror of
https://github.com/citra-mirror/citra.git
synced 2024-08-20 10:23:23 +02:00
citra: add status messages and fix missing errors
This commit is contained in:
parent
0319e51960
commit
0823d8e009
@ -99,6 +99,10 @@ static void OnStateChanged(const Network::RoomMember::State& state) {
|
|||||||
"connected to the Room");
|
"connected to the Room");
|
||||||
exit(1);
|
exit(1);
|
||||||
break;
|
break;
|
||||||
|
case Network::RoomMember::State::ConsoleIdCollision:
|
||||||
|
LOG_ERROR(Network, "Your Console ID conflicted with someone else in the Room");
|
||||||
|
exit(1);
|
||||||
|
break;
|
||||||
case Network::RoomMember::State::WrongPassword:
|
case Network::RoomMember::State::WrongPassword:
|
||||||
LOG_ERROR(Network, "Room replied with: Wrong password");
|
LOG_ERROR(Network, "Room replied with: Wrong password");
|
||||||
exit(1);
|
exit(1);
|
||||||
@ -108,6 +112,10 @@ static void OnStateChanged(const Network::RoomMember::State& state) {
|
|||||||
"You are using a different version than the room you are trying to connect to");
|
"You are using a different version than the room you are trying to connect to");
|
||||||
exit(1);
|
exit(1);
|
||||||
break;
|
break;
|
||||||
|
case Network::RoomMember::State::RoomIsFull:
|
||||||
|
LOG_ERROR(Network, "The room is full");
|
||||||
|
exit(1);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -117,6 +125,20 @@ static void OnMessageReceived(const Network::ChatEntry& msg) {
|
|||||||
std::cout << std::endl << msg.nickname << ": " << msg.message << std::endl << std::endl;
|
std::cout << std::endl << msg.nickname << ": " << msg.message << std::endl << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void OnStatusMessageReceived(const Network::StatusMessageEntry& msg) {
|
||||||
|
std::string message;
|
||||||
|
switch (msg.type) {
|
||||||
|
case Network::IdMemberJoin:
|
||||||
|
message = fmt::format("{} has joined", msg.nickname);
|
||||||
|
break;
|
||||||
|
case Network::IdMemberLeave:
|
||||||
|
message = fmt::format("{} has left", msg.nickname);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (!message.empty())
|
||||||
|
std::cout << std::endl << "* " << message << std::endl << std::endl;
|
||||||
|
}
|
||||||
|
|
||||||
static void InitializeLogging() {
|
static void InitializeLogging() {
|
||||||
Log::Filter log_filter(Log::Level::Debug);
|
Log::Filter log_filter(Log::Level::Debug);
|
||||||
log_filter.ParseFilterString(Settings::values.log_filter);
|
log_filter.ParseFilterString(Settings::values.log_filter);
|
||||||
@ -334,6 +356,7 @@ int main(int argc, char** argv) {
|
|||||||
if (use_multiplayer) {
|
if (use_multiplayer) {
|
||||||
if (auto member = Network::GetRoomMember().lock()) {
|
if (auto member = Network::GetRoomMember().lock()) {
|
||||||
member->BindOnChatMessageRecieved(OnMessageReceived);
|
member->BindOnChatMessageRecieved(OnMessageReceived);
|
||||||
|
member->BindOnStatusMessageReceived(OnStatusMessageReceived);
|
||||||
member->BindOnStateChanged(OnStateChanged);
|
member->BindOnStateChanged(OnStateChanged);
|
||||||
LOG_DEBUG(Network, "Start connection to {}:{} with nickname {}", address, port,
|
LOG_DEBUG(Network, "Start connection to {}:{} with nickname {}", address, port,
|
||||||
nickname);
|
nickname);
|
||||||
|
Loading…
Reference in New Issue
Block a user