This commit is contained in:
aozhiwei 2019-07-25 16:55:24 +08:00
parent c435b54f0d
commit 2859f5502e
5 changed files with 12 additions and 8 deletions

View File

@ -461,10 +461,11 @@ void Human::BeKill(int killer_id, const std::string& killer_name, int weapon_id)
if (!dead && !room->game_over) { if (!dead && !room->game_over) {
if (immediately_revive_times_ > 0) { if (immediately_revive_times_ > 0) {
--immediately_revive_times_; --immediately_revive_times_;
dead = true;
status = 0; status = 0;
ClearBuffList(); ClearBuffList();
room->frame_event.AddDead(this, 0); room->frame_event.AddDead(this, 0);
room->xtimer.AddDeadLineTimerAndAttach(1, room->xtimer.AddDeadLineTimerAndAttach(2,
a8::XParams() a8::XParams()
.SetSender(this), .SetSender(this),
[] (const a8::XParams& param) [] (const a8::XParams& param)
@ -1859,6 +1860,7 @@ void Human::Revive()
skill_dir = a8::Vec2(); skill_dir = a8::Vec2();
skill_param1 = 0.0f; skill_param1 = 0.0f;
playing_skill = false; playing_skill = false;
SyncAroundPlayers();
} }
void Human::ImmediatelyRevive() void Human::ImmediatelyRevive()
@ -1881,6 +1883,7 @@ void Human::ImmediatelyRevive()
skill_dir = a8::Vec2(); skill_dir = a8::Vec2();
skill_param1 = 0.0f; skill_param1 = 0.0f;
playing_skill = false; playing_skill = false;
SyncAroundPlayers();
} }
void Human::SelectSkillTargets(const a8::Vec2& target_pos, std::set<Entity*>& target_list) void Human::SelectSkillTargets(const a8::Vec2& target_pos, std::set<Entity*>& target_list)

View File

@ -749,12 +749,12 @@ int Room::GetAliveTeamNum()
return num; return num;
} }
bool Room::CanJoin(const std::string& accountid, const std::string& team_uuid) bool Room::CanJoin(const cs::CMJoin& msg)
{ {
if (gas_data.gas_mode != kGasInactive) { if (gas_data.gas_mode != kGasInactive) {
return false; return false;
} }
if (accountid_hash_.find(accountid) != accountid_hash_.end()) { if (accountid_hash_.find(msg.account_id()) != accountid_hash_.end()) {
return false; return false;
} }
if (App::Instance()->HasFlag(5)) { if (App::Instance()->HasFlag(5)) {

View File

@ -11,6 +11,7 @@
namespace cs namespace cs
{ {
class CMJoin;
class SMUiUpdate; class SMUiUpdate;
} }
@ -95,7 +96,7 @@ public:
bool BattleStarted(); bool BattleStarted();
int GetAliveTeamNum(); int GetAliveTeamNum();
std::set<Human*>* GetAliveTeam(); std::set<Human*>* GetAliveTeam();
bool CanJoin(const std::string& accountid, const std::string& team_uuid); bool CanJoin(const cs::CMJoin& msg);
void OnPlayerOffline(Player* hum); void OnPlayerOffline(Player* hum);
Obstacle* CreateObstacle(int id, float x, float y); Obstacle* CreateObstacle(int id, float x, float y);
bool IsGameOver(); bool IsGameOver();

View File

@ -46,7 +46,7 @@ void RoomMgr::_CMJoin(f8::MsgHdr& hdr, const cs::CMJoin& msg)
if (!hum_meta) { if (!hum_meta) {
abort(); abort();
} }
Room* room = GetJoinableRoom(msg.account_id(), msg.team_uuid()); Room* room = GetJoinableRoom(msg);
if (!room) { if (!room) {
room = new Room(); room = new Room();
room->room_uuid = App::Instance()->NewUuid(); room->room_uuid = App::Instance()->NewUuid();
@ -99,10 +99,10 @@ int RoomMgr::OverRoomNum()
return over_room_hash_.size(); return over_room_hash_.size();
} }
Room* RoomMgr::GetJoinableRoom(const std::string& account_id, const std::string& team_uuid) Room* RoomMgr::GetJoinableRoom(const cs::CMJoin& msg)
{ {
for (auto& pair : inactive_room_hash_) { for (auto& pair : inactive_room_hash_) {
if (pair.second->CanJoin(account_id, team_uuid)) { if (pair.second->CanJoin(msg)) {
return pair.second; return pair.second;
} }
} }

View File

@ -31,7 +31,7 @@ class RoomMgr : public a8::Singleton<RoomMgr>
void InstallReportStateTimer(); void InstallReportStateTimer();
private: private:
Room* GetJoinableRoom(const std::string& account_id, const std::string& team_uuid); Room* GetJoinableRoom(const cs::CMJoin& msg);
void ReportServerState(int instance_id, const std::string& host, int port); void ReportServerState(int instance_id, const std::string& host, int port);
void FreeOverRoom(long long room_uuid); void FreeOverRoom(long long room_uuid);