merge master

This commit is contained in:
aozhiwei 2019-06-04 15:38:24 +08:00
commit e6231e0e49
5 changed files with 20 additions and 7 deletions

View File

@ -53,10 +53,12 @@ const char* const PROJ_LOG_FILENAME_FMT = "log_$pid_%Y%m%d.log";
static void SavePerfLog() static void SavePerfLog()
{ {
a8::UdpLog::Instance()->Info("max_mainloop_rundelay:%d room_num:%d", a8::UdpLog::Instance()->Info("max_mainloop_rundelay:%d room_num:%d player_num:%d online_num:%d",
{ {
App::Instance()->perf.max_run_delay_time, App::Instance()->perf.max_run_delay_time,
RoomMgr::Instance()->RoomNum() RoomMgr::Instance()->RoomNum(),
0,
PlayerMgr::Instance()->OnlineNum()
}); });
if (App::Instance()->HasFlag(4)) { if (App::Instance()->HasFlag(4)) {
a8::XPrintf("mainloop_time:%d netmsg_time:%d room:%d over_room:%d online:%d bullet:%d\n", a8::XPrintf("mainloop_time:%d netmsg_time:%d room:%d over_room:%d online:%d bullet:%d\n",

View File

@ -54,6 +54,7 @@ Human::~Human()
void Human::Initialize() void Human::Initialize()
{ {
Entity::Initialize(); Entity::Initialize();
skill_xtimer_attacher_.xtimer = &room->xtimer;
RecalcSelfCollider(); RecalcSelfCollider();
volume_ = meta->volume; volume_ = meta->volume;
observers_.insert(this); observers_.insert(this);
@ -515,6 +516,7 @@ void Human::FillSMGameOver(cs::SMGameOver& msg)
void Human::BeKill(int killer_id, const std::string& killer_name, int weapon_id) void Human::BeKill(int killer_id, const std::string& killer_name, int weapon_id)
{ {
if (!dead && !room->game_over) { if (!dead && !room->game_over) {
lethal_weapon = weapon_id;
Entity* hum = room->GetEntityByUniId(killer_id); Entity* hum = room->GetEntityByUniId(killer_id);
if (hum && hum->entity_type == ET_Player) { if (hum && hum->entity_type == ET_Player) {
if (killer_id == entity_uniid) { if (killer_id == entity_uniid) {
@ -1483,8 +1485,10 @@ void Human::SendUpdateMsg()
void Human::SendGameOver() void Human::SendGameOver()
{ {
if (!sending_gameover_) { if (entity_subtype == EST_Player) {
InternalSendGameOver(); if (!sending_gameover_) {
InternalSendGameOver();
}
} }
} }
@ -1767,7 +1771,9 @@ void Human::GenBattleReportData(a8::MutableXObject* params)
} }
} }
params->SetVal("account_id", account_id); params->SetVal("account_id", account_id);
params->SetVal("map_id", room->map_meta->i->map_id());
params->SetVal("map_name", room->map_meta->i->map_name()); params->SetVal("map_name", room->map_meta->i->map_name());
params->SetVal("map_tpl_name", room->map_tpl_name);
params->SetVal("game_time", time(nullptr)); params->SetVal("game_time", time(nullptr));
params->SetVal("hurt", stats.damage_amount_in); params->SetVal("hurt", stats.damage_amount_in);
params->SetVal("rank", rank); params->SetVal("rank", rank);
@ -1779,7 +1785,7 @@ void Human::GenBattleReportData(a8::MutableXObject* params)
} else { } else {
params->SetVal("alive_time", dead_frameno * 1000.0f / SERVER_FRAME_RATE); params->SetVal("alive_time", dead_frameno * 1000.0f / SERVER_FRAME_RATE);
} }
params->SetVal("team_status", team_id != 0); params->SetVal("team_status", team_members && team_members->size() > 1 ? 1 : 0);
params->SetVal("room_uuid", room->room_uuid); params->SetVal("room_uuid", room->room_uuid);
int snipe_kill = 0; int snipe_kill = 0;
@ -1836,6 +1842,9 @@ void Human::GenBattleReportData(a8::MutableXObject* params)
void Human::InternalSendGameOver() void Human::InternalSendGameOver()
{ {
if (entity_subtype != EST_Player) {
return;
}
if (already_report_battle_) { if (already_report_battle_) {
cs::SMGameOver msg; cs::SMGameOver msg;
FillSMGameOver(msg); FillSMGameOver(msg);

View File

@ -319,8 +319,8 @@ void Room::ScatterDrop(Vector2D center, int drop_id)
void Room::CreateThings() void Room::CreateThings()
{ {
std::string tpl_name = map_meta->RandTemplate(); map_tpl_name = map_meta->RandTemplate();
std::vector<MetaData::MapTplThing>* things = MetaMgr::Instance()->GetMapTplThing(tpl_name); std::vector<MetaData::MapTplThing>* things = MetaMgr::Instance()->GetMapTplThing(map_tpl_name);
if (things) { if (things) {
for (auto& thing_tpl : *things) { for (auto& thing_tpl : *things) {
if (thing_tpl.i->weight() >= rand() % 10000) { if (thing_tpl.i->weight() >= rand() % 10000) {

View File

@ -34,6 +34,7 @@ class Room
public: public:
long long room_uuid = 0; long long room_uuid = 0;
MetaData::Map* map_meta = nullptr; MetaData::Map* map_meta = nullptr;
std::string map_tpl_name;
FrameEvent frame_event; FrameEvent frame_event;
FrameMaker frame_maker; FrameMaker frame_maker;
long long frame_no = 0; long long frame_no = 0;

View File

@ -162,6 +162,7 @@ Room* RoomMgr::GetRoomByUuid(long long room_uuid)
void RoomMgr::AddOverRoom(long long room_uuid) void RoomMgr::AddOverRoom(long long room_uuid)
{ {
inactive_room_hash_.erase(room_uuid);
a8::Timer::Instance()->AddDeadLineTimer(1000, a8::Timer::Instance()->AddDeadLineTimer(1000,
a8::XParams() a8::XParams()
.SetSender(room_uuid), .SetSender(room_uuid),