1
This commit is contained in:
parent
6f32e4aa6d
commit
2ce87e13a5
@ -92,16 +92,11 @@ void MapInstance::Init()
|
|||||||
map_service_->Init(map_meta_->map_width() / MAP_GRID_WIDTH,
|
map_service_->Init(map_meta_->map_width() / MAP_GRID_WIDTH,
|
||||||
map_meta_->map_height() / MAP_GRID_WIDTH,
|
map_meta_->map_height() / MAP_GRID_WIDTH,
|
||||||
MAP_GRID_WIDTH);
|
MAP_GRID_WIDTH);
|
||||||
CreateThings();
|
|
||||||
f8::UdpLog::Instance()->Info
|
f8::UdpLog::Instance()->Info
|
||||||
("map_id:%d current_uniid:%d ",
|
("map_id:%d",
|
||||||
{
|
{
|
||||||
map_id,
|
map_id
|
||||||
current_uniid_,
|
|
||||||
});
|
});
|
||||||
if (current_uniid_ >= FIXED_OBJECT_MAXID) {
|
|
||||||
A8_ABORT();
|
|
||||||
}
|
|
||||||
{
|
{
|
||||||
navmesh_ = dtAllocNavMesh();
|
navmesh_ = dtAllocNavMesh();
|
||||||
FILE *fp = fopen((mt::MetaMgr::Instance()->GetResDir() + "map4.bin").c_str(), "rb");
|
FILE *fp = fopen((mt::MetaMgr::Instance()->GetResDir() + "map4.bin").c_str(), "rb");
|
||||||
@ -208,24 +203,6 @@ void MapInstance::AttachRoom(Room* room, RoomInitInfo& init_info)
|
|||||||
init_info.map_instance = shared_from_this();
|
init_info.map_instance = shared_from_this();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MapInstance::CreateThings()
|
|
||||||
{
|
|
||||||
map_tpl_name_ = map_meta_->RandTemplate();
|
|
||||||
}
|
|
||||||
|
|
||||||
Entity* MapInstance::GetEntityByUniId(int uniid)
|
|
||||||
{
|
|
||||||
auto itr = uniid_hash_.find(uniid);
|
|
||||||
return itr != uniid_hash_.end() ? itr->second : nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
int MapInstance::AllocUniid()
|
|
||||||
{
|
|
||||||
while (GetEntityByUniId(++current_uniid_) || current_uniid_ == 0) {
|
|
||||||
}
|
|
||||||
return current_uniid_;
|
|
||||||
}
|
|
||||||
|
|
||||||
int MapInstance::FindStraightPath(
|
int MapInstance::FindStraightPath(
|
||||||
const glm::vec3& start,
|
const glm::vec3& start,
|
||||||
const glm::vec3& end,
|
const glm::vec3& end,
|
||||||
|
@ -16,7 +16,6 @@ struct HouseInfo
|
|||||||
std::vector<float> verts;
|
std::vector<float> verts;
|
||||||
};
|
};
|
||||||
|
|
||||||
class Entity;
|
|
||||||
class Obstacle;
|
class Obstacle;
|
||||||
class MapService;
|
class MapService;
|
||||||
class GridService;
|
class GridService;
|
||||||
@ -33,7 +32,6 @@ class MapInstance : public std::enable_shared_from_this<MapInstance>
|
|||||||
void AttachRoom(Room* room, RoomInitInfo& init_info);
|
void AttachRoom(Room* room, RoomInitInfo& init_info);
|
||||||
const mt::Map* GetMapMeta() { return map_meta_; };
|
const mt::Map* GetMapMeta() { return map_meta_; };
|
||||||
std::vector<int>& GetPolyExtDatas() { return poly_ext_datas_; };
|
std::vector<int>& GetPolyExtDatas() { return poly_ext_datas_; };
|
||||||
Entity* GetEntityByUniId(int uniid);
|
|
||||||
|
|
||||||
dtNavMesh* GetNavMesh() { return navmesh_; };
|
dtNavMesh* GetNavMesh() { return navmesh_; };
|
||||||
dtNavMeshQuery* GetNavMeshQuery() { return navmesh_query_; };
|
dtNavMeshQuery* GetNavMeshQuery() { return navmesh_query_; };
|
||||||
@ -61,9 +59,7 @@ class MapInstance : public std::enable_shared_from_this<MapInstance>
|
|||||||
glm::vec3& hit_pos, float& ray_length);
|
glm::vec3& hit_pos, float& ray_length);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void CreateThings();
|
|
||||||
void LoadHouse();
|
void LoadHouse();
|
||||||
int AllocUniid();
|
|
||||||
void MarkMapAreaPolys();
|
void MarkMapAreaPolys();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@ -74,9 +70,6 @@ class MapInstance : public std::enable_shared_from_this<MapInstance>
|
|||||||
float hit_pos_[3];
|
float hit_pos_[3];
|
||||||
dtPolyRef polys_[MAX_POLYS];
|
dtPolyRef polys_[MAX_POLYS];
|
||||||
|
|
||||||
int current_uniid_ = 0;
|
|
||||||
std::map<int, Entity*> uniid_hash_;
|
|
||||||
|
|
||||||
std::vector<int> poly_ext_datas_;
|
std::vector<int> poly_ext_datas_;
|
||||||
|
|
||||||
std::list<HouseInfo> houses_;
|
std::list<HouseInfo> houses_;
|
||||||
|
@ -237,9 +237,6 @@ Player* Room::GetPlayerByUniId(int uniid)
|
|||||||
|
|
||||||
Entity* Room::GetEntityByUniId(int uniid)
|
Entity* Room::GetEntityByUniId(int uniid)
|
||||||
{
|
{
|
||||||
if (uniid < FIXED_OBJECT_MAXID) {
|
|
||||||
return map_instance->GetEntityByUniId(uniid);
|
|
||||||
}
|
|
||||||
auto itr = uniid_hash_.find(uniid);
|
auto itr = uniid_hash_.find(uniid);
|
||||||
return itr != uniid_hash_.end() ? itr->second : nullptr;
|
return itr != uniid_hash_.end() ? itr->second : nullptr;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user