This commit is contained in:
aozhiwei 2020-05-20 17:34:08 +08:00
parent afc71aa09d
commit 19a2d692ca
2 changed files with 20 additions and 20 deletions

View File

@ -47,7 +47,7 @@ void Room::Init()
} }
xtimer.Init(RoomXGetTickCount, this, 100, 100); xtimer.Init(RoomXGetTickCount, this, 100, 100);
xtimer_attacher.xtimer = &xtimer; xtimer_attacher_.xtimer = &xtimer;
CreateSpawnPoints(); CreateSpawnPoints();
CreateLoots(); CreateLoots();
@ -63,7 +63,7 @@ void Room::UnInit()
a8::Timer::Instance()->DeleteTimer(game_over_timer); a8::Timer::Instance()->DeleteTimer(game_over_timer);
game_over_timer = nullptr; game_over_timer = nullptr;
} }
xtimer_attacher.ClearTimerList(); xtimer_attacher_.ClearTimerList();
for (auto& pair : accountid_hash_) { for (auto& pair : accountid_hash_) {
PlayerMgr::Instance()->RemovePlayerBySocket(pair.second->socket_handle); PlayerMgr::Instance()->RemovePlayerBySocket(pair.second->socket_handle);
} }
@ -184,10 +184,10 @@ void Room::AddPlayer(Player* hum)
int Room::AllocUniid() int Room::AllocUniid()
{ {
while (GetEntityByUniId(++current_uniid) || while (GetEntityByUniId(++current_uniid_) ||
later_add_hash_.find(current_uniid) != later_add_hash_.end() || later_add_hash_.find(current_uniid_) != later_add_hash_.end() ||
current_uniid == 0) {} current_uniid_ == 0) {}
return current_uniid; return current_uniid_;
} }
void Room::ShuaAndroid() void Room::ShuaAndroid()
@ -211,7 +211,7 @@ void Room::ShuaAndroid()
Room* room = (Room*)param.sender.GetUserData(); Room* room = (Room*)param.sender.GetUserData();
room->ShuaAndroid(); room->ShuaAndroid();
}, },
&xtimer_attacher.timer_list_); &xtimer_attacher_.timer_list_);
NotifyUiUpdate(); NotifyUiUpdate();
} }
} }
@ -705,9 +705,9 @@ std::set<Human*>* Room::GetAliveTeam()
int Room::NewTeam() int Room::NewTeam()
{ {
++current_teamid; ++current_teamid_;
team_hash_[current_teamid] = std::set<Human*>(); team_hash_[current_teamid_] = std::set<Human*>();
return current_teamid; return current_teamid_;
} }
void Room::TouchPlayerList(a8::XParams param, void Room::TouchPlayerList(a8::XParams param,
@ -1094,7 +1094,7 @@ void Room::InitAirDrop()
room->AirDrop(param.param1, param.param2); room->AirDrop(param.param1, param.param2);
} }
}, },
&xtimer_attacher.timer_list_); &xtimer_attacher_.timer_list_);
} }
} }
@ -1155,7 +1155,7 @@ void Room::AirDrop(int appear_time, int box_id)
param.param3.GetDouble()); param.param3.GetDouble());
} }
}, },
&xtimer_attacher.timer_list_); &xtimer_attacher_.timer_list_);
} }
} }
@ -1258,7 +1258,7 @@ void Room::NotifyUiUpdate()
hum->SendUIUpdate(); hum->SendUIUpdate();
}); });
}, },
&xtimer_attacher.timer_list_); &xtimer_attacher_.timer_list_);
} }
void Room::UpdateCarObject(int old_uniid, int new_uniid, a8::Vec2 pos) void Room::UpdateCarObject(int old_uniid, int new_uniid, a8::Vec2 pos)
@ -1333,7 +1333,7 @@ void Room::NotifyWxVoip()
hum->SendWxVoip(); hum->SendWxVoip();
}); });
}, },
&xtimer_attacher.timer_list_); &xtimer_attacher_.timer_list_);
} }
BornPoint* Room::AllocBornPoint(Human* hum) BornPoint* Room::AllocBornPoint(Human* hum)
@ -1530,7 +1530,7 @@ void Room::NotifyGameStart()
Room* room = (Room*)param.sender.GetUserData(); Room* room = (Room*)param.sender.GetUserData();
room->SecondRandPoint(); room->SecondRandPoint();
}, },
&xtimer_attacher.timer_list_); &xtimer_attacher_.timer_list_);
waiting_start = true; waiting_start = true;
xtimer.AddDeadLineTimerAndAttach(SERVER_FRAME_RATE * 2, xtimer.AddDeadLineTimerAndAttach(SERVER_FRAME_RATE * 2,
a8::XParams() a8::XParams()
@ -1540,7 +1540,7 @@ void Room::NotifyGameStart()
Room* room = (Room*)param.sender.GetUserData(); Room* room = (Room*)param.sender.GetUserData();
room->waiting_start = false; room->waiting_start = false;
}, },
&xtimer_attacher.timer_list_); &xtimer_attacher_.timer_list_);
} }
void Room::InitObstacleDatas() void Room::InitObstacleDatas()

View File

@ -151,17 +151,17 @@ private:
int elapsed_time_ = 0; int elapsed_time_ = 0;
int alive_count_ = 0; int alive_count_ = 0;
MetaData::AirLine* airline_ = nullptr; MetaData::AirLine* airline_ = nullptr;
a8::XTimerAttacher xtimer_attacher; a8::XTimerAttacher xtimer_attacher_;
int current_teamid = 0; int current_teamid_ = 0;
int current_uniid = FIXED_OBJECT_MAXID; int current_uniid_ = FIXED_OBJECT_MAXID;
std::set<int> refreshed_robot_set_; std::set<int> refreshed_robot_set_;
std::map<int, std::set<Human*>> team_hash_; std::map<int, std::set<Human*>> team_hash_;
std::map<std::string, Player*> accountid_hash_; std::map<std::string, Player*> accountid_hash_;
std::map<int, MoveableEntity*> moveable_hash_; std::map<int, MoveableEntity*> moveable_hash_;
std::map<int, Entity*> uniid_hash_; std::map<int, Entity*> uniid_hash_;
std::map<int, Entity*> later_add_hash_; std::map<int, RoomEntity*> later_add_hash_;
std::map<int, Human*> human_hash_; std::map<int, Human*> human_hash_;
std::map<int, BornPoint> born_point_hash_; std::map<int, BornPoint> born_point_hash_;