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