From 349b851d1c0bc51bbf811be7b788ad2ae1f0cc18 Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Thu, 20 Apr 2023 11:02:19 +0800 Subject: [PATCH] 1 --- server/gameserver/roommgr.cc | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/server/gameserver/roommgr.cc b/server/gameserver/roommgr.cc index 89ca424f..9426b1cc 100644 --- a/server/gameserver/roommgr.cc +++ b/server/gameserver/roommgr.cc @@ -913,6 +913,16 @@ void RoomMgr::AdjustCMJoin(cs::CMJoin* msg) void RoomMgr::EnterNewBie(f8::MsgHdr& hdr, const cs::CMJoin& msg) { + std::shared_ptr context = std::make_shared(); + { + context->join_msg = std::make_shared(); + *context->join_msg = msg; + context->battle_uuid = App::Instance()->NewUuid(); + context->is_valid_battle = true; + context->errcode = 0; + context->errmsg = ""; + } + int game_times = 0; RoomType_e self_room_type = GetHumanRoomType(msg, game_times); if (self_room_type < RT_OldBrid1) { @@ -935,13 +945,9 @@ void RoomMgr::EnterNewBie(f8::MsgHdr& hdr, const cs::CMJoin& msg) #if 0 hum->hero_uniid = a8::XValue(msg.hero_uniid()); #endif - #if 0 - hum->battle_uuid = results.at(0)->battle_uuid; - #endif -#if 0 - hum->is_valid_battle = results.at(0)->is_valid_battle; - hum->payload = results.at(0)->payload; -#endif + hum->battle_uuid = context->battle_uuid; + hum->is_valid_battle = context->is_valid_battle; + hum->payload = context->payload; PlayerMgr::Instance()-> CreatePlayerByCMJoin(hum, hdr.ip_saddr, @@ -953,9 +959,7 @@ void RoomMgr::EnterNewBie(f8::MsgHdr& hdr, const cs::CMJoin& msg) hum->meta = mt::Param::s().human_meta; } hum->room = room; - #if 0 - hum->SetBattleContext(results.at(0)); - #endif + hum->SetBattleContext(context); hum->GetBattleContext()->Init(hum); { long long hero_uniid = 0;