1
This commit is contained in:
parent
b81e4006e8
commit
8f777ad79f
@ -715,6 +715,9 @@ void Human::BeKill(int killer_id, const std::string& killer_name, int weapon_id)
|
||||
member->SendGameOver();
|
||||
}
|
||||
}
|
||||
if (team_members != members) {
|
||||
SendGameOver();
|
||||
}
|
||||
}
|
||||
DeadDrop();
|
||||
}
|
||||
@ -1960,6 +1963,7 @@ void Human::InternalSendGameOver()
|
||||
int hum_uniid = param.param1;
|
||||
Room* room = RoomMgr::Instance()->GetRoomByUuid(room_uuid);
|
||||
if (room) {
|
||||
room->pending_request--;
|
||||
Entity* entity = room->GetEntityByUniId(hum_uniid);
|
||||
if (entity && entity->entity_type == ET_Player) {
|
||||
Human* hum = (Human*)entity;
|
||||
@ -1972,14 +1976,6 @@ void Human::InternalSendGameOver()
|
||||
cs::SMGameOver msg;
|
||||
hum->FillSMGameOver(msg);
|
||||
hum->SendNotifyMsg(msg);
|
||||
if (hum->socket_handle == 0) {
|
||||
a8::UdpLog::Instance()->Error("battleReport socket_handle error room_uuid:%s account_id:%s nickname:%s ",
|
||||
{
|
||||
room_uuid,
|
||||
hum->account_id,
|
||||
hum->name
|
||||
});
|
||||
}
|
||||
if (!hum->sent_game_end_ && hum->entity_subtype == EST_Player) {
|
||||
GameLog::Instance()->GameEnd((Player*)hum);
|
||||
hum->sent_game_end_ = true;
|
||||
@ -1998,6 +1994,7 @@ void Human::InternalSendGameOver()
|
||||
int hum_uniid = param.param1;
|
||||
Room* room = RoomMgr::Instance()->GetRoomByUuid(room_uuid);
|
||||
if (room) {
|
||||
room->pending_request--;
|
||||
Entity* entity = room->GetEntityByUniId(hum_uniid);
|
||||
if (entity && entity->entity_type == ET_Player) {
|
||||
Human* hum = (Human*)entity;
|
||||
@ -2019,6 +2016,7 @@ void Human::InternalSendGameOver()
|
||||
} else {
|
||||
url = "https://game2001api.kingsome.cn/webapp/index.php?c=Role&a=battleReport";
|
||||
}
|
||||
room->pending_request++;
|
||||
std::string data;
|
||||
params->ToUrlEncodeStr(data);
|
||||
f8::HttpClientPool::Instance()->HttpGet(
|
||||
|
@ -75,6 +75,10 @@ void Room::Init()
|
||||
|
||||
void Room::UnInit()
|
||||
{
|
||||
if (game_over_timer) {
|
||||
a8::Timer::Instance()->DeleteTimer(game_over_timer);
|
||||
game_over_timer = nullptr;
|
||||
}
|
||||
xtimer_attacher.ClearTimerList();
|
||||
if (stats_timer_) {
|
||||
a8::Timer::Instance()->DeleteTimer(stats_timer_);
|
||||
|
@ -42,12 +42,15 @@ public:
|
||||
GasData gas_data;
|
||||
bool game_over = false;
|
||||
long long game_over_frameno = 0;
|
||||
long long game_over_tick = 0;
|
||||
timer_list* game_over_timer = nullptr;
|
||||
RoomProfile profile;
|
||||
a8::XTimer xtimer;
|
||||
Plane plane;
|
||||
GridService grid_service;
|
||||
MapService map_service;
|
||||
long long battle_start_frameno_ = 0;
|
||||
long long pending_request = 0;
|
||||
|
||||
~Room();
|
||||
void Init();
|
||||
|
@ -104,25 +104,28 @@ Room* RoomMgr::GetRoomByUuid(long long room_uuid)
|
||||
|
||||
void RoomMgr::AddOverRoom(long long room_uuid)
|
||||
{
|
||||
inactive_room_hash_.erase(room_uuid);
|
||||
a8::Timer::Instance()->AddDeadLineTimer(1000,
|
||||
a8::XParams()
|
||||
.SetSender(room_uuid),
|
||||
[] (const a8::XParams& param)
|
||||
auto callback = [] (const a8::XParams& param)
|
||||
{
|
||||
Room* room = RoomMgr::Instance()->GetRoomByUuid(param.sender);
|
||||
if (room) {
|
||||
if ((room->pending_request <= 0) ||
|
||||
(a8::XGetTickCount() - room->game_over_tick > 1000 * 8)) {
|
||||
RoomMgr::Instance()->room_hash_.erase(room->room_uuid);
|
||||
RoomMgr::Instance()->over_room_hash_[room->room_uuid] = room;
|
||||
RoomMgr::Instance()->FreeOverRoom(param.sender);
|
||||
}
|
||||
});
|
||||
a8::Timer::Instance()->AddDeadLineTimer(1000 + 100,
|
||||
}
|
||||
};
|
||||
|
||||
inactive_room_hash_.erase(room_uuid);
|
||||
Room* room = GetRoomByUuid(room_uuid);
|
||||
if (room) {
|
||||
room->game_over_tick = a8::XGetTickCount();
|
||||
room->game_over_timer = a8::Timer::Instance()->AddRepeatTimer(500,
|
||||
a8::XParams()
|
||||
.SetSender(room_uuid),
|
||||
[] (const a8::XParams& param)
|
||||
{
|
||||
RoomMgr::Instance()->FreeOverRoom(param.sender);
|
||||
});
|
||||
callback);
|
||||
}
|
||||
}
|
||||
|
||||
void RoomMgr::ActiveRoom(long long room_uuid)
|
||||
|
@ -9,5 +9,6 @@ enum SSMessageId_e
|
||||
_SS_WSP_SocketDisconnect = 10;
|
||||
_SS_WSP_RequestTargetServer = 11;
|
||||
_SS_MS_ResponseTargetServer = 12;
|
||||
_SS_ForceCloseSocket = 13;
|
||||
|
||||
}
|
||||
|
@ -29,3 +29,7 @@ message SS_MS_ResponseTargetServer
|
||||
optional string host = 4;
|
||||
optional int32 port = 5;
|
||||
}
|
||||
|
||||
message SS_ForceCloseSocket
|
||||
{
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user