Compare commits
3 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
7d716e26ab | ||
![]() |
d5c9c4f65e | ||
![]() |
8c77fc5b0c |
3
.gitmodules
vendored
3
.gitmodules
vendored
@ -13,3 +13,6 @@
|
||||
[submodule "third_party/f8"]
|
||||
path = third_party/f8
|
||||
url = git@git.kingsome.cn:server_common/f8.git
|
||||
[submodule "third_party/recastnavigation_v1.6.0"]
|
||||
path = third_party/recastnavigation_v1.6.0
|
||||
url = git@git.kingsome.cn:server_common/recastnavigation_v1.6.0.git
|
||||
|
11
README.md
11
README.md
@ -15,3 +15,14 @@ SMUiUpdate
|
||||
https://www.cnblogs.com/fellow1988/p/17263427.html
|
||||
|
||||
export ASAN_OPTIONS=halt_on_error=false:print_scariness=true:fast_unwind_on_malloc=true:detect_leak=1
|
||||
|
||||
|
||||
if (owner_->IsPlayer()) {
|
||||
start.x = 302.209595;
|
||||
start.y = 6.18993711;
|
||||
start.z = 49.6232567;
|
||||
|
||||
end.x = 308.426758;
|
||||
end.y = 6.18993711;
|
||||
end.z = 44.5886955;
|
||||
}
|
||||
|
@ -31,9 +31,9 @@ include_directories(
|
||||
/usr/include/glm
|
||||
../../third_party
|
||||
../../third_party/behaviac/inc
|
||||
../../third_party/recastnavigation/Recast/Include
|
||||
../../third_party/recastnavigation/Detour/Include
|
||||
../../third_party/recastnavigation/DetourTileCache/Include
|
||||
../../third_party/recastnavigation_v1.6.0/Recast/Include
|
||||
../../third_party/recastnavigation_v1.6.0/Detour/Include
|
||||
../../third_party/recastnavigation_v1.6.0/DetourTileCache/Include
|
||||
behaviac_generated/types
|
||||
behaviac_generated/types/internal
|
||||
.
|
||||
@ -53,15 +53,15 @@ aux_source_directory(../../third_party/f8/f8
|
||||
SRC_LIST
|
||||
)
|
||||
|
||||
aux_source_directory(../../third_party/recastnavigation/Recast/Source
|
||||
aux_source_directory(../../third_party/recastnavigation_v1.6.0/Recast/Source
|
||||
SRC_LIST
|
||||
)
|
||||
|
||||
aux_source_directory(../../third_party/recastnavigation/Detour/Source
|
||||
aux_source_directory(../../third_party/recastnavigation_v1.6.0/Detour/Source
|
||||
SRC_LIST
|
||||
)
|
||||
|
||||
aux_source_directory(../../third_party/recastnavigation/DetourTileCache/Source
|
||||
aux_source_directory(../../third_party/recastnavigation_v1.6.0/DetourTileCache/Source
|
||||
SRC_LIST
|
||||
)
|
||||
|
||||
|
@ -73,11 +73,6 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
virtual void OnConnect() override
|
||||
{
|
||||
f8::UdpLog::Instance()->Warning("OnConnect socket_handle:%d", {socket_handle});
|
||||
}
|
||||
|
||||
virtual void OnRawHttpGet(const std::string& url, const std::string& querystr,
|
||||
std::string& response) override
|
||||
{
|
||||
@ -96,7 +91,6 @@ public:
|
||||
|
||||
virtual void OnDisConnect() override
|
||||
{
|
||||
f8::UdpLog::Instance()->Warning("OnDisConnect socket_handle:%d", {socket_handle});
|
||||
f8::MsgQueue::Instance()->PostMsg
|
||||
(IM_ClientSocketDisconnect,
|
||||
a8::Args
|
||||
@ -247,7 +241,7 @@ void GGListener::RemoveSocketDisconnectHandler(std::weak_ptr<SocketDisconnectHan
|
||||
p->cb = nullptr;
|
||||
p->holder = nullptr;
|
||||
#if 1
|
||||
f8::UdpLog::Instance()->Warning("RemoveSocketDisconnectHandler socket_handle:%d time:%d",
|
||||
f8::UdpLog::Instance()->Warning("RemoveSocketDisconnectHandler socket_handle%d time:%d",
|
||||
{
|
||||
p->socket_handle,
|
||||
a8::XGetTickCount() - p->add_tick
|
||||
@ -259,17 +253,5 @@ void GGListener::RemoveSocketDisconnectHandler(std::weak_ptr<SocketDisconnectHan
|
||||
|
||||
void GGListener::OnClientDisconnect(int socket_handle)
|
||||
{
|
||||
auto itr = disconnect_listener_hash_.find(socket_handle);
|
||||
if (itr != disconnect_listener_hash_.end()) {
|
||||
std::vector<std::weak_ptr<SocketDisconnectHandler>> del_handlers;
|
||||
SocketDisconnectHandler *handle = nullptr, *tmp = nullptr;
|
||||
list_for_each_entry_safe(handle, tmp, &itr->second, entry) {
|
||||
del_handlers.push_back(handle->holder);
|
||||
handle->cb(a8::Args({itr->first}));
|
||||
}
|
||||
for (auto handler : del_handlers) {
|
||||
RemoveSocketDisconnectHandler(handler);
|
||||
}
|
||||
}
|
||||
PlayerMgr::Instance()->OnClientDisconnect(socket_handle);
|
||||
}
|
||||
|
@ -16,13 +16,10 @@
|
||||
#include "jsondatamgr.h"
|
||||
#include "player.h"
|
||||
#include "mapinstance.h"
|
||||
#include "human.h"
|
||||
#include "stats.h"
|
||||
|
||||
#include "mt/MapMode.h"
|
||||
#include "mt/Hero.h"
|
||||
#include "mt/MapThing.h"
|
||||
#include "mt/Param.h"
|
||||
|
||||
const int BOX_ID = 150001;
|
||||
|
||||
@ -56,39 +53,6 @@ void BoxDrop::OnObstacleDeadDrop(Obstacle* ob)
|
||||
}
|
||||
}
|
||||
|
||||
void BoxDrop::OnHumanDeadDrop(Human* hum)
|
||||
{
|
||||
if (hum->box_num <= 0) {
|
||||
return;
|
||||
}
|
||||
if (room_->IsGameOver()) {
|
||||
return;
|
||||
}
|
||||
if (room_->GetVictoryTeam()) {
|
||||
return;
|
||||
}
|
||||
int drop_num = 0;
|
||||
for (int i = 0; i < hum->box_num; ++i) {
|
||||
int rnd = a8::RandEx(0, 100);
|
||||
if (hum->stats->abandon_battle) {
|
||||
if (rnd <= (mt::Param::s().battle_event_end_loss_rate_quit * 100)) {
|
||||
++drop_num;
|
||||
}
|
||||
} else {
|
||||
if (rnd <= (mt::Param::s().battle_event_end_loss_rate_dead * 100)) {
|
||||
++drop_num;
|
||||
}
|
||||
}
|
||||
}
|
||||
drop_num = std::min(drop_num, hum->box_num);
|
||||
if (drop_num > 0) {
|
||||
Drop(drop_num, hum->GetPos().ToGlmVec3());
|
||||
hum->box_num -= drop_num;
|
||||
room_->frame_event.AddPropChgEx(hum->GetWeakPtrRef(), kPropBoxNum, 0, hum->box_num,
|
||||
0, 0, false);
|
||||
}
|
||||
}
|
||||
|
||||
void BoxDrop::Drop(int num, const glm::vec3& center)
|
||||
{
|
||||
for (int i = 0; i < num; ++i) {
|
||||
|
@ -3,7 +3,6 @@
|
||||
class Room;
|
||||
class Hero;
|
||||
class Obstacle;
|
||||
class Human;
|
||||
|
||||
class BoxDrop : public std::enable_shared_from_this<BoxDrop>
|
||||
{
|
||||
@ -15,7 +14,6 @@ class BoxDrop : public std::enable_shared_from_this<BoxDrop>
|
||||
void OnBattleStart();
|
||||
void OnHeroDeadDrop(Hero* hero);
|
||||
void OnObstacleDeadDrop(Obstacle* ob);
|
||||
void OnHumanDeadDrop(Human* hum);
|
||||
void RequestReturnBoxNum();
|
||||
bool GetNextBoxPos(glm::vec3& pos);
|
||||
void DropByUuid(int obj_uniid, const glm::vec3& center);
|
||||
|
@ -998,6 +998,9 @@ void CallFuncBuff::ClearSummonHero()
|
||||
{
|
||||
int hero_id = meta->_int_buff_param2;
|
||||
float hero_num = meta->GetBuffParam3(this);
|
||||
if (hero_id == 9011) {
|
||||
a8::XPrintf("ClearSummonHero 9011\n", {});
|
||||
}
|
||||
owner->RemoveSurplusHero(hero_id, hero_num);
|
||||
}
|
||||
|
||||
|
@ -32,6 +32,10 @@
|
||||
#include "mt/Map.h"
|
||||
#include "mt/MobaRoom.h"
|
||||
|
||||
#define BOOST_STACKTRACE_USE_ADDR2LINE
|
||||
#include <boost/stacktrace.hpp>
|
||||
#include <iostream>
|
||||
|
||||
Hero::Hero():Creature()
|
||||
{
|
||||
++PerfMonitor::Instance()->entity_num[ET_Hero];
|
||||
@ -44,6 +48,11 @@ Hero::Hero():Creature()
|
||||
|
||||
Hero::~Hero()
|
||||
{
|
||||
if (GetHeroMeta()->id() == 9011) {
|
||||
a8::XPrintf("DestoryHero 9011\n", {});
|
||||
std::cout << boost::stacktrace::stacktrace();
|
||||
int i = 0;
|
||||
}
|
||||
SetDestorying();
|
||||
DetachFromMaster();
|
||||
if (agent_) {
|
||||
|
@ -44,7 +44,6 @@
|
||||
#include "hero.h"
|
||||
#include "bornpoint.h"
|
||||
#include "ingamevoice.h"
|
||||
#include "boxdrop.h"
|
||||
|
||||
#include "buff/sprint.h"
|
||||
|
||||
@ -3101,7 +3100,6 @@ void Human::InternalBeKill(int killer_id, const std::string& killer_name, int we
|
||||
}
|
||||
#endif
|
||||
if (!dead && !room->IsGameOver() && !real_dead) {
|
||||
room->GetBoxDrop()->OnHumanDeadDrop(this);
|
||||
KillInfo info;
|
||||
{
|
||||
info.killer_id = killer_id;
|
||||
|
@ -481,7 +481,11 @@ bool MapInstance::Raycast(const glm::vec3& start, const glm::vec3& end,
|
||||
float t = 0;
|
||||
int npolys;
|
||||
memset(hit_normal_, 0, sizeof(hit_normal_));
|
||||
#if 1
|
||||
status = navmesh_query_->newRaycast(666, startRef, spos, epos, &filter, &t, hit_normal_, polys_, &npolys, MAX_POLYS);
|
||||
#else
|
||||
status = navmesh_query_->raycast(startRef, spos, epos, &filter, &t, hit_normal_, polys_, &npolys, MAX_POLYS);
|
||||
#endif
|
||||
if (!dtStatusSucceed(status)) {
|
||||
#ifdef MYDEBUG
|
||||
abort();
|
||||
@ -773,7 +777,11 @@ bool MapInstance::RaycastEx(const glm::vec3& start, const glm::vec3& end,
|
||||
float t = 0;
|
||||
int npolys;
|
||||
memset(hit_normal_, 0, sizeof(hit_normal_));
|
||||
#if 1
|
||||
status = navmesh_query_->newRaycast(666, startRef, spos, epos, &filter, &t, hit_normal_, polys_, &npolys, MAX_POLYS);
|
||||
#else
|
||||
status = navmesh_query_->raycast(startRef, spos, epos, &filter, &t, hit_normal_, polys_, &npolys, MAX_POLYS);
|
||||
#endif
|
||||
if (!dtStatusSucceed(status)) {
|
||||
#ifdef MYDEBUG
|
||||
abort();
|
||||
|
@ -124,6 +124,17 @@ void Movement::CalcTargetPos(float distance)
|
||||
glm::vec3 hit_point;
|
||||
owner_->room->map_instance->Scale(start);
|
||||
owner_->room->map_instance->Scale(end);
|
||||
#if 0
|
||||
if (owner_->IsPlayer()) {
|
||||
start.x = 302.209595;
|
||||
start.y = 6.18993711;
|
||||
start.z = 49.6232567;
|
||||
|
||||
end.x = 308.426758;
|
||||
end.y = 6.18993711;
|
||||
end.z = 44.5886955;
|
||||
}
|
||||
#endif
|
||||
bool ret = owner_->room->map_instance->RaycastEx(start, end, hit_point, hit_result,
|
||||
point.same_polys_flags, point.spec_polys, exclude_flags);
|
||||
if (ret) {
|
||||
|
@ -110,9 +110,9 @@ namespace mt
|
||||
}
|
||||
auto itr = _trigger_type_buffs.find(buff_meta->trigger_type());
|
||||
if (itr != _trigger_type_buffs.end()) {
|
||||
itr->second.push_back(buff_meta);
|
||||
itr->second.insert(buff_meta);
|
||||
} else {
|
||||
_trigger_type_buffs[buff_meta->trigger_type()] = std::vector<const mt::Buff*>({buff_meta});
|
||||
_trigger_type_buffs[buff_meta->trigger_type()] = std::set<const mt::Buff*>({buff_meta});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -37,7 +37,7 @@ namespace mt
|
||||
const mt::Skill* _base_skill_meta = nullptr;
|
||||
float _value_up = 0.0f;
|
||||
std::set<int> _buff_list;
|
||||
std::map<int, std::vector<const mt::Buff*>> _trigger_type_buffs;
|
||||
std::map<int, std::set<const mt::Buff*>> _trigger_type_buffs;
|
||||
std::vector<mt::SkillPhase> _phases;
|
||||
std::vector<mt::SkillPhase> _raw_phases;
|
||||
bool IsTurnOverSkill() const;
|
||||
|
@ -897,6 +897,10 @@ Hero* Room::CreateHero(Creature* master,
|
||||
int team_id,
|
||||
int obj_uniid)
|
||||
{
|
||||
if (meta->id() == 9011) {
|
||||
a8::XPrintf("CreateHero 9011\n", {});
|
||||
int i = 0;
|
||||
}
|
||||
if (obj_uniid > 0) {
|
||||
if (GetEntityByUniId(obj_uniid)) {
|
||||
abort();
|
||||
|
@ -78,13 +78,6 @@ void RoomMgr::_CMJoin(f8::MsgHdr* hdr, const cs::CMJoin& msg)
|
||||
{
|
||||
#ifdef MYDEBUG
|
||||
a8::XPrintf("CMJoin socket_handle:%d\n", {hdr->socket_handle});
|
||||
#endif
|
||||
#if 1
|
||||
f8::UdpLog::Instance()->Warning("CMJoin account_id:%s socket_handle:%d",
|
||||
{
|
||||
msg.account_id(),
|
||||
hdr->socket_handle,
|
||||
});
|
||||
#endif
|
||||
if (IsLimitJoin()) {
|
||||
JoinErrorHandle(msg, 2, hdr->socket_handle);
|
||||
@ -94,7 +87,7 @@ void RoomMgr::_CMJoin(f8::MsgHdr* hdr, const cs::CMJoin& msg)
|
||||
auto member = GetCustomMemberBySocket(hdr->socket_handle);
|
||||
if (member) {
|
||||
#if 1
|
||||
f8::UdpLog::Instance()->Warning("JoinError socket already exits socket_handle:%d",
|
||||
f8::UdpLog::Instance()->Warning("JoinError socket_not_exits socket_handle%d",
|
||||
{
|
||||
hdr->socket_handle,
|
||||
});
|
||||
|
@ -22,7 +22,7 @@
|
||||
class EventHandler : public std::enable_shared_from_this<EventHandler>
|
||||
{
|
||||
public:
|
||||
std::shared_ptr<a8::CommonCbProc> cb;
|
||||
a8::CommonCbProc cb;
|
||||
list_head entry;
|
||||
std::shared_ptr<EventHandler> holder;
|
||||
|
||||
@ -497,8 +497,7 @@ std::weak_ptr<EventHandler> Trigger::AddListener(int event_id, a8::CommonCbProc
|
||||
INIT_LIST_HEAD(&itr->second);
|
||||
}
|
||||
auto p = std::make_shared<EventHandler>();
|
||||
p->cb = std::make_shared<a8::CommonCbProc>();
|
||||
*p->cb = cb;
|
||||
p->cb = cb;
|
||||
list_add_tail(&p->entry, &itr->second);
|
||||
p->holder = p;
|
||||
return p;
|
||||
@ -521,17 +520,13 @@ void Trigger::RemoveEventHandlers(std::vector<std::weak_ptr<EventHandler>> handl
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
!!!
|
||||
*/
|
||||
void Trigger::DispatchEvent(int event_id, const std::vector<std::any>& param)
|
||||
{
|
||||
auto itr = listeners_hash_.find(event_id);
|
||||
if (itr != listeners_hash_.end()) {
|
||||
struct EventHandler *handle = nullptr, *tmp = nullptr;
|
||||
list_for_each_entry_safe(handle, tmp, &itr->second, entry) {
|
||||
auto cb = handle->cb;
|
||||
(*cb)(param);
|
||||
handle->cb(param);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -32,7 +32,7 @@ void PlayerMgr::Init()
|
||||
account_id_hash_[hum->GetAccountId()] = hum;
|
||||
socket_id_hash_[hum->GetSocketId()] = hum;
|
||||
++count;
|
||||
if (count >= 3) {
|
||||
if (count >= 300) {
|
||||
f8::Timer::Instance()->DeleteCurrentTimer();
|
||||
}
|
||||
}
|
||||
|
1
third_party/recastnavigation_v1.6.0
vendored
Submodule
1
third_party/recastnavigation_v1.6.0
vendored
Submodule
@ -0,0 +1 @@
|
||||
Subproject commit 6dc1667f580357e8a2154c28b7867bea7e8ad3a7
|
Loading…
x
Reference in New Issue
Block a user