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 (immediately_revive_times_ > 0) {
--immediately_revive_times_;
dead = true;
status = 0;
ClearBuffList();
room->frame_event.AddDead(this, 0);
room->xtimer.AddDeadLineTimerAndAttach(1,
room->xtimer.AddDeadLineTimerAndAttach(2,
a8::XParams()
.SetSender(this),
[] (const a8::XParams& param)
@ -1859,6 +1860,7 @@ void Human::Revive()
skill_dir = a8::Vec2();
skill_param1 = 0.0f;
playing_skill = false;
SyncAroundPlayers();
}
void Human::ImmediatelyRevive()
@ -1881,6 +1883,7 @@ void Human::ImmediatelyRevive()
skill_dir = a8::Vec2();
skill_param1 = 0.0f;
playing_skill = false;
SyncAroundPlayers();
}
void Human::SelectSkillTargets(const a8::Vec2& target_pos, std::set<Entity*>& target_list)

View File

@ -749,12 +749,12 @@ int Room::GetAliveTeamNum()
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) {
return false;
}
if (accountid_hash_.find(accountid) != accountid_hash_.end()) {
if (accountid_hash_.find(msg.account_id()) != accountid_hash_.end()) {
return false;
}
if (App::Instance()->HasFlag(5)) {

View File

@ -11,6 +11,7 @@
namespace cs
{
class CMJoin;
class SMUiUpdate;
}
@ -95,7 +96,7 @@ public:
bool BattleStarted();
int GetAliveTeamNum();
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);
Obstacle* CreateObstacle(int id, float x, float y);
bool IsGameOver();

View File

@ -46,7 +46,7 @@ void RoomMgr::_CMJoin(f8::MsgHdr& hdr, const cs::CMJoin& msg)
if (!hum_meta) {
abort();
}
Room* room = GetJoinableRoom(msg.account_id(), msg.team_uuid());
Room* room = GetJoinableRoom(msg);
if (!room) {
room = new Room();
room->room_uuid = App::Instance()->NewUuid();
@ -99,10 +99,10 @@ int RoomMgr::OverRoomNum()
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_) {
if (pair.second->CanJoin(account_id, team_uuid)) {
if (pair.second->CanJoin(msg)) {
return pair.second;
}
}

View File

@ -31,7 +31,7 @@ class RoomMgr : public a8::Singleton<RoomMgr>
void InstallReportStateTimer();
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 FreeOverRoom(long long room_uuid);