修复倒下后救人问题

This commit is contained in:
aozhiwei 2020-04-08 09:58:09 +08:00
parent 3d163d1cea
commit 7ea2993778
6 changed files with 17 additions and 72 deletions

View File

@ -110,64 +110,8 @@ static void SavePerfLog()
f8::HttpClientPool::Instance()->max_user_request_delay = 0;
}
static void HttpTest()
{
for (int i = 0; i < 70; ++i) {
a8::Timer::Instance()->AddRepeatTimer(100 + rand() % 1000,
a8::XParams(),
[] (const a8::XParams& param)
{
f8::HttpClientPool::Instance()->HttpGet(
a8::XParams(),
nullptr,
nullptr,
//"http://game2001-test.kingsome.cn/webapp/index.php?c=Ops&a=selfChecking",
"http://192.144.140.87:7101/webapp/index.php?c=Ops&a=selfChecking",
//("http://127.0.0.1:7112/webapp/index.php?c=Ops&a=selfChecking&time=" + a8::XValue(a8::XGetTickCount() + rand()).GetString()).c_str(),
a8::XObject(),
MAX_SYS_HTTP_NUM + (rand() % MAX_USER_HTTP_NUM)
);
});
}
}
static void test()
{
{
std::map<std::string, std::string> test_hash;
for (int i = 0; i < 10; ++i) {
test_hash[a8::XValue(i).GetString()] = a8::XValue(i).GetString();
}
std::map<std::string, std::string> test_hash_copy;
bool combin_ok = false;
do {
combin_ok = false;
int i = 0;
for (auto& pair1 : test_hash) {
for (auto& pair2 : test_hash_copy) {
++i;
if (i > 3) {
std::string t1 = pair1.first;
std::string t2 = pair2.first;
test_hash.erase(t1);
test_hash.erase(t2);
test_hash_copy.erase(t1);
test_hash_copy.erase(t2);
combin_ok = true;
break;
}
}
}
} while(combin_ok);
}
}
bool App::Init(int argc, char* argv[])
{
#if 0
test();
#endif
signal(SIGPIPE, SIG_IGN);
this->argc = argc;
this->argv = argv;
@ -241,9 +185,6 @@ bool App::Init(int argc, char* argv[])
}
);
}
if (HasFlag(8)) {
HttpTest();
}
return true;
}

View File

@ -68,6 +68,15 @@ enum ActionType_e
AT_Rescue = 4
};
enum RoomType_e
{
RT_FirstBrid = 0,
RT_NewBrid = 2,
RT_MidBrid = 3,
RT_OldBrid = 4,
RT_Max
};
enum InventorySlot_e
{
IS_9MM = 0,

View File

@ -691,6 +691,9 @@ void Player::LootInteraction(Loot* entity)
void Player::HumanInteraction(Human* hum)
{
if (downed) {
return;
}
if (hum == this) {
return;
}

View File

@ -17,15 +17,6 @@ namespace MetaData
struct MapTplThing;
}
enum RoomType_e
{
RT_FirstBrid = 0,
RT_NewBrid = 2,
RT_MidBrid = 3,
RT_OldBrid = 4,
RT_Max
};
struct timer_list;
struct xtimer_list;
class Entity;

View File

@ -103,9 +103,11 @@ void RoomMgr::_CMJoin(f8::MsgHdr& hdr, const cs::CMJoin& msg)
});
return;
}
Room* room = GetJoinableRoom(msg);
RoomType_e self_room_type = GetHumanRoomType(msg);
Room* room = GetJoinableRoom(msg, self_room_type);
if (!room) {
room = new Room();
room->room_type = self_room_type;
room->room_uuid = App::Instance()->NewUuid();
if (GetRoomByUuid(room->room_uuid)) {
abort();
@ -145,9 +147,8 @@ int RoomMgr::OverRoomNum()
return over_room_hash_.size();
}
Room* RoomMgr::GetJoinableRoom(const cs::CMJoin& msg)
Room* RoomMgr::GetJoinableRoom(const cs::CMJoin& msg, const RoomType_e self_room_type)
{
RoomType_e self_room_type = GetHumanRoomType(msg);
std::vector<std::vector<Room*>> group_rooms;
for (int i = 0; i < RT_Max; ++i) {
group_rooms.push_back(std::vector<Room*>());

View File

@ -31,7 +31,7 @@ class RoomMgr : public a8::Singleton<RoomMgr>
void InstallReportStateTimer();
private:
Room* GetJoinableRoom(const cs::CMJoin& msg);
Room* GetJoinableRoom(const cs::CMJoin& msg, const RoomType_e self_room_type);
void ReportServerState(int instance_id, const std::string& host, int port);
void FreeOverRoom(long long room_uuid);
bool IsLimitJoin();