diff --git a/src/CommandFormats.hh b/src/CommandFormats.hh index 9da0fbc6..b99bfa97 100644 --- a/src/CommandFormats.hh +++ b/src/CommandFormats.hh @@ -762,26 +762,31 @@ struct C_GuildCardSearch_40 { // 41 (S->C): Guild card search result +template +struct SC_MeetUserExtension { + le_uint32_t menu_id; + le_uint32_t lobby_id; + parray unknown_a1; + ptext player_name; +}; + template struct S_GuildCardSearchResult { le_uint32_t player_tag; le_uint32_t searcher_guild_card_number; le_uint32_t result_guild_card_number; - HeaderT reconnect_command_header; + HeaderT reconnect_command_header; // Ignored by the client S_Reconnect_19 reconnect_command; - // The format of this string is "ROOM-NAME,BLOCK##,SERVER-NAME". If the result + // The format of this string is "GAME-NAME,BLOCK##,SERVER-NAME". If the result // player is not in a game, GAME-NAME should be the lobby name - for standard // lobbies this is "BLOCK-"; for CARD lobbies this is // "BLOCK-C". ptext location_string; - // If the player chooses to meet the user, this menu ID and lobby ID is sent - // in the login command (9D/9E) after connecting to the server designated in - // reconnect_command. In fact, the remaining fields in this structure directly - // match the fields in the extended 9D/9E commands. - le_uint32_t menu_id; - le_uint32_t lobby_id; - ptext unused; - ptext name; + // If the player chooses to meet the user, this extension data is sent in the + // login command (9D/9E) after connecting to the server designated in + // reconnect_command. When processing the 9D/9E, newserv uses only the + // lobby_id field within, but it fills in all fields when sengind a 41. + SC_MeetUserExtension extension; }; struct S_GuildCardSearchResult_PC_41 : S_GuildCardSearchResult { }; @@ -1227,14 +1232,6 @@ struct C_RegisterV1_DC_92 { // 93 (C->S): Log in (DCv1) -template -struct C_Login_MeetUserExtension { - le_uint32_t menu_id; - le_uint32_t preferred_lobby_id; - parray unknown_a1; - ptext target_player_name; -}; - struct C_LoginV1_DC_93 { le_uint32_t player_tag; le_uint32_t guild_card_number; @@ -1254,7 +1251,7 @@ struct C_LoginV1_DC_93 { }; struct C_LoginExtendedV1_DC_93 : C_LoginV1_DC_93 { - C_Login_MeetUserExtension extension; + SC_MeetUserExtension extension; }; // 93 (C->S): Log in (BB) @@ -1267,8 +1264,8 @@ struct C_Login_BB_93 { ptext username; ptext password; - // These fields map to the same fields in C_Login_MeetUserExtension. There is - // no equivalent of the name field from that structure on BB (though newserv + // These fields map to the same fields in SC_MeetUserExtension. There is no + // equivalent of the name field from that structure on BB (though newserv // doesn't use it anyway). le_uint32_t menu_id; le_uint32_t preferred_lobby_id; @@ -1441,10 +1438,10 @@ struct C_Login_DC_PC_GC_9D { ptext name; }; struct C_LoginExtended_DC_GC_9D : C_Login_DC_PC_GC_9D { - C_Login_MeetUserExtension extension; + SC_MeetUserExtension extension; }; struct C_LoginExtended_PC_9D : C_Login_DC_PC_GC_9D { - C_Login_MeetUserExtension extension; + SC_MeetUserExtension extension; }; // 9E (C->S): Log in with client config (V3/BB) @@ -1461,7 +1458,7 @@ struct C_Login_GC_9E : C_Login_DC_PC_GC_9D { } client_config; }; struct C_LoginExtended_GC_9E : C_Login_GC_9E { - C_Login_MeetUserExtension extension; + SC_MeetUserExtension extension; }; struct C_Login_XB_9E : C_Login_GC_9E { @@ -1469,7 +1466,7 @@ struct C_Login_XB_9E : C_Login_GC_9E { parray unknown_a1; }; struct C_LoginExtended_XB_9E : C_Login_XB_9E { - C_Login_MeetUserExtension extension; + SC_MeetUserExtension extension; }; struct C_LoginExtended_BB_9E { @@ -1486,7 +1483,7 @@ struct C_LoginExtended_BB_9E { ptext password; ptext guild_card_number_str; parray unknown_a7; - C_Login_MeetUserExtension extension; + SC_MeetUserExtension extension; }; // 9F (S->C): Request client config / security data (V3/BB) diff --git a/src/ReceiveCommands.cc b/src/ReceiveCommands.cc index 511087f0..bbeeda6a 100644 --- a/src/ReceiveCommands.cc +++ b/src/ReceiveCommands.cc @@ -283,7 +283,7 @@ static void on_login_3_dc_pc_v3(shared_ptr s, shared_ptr c, if (cmd.is_extended) { const auto& ext_cmd = check_size_t(data); if (ext_cmd.extension.menu_id == MenuID::LOBBY) { - c->preferred_lobby_id = ext_cmd.extension.preferred_lobby_id; + c->preferred_lobby_id = ext_cmd.extension.lobby_id; } } @@ -420,12 +420,12 @@ static void on_login_d_e_dc_pc_v3(shared_ptr s, shared_ptr if (c->version() == GameVersion::PC) { const auto& cmd = check_size_t(data); if (cmd.extension.menu_id == MenuID::LOBBY) { - c->preferred_lobby_id = cmd.extension.preferred_lobby_id; + c->preferred_lobby_id = cmd.extension.lobby_id; } } else { const auto& cmd = check_size_t(data); if (cmd.extension.menu_id == MenuID::LOBBY) { - c->preferred_lobby_id = cmd.extension.preferred_lobby_id; + c->preferred_lobby_id = cmd.extension.lobby_id; } } } @@ -451,7 +451,7 @@ static void on_login_d_e_dc_pc_v3(shared_ptr s, shared_ptr if (cmd.is_extended) { const auto& cmd = check_size_t(data); if (cmd.extension.menu_id == MenuID::LOBBY) { - c->preferred_lobby_id = cmd.extension.preferred_lobby_id; + c->preferred_lobby_id = cmd.extension.lobby_id; } } diff --git a/src/SendCommands.cc b/src/SendCommands.cc index 64f12a61..232fb432 100644 --- a/src/SendCommands.cc +++ b/src/SendCommands.cc @@ -739,9 +739,9 @@ void send_card_search_result_t( result_lobby->lobby_id, encoded_server_name.c_str()); } cmd.location_string = location_string; - cmd.menu_id = MenuID::LOBBY; - cmd.lobby_id = result->lobby_id; - cmd.name = result->game_data.player()->disp.name; + cmd.extension.menu_id = MenuID::LOBBY; + cmd.extension.lobby_id = result->lobby_id; + cmd.extension.player_name = result->game_data.player()->disp.name; send_command_t(c, 0x41, 0x00, cmd); }