1
This commit is contained in:
commit
34a95c46b9
@ -2233,8 +2233,9 @@ void Human::DecItem(int item_id, int item_num)
|
||||
room->frame_event.AddItemChg(GetWeakPtrRef(), item_id, std::max(0, itr->second));
|
||||
if (itr->second <= 0) {
|
||||
if (battling_items_.find(item_id) == battling_items_.end()) {
|
||||
items_.erase(itr);
|
||||
//items_.erase(itr); //为啥?????
|
||||
}
|
||||
items_.erase(itr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -63,11 +63,19 @@ void RawTeamMember::InitRobot()
|
||||
}
|
||||
}
|
||||
|
||||
MatchTeam::~MatchTeam()
|
||||
{
|
||||
timer_attacher.ClearTimerList();
|
||||
#ifdef DEBUG
|
||||
a8::XPrintf("~MatchTeam %s\n", {GetTeamUUid()});
|
||||
#endif
|
||||
}
|
||||
|
||||
void MatchTeam::Init(f8::MsgHdr& hdr, const cs::CMJoin& msg)
|
||||
{
|
||||
master_team_ = this;
|
||||
create_tick_ = a8::XGetTickCount();
|
||||
a8::Timer::Instance()->AddRepeatTimerAndAttach
|
||||
timer_ = a8::Timer::Instance()->AddRepeatTimerAndAttach
|
||||
(1000,
|
||||
a8::XParams()
|
||||
.SetSender(this),
|
||||
@ -76,7 +84,14 @@ void MatchTeam::Init(f8::MsgHdr& hdr, const cs::CMJoin& msg)
|
||||
MatchTeam* team = (MatchTeam*)param.sender.GetUserData();
|
||||
team->Update();
|
||||
},
|
||||
&timer_attacher.timer_list_);
|
||||
&timer_attacher.timer_list_,
|
||||
[] (const a8::XParams& param)
|
||||
{
|
||||
#ifdef DEBUG
|
||||
a8::XPrintf("~MatchTeam.timer\n", {});
|
||||
#endif
|
||||
}
|
||||
);
|
||||
phase_= kMatchCombining;
|
||||
phase_start_tick_ = a8::XGetTickCount();
|
||||
countdown_ = MetaMgr::Instance()->match_team_time;
|
||||
@ -174,8 +189,10 @@ void MatchTeam::Update()
|
||||
UpdateSlave();
|
||||
}
|
||||
master_team_->SyncMatchInfo();
|
||||
if (phase_ == kMatchStartGame) {
|
||||
if (phase_ == kMatchStartGame && IsMasterTeam()) {
|
||||
StartGame();
|
||||
a8::Timer::Instance()->DeleteTimer(timer_);
|
||||
timer_ = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -47,6 +47,7 @@ class MatchTeam
|
||||
{
|
||||
public:
|
||||
a8::TimerAttacher timer_attacher;
|
||||
~MatchTeam();
|
||||
|
||||
void Init(f8::MsgHdr& hdr, const cs::CMJoin& msg);
|
||||
|
||||
@ -93,6 +94,7 @@ class MatchTeam
|
||||
std::map<std::string, std::shared_ptr<RawTeamMember>> raw_member_hash_;
|
||||
std::shared_ptr<RawTeamMember> first_member_;
|
||||
long long last_auto_choose_tick_ = 0;
|
||||
timer_list* timer_ = nullptr;
|
||||
|
||||
std::map<std::string, MatchTeam*> combined_team_hash_;
|
||||
MatchTeam* master_team_ = nullptr;
|
||||
|
@ -548,6 +548,9 @@ namespace MetaData
|
||||
for (auto& str : strings) {
|
||||
skin_id.push_back(a8::XValue(str));
|
||||
}
|
||||
if (skin_id.size() != 3) {
|
||||
abort();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -365,6 +365,7 @@ void Player::UpdateUseItemId()
|
||||
ProcUseItem(use_item_id);
|
||||
use_item_id = 0;
|
||||
has_use_item_id = false;
|
||||
need_sync_active_player = true;
|
||||
}
|
||||
|
||||
void Player::UpdateSpectate()
|
||||
@ -1198,6 +1199,9 @@ void Player::PushJoinRoomMsg()
|
||||
notifymsg.set_started(false);
|
||||
notifymsg.set_room_uuid(a8::XValue(room->GetRoomUuid()).GetString());
|
||||
GGListener::Instance()->SendToClient(socket_handle, 0, notifymsg);
|
||||
#ifdef DEBUG
|
||||
a8::XPrintf("PushJoinRooMmsg %d\n", {GetUniId()});
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3959,9 +3959,11 @@ void Room::AddTeam(class MatchTeam* team)
|
||||
Player* hum = NewPlayer();
|
||||
#if 1
|
||||
a8::SetBitFlag(hum->status, CS_ForceTeam);
|
||||
#if 0
|
||||
member->msg.mutable_baseskin()->Clear();
|
||||
member->msg.add_baseskin(1);
|
||||
#endif
|
||||
#endif
|
||||
hum->ProcPreSettlementInfo(member->msg.pre_settlement_info());
|
||||
PlayerMgr::Instance()->
|
||||
CreatePlayerByCMJoin(hum,
|
||||
|
Loading…
x
Reference in New Issue
Block a user